Skip to content

Commit

Permalink
separate big modules to different repos
Browse files Browse the repository at this point in the history
Refactor
  • Loading branch information
MAfarrag authored Jan 3, 2025
2 parents 10d1aec + 50645ce commit d06f980
Show file tree
Hide file tree
Showing 865 changed files with 14,747 additions and 2,000,971 deletions.
5 changes: 0 additions & 5 deletions .flake8

This file was deleted.

2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Check relevant points.

# Checklist:

- [ ] updated version number in setup.py/pyproject.toml
- [ ] updated version number in pyproject.toml
- [ ] updated environment.yml and the lock file
- [ ] added changes to History.rst
- [ ] updated the latest version in README file
Expand Down
43 changes: 43 additions & 0 deletions .github/workflows/conda-deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: conda-deployment

on: [push]

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

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

- name: Install dev-dependencies
shell: bash -el {0}
run: |
pip install pytest
pip install .[test] --no-deps --verbose
- name: Run tests
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 }}
43 changes: 43 additions & 0 deletions .github/workflows/pypi-deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: pypi-deployment

on: [push]

jobs:
Main-Package:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
python-version: ["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.10.0
- name: Test GDAL installation
run: |
python -c "from osgeo import gdal"
gdalinfo --version
- name: Install dependencies
run: |
pip install .[dev,test]
- name: Run Tests
run: |
python -m pytest -vvv --cov=src/Hapi --cov-report=xml
- name: Upload coverage reports to Codecov with GitHub Action
uses: codecov/codecov-action@v3
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# 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-package
name: pypi-release

on:
release:
Expand Down
60 changes: 0 additions & 60 deletions .github/workflows/ubuntu.yml

This file was deleted.

30 changes: 30 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -186,3 +186,33 @@ examples/Hydrodynamic models/test_case/results/q/New folder/*
examples/Hydrodynamic models/test_case/results/h/New folder/*
examples/Hydrodynamic models/test_case/results/USbnd/New folder/*
tests/mo/*
/tests/rrm/data/test_results/extract_parameter/01_TT.tif
/tests/rrm/data/test_results/extract_parameter/02_RFCF.tif
/tests/rrm/data/test_results/extract_parameter/03_SFCF.tif
/tests/rrm/data/test_results/extract_parameter/04_CFMAX.tif
/tests/rrm/data/test_results/extract_parameter/05_CWH.tif
/tests/rrm/data/test_results/extract_parameter/06_CFR.tif
/tests/rrm/data/test_results/extract_parameter/07_FC.tif
/tests/rrm/data/test_results/extract_parameter/08_BETA.tif
/tests/rrm/data/test_results/extract_parameter/09_ETF.tif
/tests/rrm/data/test_results/extract_parameter/10_LP.tif
/tests/rrm/data/test_results/extract_parameter/11_K0.tif
/tests/rrm/data/test_results/extract_parameter/12_K1.tif
/tests/rrm/data/test_results/extract_parameter/13_K2.tif
/tests/rrm/data/test_results/extract_parameter/14_UZL.tif
/tests/rrm/data/test_results/extract_parameter/15_PERC.tif
/tests/rrm/data/test_results/extract_parameter/16_MAXBAS.tif
/tests/rrm/data/test_results/extract_parameter/17_K_muskingum.tif
/tests/rrm/data/test_results/extract_parameter/18_X_muskingum.tif
/tests/rrm/data/test_results/extract_parameter/ID1.tif

/tests/rrm/data/test_results/prepare_inputs/0_precip_2009.01.01.tif
/tests/rrm/data/test_results/prepare_inputs/1_precip_2009.01.02.tif
/tests/rrm/data/test_results/prepare_inputs/2_precip_2009.01.03.tif
/tests/rrm/data/test_results/prepare_inputs/3_precip_2009.01.04.tif
/tests/rrm/data/test_results/prepare_inputs/4_precip_2009.01.05.tif
/tests/rrm/data/test_results/prepare_inputs/5_precip_2009.01.06.tif
/tests/rrm/data/test_results/prepare_inputs/6_precip_2009.01.07.tif
/tests/rrm/data/test_results/prepare_inputs/7_precip_2009.01.08.tif
/tests/rrm/data/test_results/prepare_inputs/8_precip_2009.01.09.tif
/tests/rrm/data/test_results/prepare_inputs/9_precip_2009.01.10.tif
69 changes: 34 additions & 35 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
fail_fast: true
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
rev: v5.0.0
hooks:
- id: check-toml
name: "[py - check] check toml"
- id: end-of-file-fixer
name: "[py - check] validate yaml"
- id: no-commit-to-branch
name: "[git - check] no commit to branch"
args: [ --branch=main ]
- 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 ]
args: [ --maxkb=2000 ]
- id: check-docstring-first
name: "[py - check] docstring first"
files: /examples
Expand Down Expand Up @@ -38,52 +43,46 @@ repos:
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
- repo: https://github.com/pycqa/flake8
rev: 7.1.1
hooks:
- id: docformatter
name: "[py - format] docformatter"
args: [ -i, --wrap-summaries, "0" ]

- repo: https://github.com/PyCQA/pydocstyle
rev: 6.1.1
- id: flake8
additional_dependencies: [Flake8-pyproject]
name: "[py - check] flake8"
exclude: ^(examples/|tests/)
# - repo: https://github.com/pycqa/docformatter
# rev: v1.4
# hooks:
# - id: docformatter
# name: "[py - format] docformatter"
# description: 'Formats docstrings to follow PEP 257.'
# entry: docformatter
# args: [-i]
# language: python
# types: [python]
- repo: https://github.com/pycqa/pydocstyle
rev: 6.3.0
hooks:
- id: pydocstyle
name: "[py - check] pydocstyle"
files: ^Hapi/

- repo: https://gitlab.com/pycqa/flake8
rev: 4.0.1
files: ^src/.*\.py$
- repo: https://github.com/pycqa/isort
rev: 5.13.2
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: 22.8.0
- id: isort
name: "[py - format] isort"
- repo: https://github.com/psf/black
rev: 24.10.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: v1.0.6
rev: 1.0.5
hooks:
- id: shell-lint
name: "[bash - lint] shell-lint"
Expand All @@ -108,7 +107,7 @@ repos:
hooks:
- id: pytest-check
name: pytest-check
entry: pytest -vvv --cov=Hapi
entry: pytest -vvv --cov=Hapi --cov-report term-missing
language: system
pass_filenames: false
always_run: true
2 changes: 0 additions & 2 deletions .pydocstyle

This file was deleted.

16 changes: 16 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,19 @@ History
* add smoothDikeLevel, getReach and updateReach
* bump up denpendencies versions
* move un-necessary functions to serapeum-utils


2.0.0 (2025-01-**)
------------------
Dev
---
- Add conda/pypi workfkow
- Add github release workfkow
- Add pypi release workfkow
- remove coverall
- remove flake8 separate config file
- move the main packge files inside src directory
- move the hydrodymanic model to separate repo (serapis)
- move the plot module to the cleopatra package
- replace the setup.py by pyproject.toml
Loading

0 comments on commit d06f980

Please sign in to comment.