Skip to content

Commit

Permalink
chore: drop py3.9, add py3.13, fix conftest.py, use uv in ci
Browse files Browse the repository at this point in the history
Drop python 3.9 and add python 3.13. Fix the apparatus to download example models in conftest.py (hopefully soon to be replaced by devtools models API). Use uv in ci.
  • Loading branch information
wpbonelli authored Mar 9, 2025
1 parent a6c908d commit 0d3fd88
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 76 deletions.
115 changes: 47 additions & 68 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,13 @@ jobs:
- name: Checkout repo
uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v4
- name: Setup uv
uses: astral-sh/setup-uv@v5
with:
python-version: 3.x

- name: Upgrade pip
run: |
python -m pip install --upgrade pip
- name: Base installation
run: |
pip install -e .
cache-dependency-glob: "**/pyproject.toml"

- name: Print version
run: |
python -c "import modflowapi; print(modflowapi.__version__)"
run: uv run python -c "import modflowapi; print(modflowapi.__version__)"

lint:
name: lint
Expand All @@ -54,33 +45,21 @@ jobs:
shell: bash
steps:
- name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@v4

# Standard python fails on Windows without GDAL installation. Using
# standard python here since only linting on linux.
# Use standard bash shell with standard python
- name: Setup Python
uses: actions/setup-python@v4
- name: Setup uv
uses: astral-sh/setup-uv@v5
with:
python-version: 3.x

- name: Print python version
run: |
python --version
- name: Install Python packages
run: |
python -m pip install --upgrade pip
pip install -e .[lint]
enable-cache: false

- name: Lint
run: ruff check .
run: uvx ruff check .

- name: Check format
run: ruff format . --check
- name: Format
run: uvx ruff format . --check

- name: Check spelling
run: codespell
- name: Spelling
run: uvx codespell

autotest_extensions:
name: modflowapi extensions autotests
Expand All @@ -90,27 +69,27 @@ jobs:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
python-version: [ 3.9, "3.10", "3.11", "3.12" ]
python-version: [ "3.10", "3.11", "3.12", "3.13" ]
defaults:
run:
shell: bash
steps:
- name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v4
- name: Setup uv
uses: astral-sh/setup-uv@v5
with:
cache-dependency-glob: "**/pyproject.toml"
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: pyproject.toml

- name: Install
run: uv sync --all-extras

- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install git+https://[email protected]/Deltares/xmipy@develop
pip install git+https://[email protected]/MODFLOW-ORG/modflow-devtools@develop
pip install .[test]
uv pip install git+https://[email protected]/Deltares/xmipy@develop
uv pip install git+https://[email protected]/MODFLOW-ORG/modflow-devtools@develop
- name: Install modflow executables
uses: modflowpy/install-modflow-action@v1
Expand All @@ -121,7 +100,7 @@ jobs:
- name: Run autotests
working-directory: ./autotest
shell: bash -l {0}
run: pytest -v -n auto -m "not mf6"
run: uv run pytest -v -n auto -m "not mf6"

autotest_preidm_extensions:
name: modflowapi pre-idm extensions autotests
Expand All @@ -131,27 +110,27 @@ jobs:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-13, windows-latest ]
python-version: [ 3.9, "3.10", "3.11", "3.12" ]
python-version: [ "3.10", "3.11", "3.12", "3.13" ]
defaults:
run:
shell: bash
steps:
- name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v4
- name: Setup uv
uses: astral-sh/setup-uv@v5
with:
cache-dependency-glob: "**/pyproject.toml"
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: pyproject.toml

- name: Install
run: uv sync --all-extras

- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install git+https://[email protected]/Deltares/xmipy@develop
pip install git+https://[email protected]/MODFLOW-ORG/modflow-devtools@develop
pip install .[test]
uv pip install git+https://[email protected]/Deltares/xmipy@develop
uv pip install git+https://[email protected]/MODFLOW-ORG/modflow-devtools@develop
- name: Install modflow executables
uses: modflowpy/install-modflow-action@v1
Expand All @@ -173,7 +152,7 @@ jobs:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
python-version: [ 3.9, "3.10", "3.11", "3.12" ]
python-version: [ "3.10", "3.11", "3.12", "3.13" ]
defaults:
run:
shell: bash
Expand All @@ -187,23 +166,23 @@ jobs:
repository: MODFLOW-ORG/modflow6-examples
path: modflow6-examples

- name: Setup Python
uses: actions/setup-python@v5
- name: Setup uv
uses: astral-sh/setup-uv@v5
with:
cache-dependency-glob: "**/pyproject.toml"
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: pyproject.toml

- name: Install
run: uv sync --all-extras

- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install git+https://[email protected]/Deltares/xmipy@develop
pip install git+https://[email protected]/MODFLOW-ORG/modflow-devtools@develop
pip install git+https://[email protected]/modflowpy/flopy@develop
pip install .[test]
uv pip install git+https://[email protected]/Deltares/xmipy@develop
uv pip install git+https://[email protected]/MODFLOW-ORG/modflow-devtools@develop
uv pip install git+https://[email protected]/modflowpy/flopy@develop
- name: update flopy for mf6-examples
run: python -m flopy.mf6.utils.generate_classes --ref develop --no-backup
run: uv run python -m flopy.mf6.utils.generate_classes --ref develop --no-backup

- name: Install modflow6 for modflow6-examples
uses: modflowpy/install-modflow-action@v1
Expand All @@ -213,7 +192,7 @@ jobs:
- name: Build mf6-examples
working-directory: modflow6-examples/autotest
run: |
pytest -v -n=auto --init test_scripts.py -k "not synthetic-valley"
uv run pytest -v -n=auto --init test_scripts.py -k "not synthetic-valley"
- name: Install modflow6 nightly build
uses: modflowpy/install-modflow-action@v1
Expand All @@ -224,4 +203,4 @@ jobs:
- name: Run autotests
working-directory: ./autotest
shell: bash -l {0}
run: pytest -v -n=auto test_mf6_examples.py --mf6-examples-path=../modflow6-examples/examples
run: uv run pytest -v -n=auto test_mf6_examples.py --mf6-examples-path=../modflow6-examples/examples
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.9
python-version: '3.10'
cache: 'pip'
cache-dependency-path: pyproject.toml

Expand Down Expand Up @@ -138,7 +138,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.9
python-version: '3.10'

- name: Install Python dependencies
run: |
Expand Down Expand Up @@ -186,7 +186,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.9
python-version: '3.10'

- name: Install Python dependencies
run: |
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ and additional functionality specific to the MODFLOW API. Currently it is a join

## Installation

`modflowapi` requires Python 3.9+, with:
`modflowapi` requires Python 3.10+, with:

```shell
numpy
Expand Down
2 changes: 1 addition & 1 deletion autotest/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def get_mf6_examples_path() -> Path:
if not __mf6_examples_path.is_dir():
__mf6_examples_path.mkdir(exist_ok=True)
download_and_unzip(
url="https://github.com/MODFLOW-ORG/modflow6-examples/releases/download/current/modflow6-examples.zip",
url="https://github.com/MODFLOW-ORG/modflow6-examples/releases/download/current/mf6examples.zip",
path=__mf6_examples_path,
verbose=True,
)
Expand Down
10 changes: 7 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ classifiers = [
"License :: CC0 1.0 Universal (CC0 1.0) Public Domain Dedication",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Topic :: Scientific/Engineering :: Hydrology",
]
requires-python = ">=3.9"
requires-python = ">=3.10"
dependencies = [
"numpy",
"pandas",
Expand All @@ -42,7 +42,7 @@ dependencies = [
dev = ["modflowapi[test,lint]"]
test = [
"filelock",
"modflow-devtools",
"modflow-devtools[dfn] @ git+https://github.com/MODFLOW-ORG/modflow-devtools.git",
"pytest!=8.1.0",
"pytest-order",
"pytest-xdist",
Expand Down Expand Up @@ -72,6 +72,10 @@ packages = ["modflowapi"]
[tool.hatch.version]
path = "modflowapi/version.py"

[tool.hatch.metadata]
# temporary, until new devtools release
allow-direct-references = true

[tool.ruff]
line-length = 88

Expand Down

0 comments on commit 0d3fd88

Please sign in to comment.