Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
MAfarrag committed Jan 2, 2024
1 parent 2f8bf35 commit c29a367
Show file tree
Hide file tree
Showing 24 changed files with 1,444 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[flake8]
ignore = E203, E266, E501, W503, C901, E722, E731, W605, E712, F841, D202, D203
max-line-length = 88
max-complexity = 18
select = B,C,E,F,W,T4
15 changes: 15 additions & 0 deletions .github/ISSUE_TEMPLATE/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
* HapiSM version:
* Python version:
* Operating System:

### Description

Describe what you were trying to get done.
Tell us what happened, what went wrong, and what you expected to happen.

### What I Did

```
Paste the command(s) you ran and the output.
If there was a crash, please include the traceback here.
```
38 changes: 38 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
8 changes: 8 additions & 0 deletions .github/ISSUE_TEMPLATE/custom.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
name: Custom issue template
about: Describe this issue template's purpose here.
title: ''
labels: ''
assignees: ''

---
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
46 changes: 46 additions & 0 deletions .github/workflows/conda-deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: conda-deployment

on: [push]

jobs:
Main-package:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
python-version: ["3.11"]
env:
OS: ${{ matrix.os }}

steps:
- uses: actions/checkout@v3
- uses: conda-incubator/setup-miniconda@v2
with:
mamba-version: "*"
#use-mamba: true
auto-update-conda: false
environment-file: environment.yml
auto-activate-base: false
activate-environment: test
python-version: ${{ matrix.python-version }}
channels: conda-forge,defaults
channel-priority: true
show-channel-urls: true
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
architecture: x64

- name: Install dev-dependencies
run: |
python -m pip install -r requirements-dev.txt
- name: Generate coverage report
shell: bash -el {0}
run: |
conda info
conda list
conda config --show-sources
conda config --show
pytest -sv -m "not plot"
36 changes: 36 additions & 0 deletions .github/workflows/github-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: gitHub-release

on:
workflow_dispatch:
push:
tags:
- '*'

jobs:
create-release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup GitHub CLI
run: |
type -p curl >/dev/null || (sudo apt update && sudo apt install curl -y)
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \
&& sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
&& sudo apt update \
&& sudo apt install gh -y
- name: Extract tag name
run: echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV


- name: Create GitHub Release
id: create_release
run: |
gh release create $TAG_NAME --title "$TAG_NAME" --notes-from-tag
env:
GH_TOKEN: ${{ secrets.CREATE_RELEASE }}
47 changes: 47 additions & 0 deletions .github/workflows/pypi-deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: pypi-deployment

on: [push]

jobs:
Main-Package:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
python-version: ["3.11", "3.12"]
env:
OS: ${{ matrix.os }}

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
architecture: x64

- name: Install GDAL
run: |
python -m pip install --upgrade pip
pip install --no-cache-dir Cython
pip install --find-links=https://girder.github.io/large_image_wheels --no-cache GDAL #==3.7.1
- name: Test GDAL installation
run: |
python -c "from osgeo import gdal"
gdalinfo --version
- name: Install dependencies
run: |
pip install -r requirements.txt -r requirements-dev.txt
python setup.py install
- name: Generate coverage report
run: |
conda info
conda config --show-sources
conda config --show
python -m pytest -vvv --cov=serapis --cov-report=xml
- name: Upload coverage reports to Codecov with GitHub Action
uses: codecov/codecov-action@v3
30 changes: 30 additions & 0 deletions .github/workflows/pypi-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# This workflows will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

name: pypi-release

on:
release:
types: [created]

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERS }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -157,4 +157,4 @@ cython_debug/
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
.idea/
114 changes: 114 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
fail_fast: true
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: end-of-file-fixer
name: "[py - check] validate yaml"
- id: trailing-whitespace
name: "[file - format] trim trailing whitespace"
args: [ --markdown-linebreak-ext=md ]
- id: check-added-large-files
name: "[file - check] large file"
args: [ --maxkb=5000 ]
- id: check-docstring-first
name: "[py - check] docstring first"
files: /examples
types : [file, python ]
- id: check-json
name: "[json - check] validate json"
- id: check-merge-conflict
name: "[git - check] merge conflict"
- id: debug-statements
name: "[py - check] debug statements"
- id: detect-private-key
name: "[cred - check] private keys"
- id: fix-encoding-pragma
name: "[file - format] coding pragma"
args: [ --remove ]
- id: mixed-line-ending
name: "[file - format] mixed line ending"
args: [ --fix=auto ]
- id: pretty-format-json
name: "[json - format] pretty json"
args: [ --autofix,
--indent=4,
--no-sort-keys ]
- id: requirements-txt-fixer
name: "[reqs - format] fix requirements.txt"
- id: check-yaml
name: "[yaml - check] validate yaml"
# - repo: https://github.com/pre-commit/mirrors-isort
# rev: v5.10.1
# hooks:
# - id: isort
# name: "[py - format] isort"
# - repo: https://github.com/PyCQA/docformatter
# rev: v1.4
# hooks:
# - id: docformatter
# name: "[py - format] docformatter"
# args: [ -i, --wrap-summaries, "0" ]

- repo: https://github.com/PyCQA/pydocstyle
rev: 6.3.0
hooks:
- id: pydocstyle
name: "[py - check] pydocstyle"
files: ^Hapi/

- repo: https://github.com/pycqa/flake8
rev: 6.1.0
hooks:
- id: flake8
name: "[py - check] flake8"
# language_version: python3.9
exclude: ^(examples/|tests/)

#- repo: https://github.com/psf/black
# rev: 22.8.0
# hooks:
# - id: black
- repo: https://github.com/ambv/black
rev: 23.11.0
hooks:
- id: black
name: "[py - format] black"
# language_version: python3.9
- repo: https://github.com/lovesegfault/beautysh
rev: v6.2.1
hooks:
- id: beautysh
name: "[bash - format] beautysh"

# pre-commit-shell: Checks shell scripts against shellcheck.
- repo: https://github.com/detailyang/pre-commit-shell
rev: 1.0.5
hooks:
- id: shell-lint
name: "[bash - lint] shell-lint"

- repo: https://github.com/rlindsgaard/pre-commit-commit-msg-hooks
rev: 0.1.0
hooks:
- id: check-description-max-length
name: "[bash - format] check-description-max-length"
- id: check-second-line-empty
name: "[bash - format] check-second-line-empty"
- id: check-summary-capitalized
name: "[bash - format] check-summary-capitalized"
- id: check-summary-imperative
name: "[bash - format] check-summary-imperative"
- id: check-summary-max-length
name: "[bash - format] check-summary-max-length"
- id: check-summary-punctuation
name: "[bash - format] check-summary-punctuation"

- repo: local
hooks:
- id: pytest-check
name: pytest-check
entry: pytest -vvv --cov=serapis --cov-report term-missing
language: system
pass_filenames: false
always_run: true
2 changes: 2 additions & 0 deletions .pydocstyle
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[pydocstyle]
ignore = D202, D413, D417, D107, D213, D203
19 changes: 19 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# .readthedocs.yml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

conda:
environment: docs/environment.yml
# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/conf.py
#Build documentation with MkDocs
#mkdocs:
# configuration: mkdocs.yml


# Optionally build your docs in additional formats such as PDF and ePub
formats: all
Loading

0 comments on commit c29a367

Please sign in to comment.