Skip to content

Commit 0d3fd88

Browse files
authored
chore: drop py3.9, add py3.13, fix conftest.py, use uv in ci
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.
1 parent a6c908d commit 0d3fd88

File tree

5 files changed

+59
-76
lines changed

5 files changed

+59
-76
lines changed

.github/workflows/ci.yml

+47-68
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,13 @@ jobs:
2626
- name: Checkout repo
2727
uses: actions/checkout@v3
2828

29-
- name: Setup Python
30-
uses: actions/setup-python@v4
29+
- name: Setup uv
30+
uses: astral-sh/setup-uv@v5
3131
with:
32-
python-version: 3.x
33-
34-
- name: Upgrade pip
35-
run: |
36-
python -m pip install --upgrade pip
37-
38-
- name: Base installation
39-
run: |
40-
pip install -e .
32+
cache-dependency-glob: "**/pyproject.toml"
4133

4234
- name: Print version
43-
run: |
44-
python -c "import modflowapi; print(modflowapi.__version__)"
35+
run: uv run python -c "import modflowapi; print(modflowapi.__version__)"
4536

4637
lint:
4738
name: lint
@@ -54,33 +45,21 @@ jobs:
5445
shell: bash
5546
steps:
5647
- name: Checkout repo
57-
uses: actions/checkout@v3
48+
uses: actions/checkout@v4
5849

59-
# Standard python fails on Windows without GDAL installation. Using
60-
# standard python here since only linting on linux.
61-
# Use standard bash shell with standard python
62-
- name: Setup Python
63-
uses: actions/setup-python@v4
50+
- name: Setup uv
51+
uses: astral-sh/setup-uv@v5
6452
with:
65-
python-version: 3.x
66-
67-
- name: Print python version
68-
run: |
69-
python --version
70-
71-
- name: Install Python packages
72-
run: |
73-
python -m pip install --upgrade pip
74-
pip install -e .[lint]
53+
enable-cache: false
7554

7655
- name: Lint
77-
run: ruff check .
56+
run: uvx ruff check .
7857

79-
- name: Check format
80-
run: ruff format . --check
58+
- name: Format
59+
run: uvx ruff format . --check
8160

82-
- name: Check spelling
83-
run: codespell
61+
- name: Spelling
62+
run: uvx codespell
8463

8564
autotest_extensions:
8665
name: modflowapi extensions autotests
@@ -90,27 +69,27 @@ jobs:
9069
fail-fast: false
9170
matrix:
9271
os: [ ubuntu-latest, macos-latest, windows-latest ]
93-
python-version: [ 3.9, "3.10", "3.11", "3.12" ]
72+
python-version: [ "3.10", "3.11", "3.12", "3.13" ]
9473
defaults:
9574
run:
9675
shell: bash
9776
steps:
9877
- name: Checkout repo
99-
uses: actions/checkout@v3
78+
uses: actions/checkout@v4
10079

101-
- name: Setup Python
102-
uses: actions/setup-python@v4
80+
- name: Setup uv
81+
uses: astral-sh/setup-uv@v5
10382
with:
83+
cache-dependency-glob: "**/pyproject.toml"
10484
python-version: ${{ matrix.python-version }}
105-
cache: 'pip'
106-
cache-dependency-path: pyproject.toml
85+
86+
- name: Install
87+
run: uv sync --all-extras
10788

10889
- name: Install Python dependencies
10990
run: |
110-
python -m pip install --upgrade pip
111-
pip install git+https://[email protected]/Deltares/xmipy@develop
112-
pip install git+https://[email protected]/MODFLOW-ORG/modflow-devtools@develop
113-
pip install .[test]
91+
uv pip install git+https://[email protected]/Deltares/xmipy@develop
92+
uv pip install git+https://[email protected]/MODFLOW-ORG/modflow-devtools@develop
11493
11594
- name: Install modflow executables
11695
uses: modflowpy/install-modflow-action@v1
@@ -121,7 +100,7 @@ jobs:
121100
- name: Run autotests
122101
working-directory: ./autotest
123102
shell: bash -l {0}
124-
run: pytest -v -n auto -m "not mf6"
103+
run: uv run pytest -v -n auto -m "not mf6"
125104

126105
autotest_preidm_extensions:
127106
name: modflowapi pre-idm extensions autotests
@@ -131,27 +110,27 @@ jobs:
131110
fail-fast: false
132111
matrix:
133112
os: [ ubuntu-latest, macos-13, windows-latest ]
134-
python-version: [ 3.9, "3.10", "3.11", "3.12" ]
113+
python-version: [ "3.10", "3.11", "3.12", "3.13" ]
135114
defaults:
136115
run:
137116
shell: bash
138117
steps:
139118
- name: Checkout repo
140-
uses: actions/checkout@v3
119+
uses: actions/checkout@v4
141120

142-
- name: Setup Python
143-
uses: actions/setup-python@v4
121+
- name: Setup uv
122+
uses: astral-sh/setup-uv@v5
144123
with:
124+
cache-dependency-glob: "**/pyproject.toml"
145125
python-version: ${{ matrix.python-version }}
146-
cache: 'pip'
147-
cache-dependency-path: pyproject.toml
126+
127+
- name: Install
128+
run: uv sync --all-extras
148129

149130
- name: Install Python dependencies
150131
run: |
151-
python -m pip install --upgrade pip
152-
pip install git+https://[email protected]/Deltares/xmipy@develop
153-
pip install git+https://[email protected]/MODFLOW-ORG/modflow-devtools@develop
154-
pip install .[test]
132+
uv pip install git+https://[email protected]/Deltares/xmipy@develop
133+
uv pip install git+https://[email protected]/MODFLOW-ORG/modflow-devtools@develop
155134
156135
- name: Install modflow executables
157136
uses: modflowpy/install-modflow-action@v1
@@ -173,7 +152,7 @@ jobs:
173152
fail-fast: false
174153
matrix:
175154
os: [ ubuntu-latest, macos-latest, windows-latest ]
176-
python-version: [ 3.9, "3.10", "3.11", "3.12" ]
155+
python-version: [ "3.10", "3.11", "3.12", "3.13" ]
177156
defaults:
178157
run:
179158
shell: bash
@@ -187,23 +166,23 @@ jobs:
187166
repository: MODFLOW-ORG/modflow6-examples
188167
path: modflow6-examples
189168

190-
- name: Setup Python
191-
uses: actions/setup-python@v5
169+
- name: Setup uv
170+
uses: astral-sh/setup-uv@v5
192171
with:
172+
cache-dependency-glob: "**/pyproject.toml"
193173
python-version: ${{ matrix.python-version }}
194-
cache: 'pip'
195-
cache-dependency-path: pyproject.toml
174+
175+
- name: Install
176+
run: uv sync --all-extras
196177

197178
- name: Install Python dependencies
198179
run: |
199-
python -m pip install --upgrade pip
200-
pip install git+https://[email protected]/Deltares/xmipy@develop
201-
pip install git+https://[email protected]/MODFLOW-ORG/modflow-devtools@develop
202-
pip install git+https://[email protected]/modflowpy/flopy@develop
203-
pip install .[test]
180+
uv pip install git+https://[email protected]/Deltares/xmipy@develop
181+
uv pip install git+https://[email protected]/MODFLOW-ORG/modflow-devtools@develop
182+
uv pip install git+https://[email protected]/modflowpy/flopy@develop
204183
205184
- name: update flopy for mf6-examples
206-
run: python -m flopy.mf6.utils.generate_classes --ref develop --no-backup
185+
run: uv run python -m flopy.mf6.utils.generate_classes --ref develop --no-backup
207186

208187
- name: Install modflow6 for modflow6-examples
209188
uses: modflowpy/install-modflow-action@v1
@@ -213,7 +192,7 @@ jobs:
213192
- name: Build mf6-examples
214193
working-directory: modflow6-examples/autotest
215194
run: |
216-
pytest -v -n=auto --init test_scripts.py -k "not synthetic-valley"
195+
uv run pytest -v -n=auto --init test_scripts.py -k "not synthetic-valley"
217196
218197
- name: Install modflow6 nightly build
219198
uses: modflowpy/install-modflow-action@v1
@@ -224,4 +203,4 @@ jobs:
224203
- name: Run autotests
225204
working-directory: ./autotest
226205
shell: bash -l {0}
227-
run: pytest -v -n=auto test_mf6_examples.py --mf6-examples-path=../modflow6-examples/examples
206+
run: uv run pytest -v -n=auto test_mf6_examples.py --mf6-examples-path=../modflow6-examples/examples

.github/workflows/release.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
- name: Setup Python
2929
uses: actions/setup-python@v4
3030
with:
31-
python-version: 3.9
31+
python-version: '3.10'
3232
cache: 'pip'
3333
cache-dependency-path: pyproject.toml
3434

@@ -138,7 +138,7 @@ jobs:
138138
- name: Setup Python
139139
uses: actions/setup-python@v4
140140
with:
141-
python-version: 3.9
141+
python-version: '3.10'
142142

143143
- name: Install Python dependencies
144144
run: |
@@ -186,7 +186,7 @@ jobs:
186186
- name: Setup Python
187187
uses: actions/setup-python@v4
188188
with:
189-
python-version: 3.9
189+
python-version: '3.10'
190190

191191
- name: Install Python dependencies
192192
run: |

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ and additional functionality specific to the MODFLOW API. Currently it is a join
3333

3434
## Installation
3535

36-
`modflowapi` requires Python 3.9+, with:
36+
`modflowapi` requires Python 3.10+, with:
3737

3838
```shell
3939
numpy

autotest/conftest.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def get_mf6_examples_path() -> Path:
2424
if not __mf6_examples_path.is_dir():
2525
__mf6_examples_path.mkdir(exist_ok=True)
2626
download_and_unzip(
27-
url="https://github.com/MODFLOW-ORG/modflow6-examples/releases/download/current/modflow6-examples.zip",
27+
url="https://github.com/MODFLOW-ORG/modflow6-examples/releases/download/current/mf6examples.zip",
2828
path=__mf6_examples_path,
2929
verbose=True,
3030
)

pyproject.toml

+7-3
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ classifiers = [
2525
"License :: CC0 1.0 Universal (CC0 1.0) Public Domain Dedication",
2626
"Programming Language :: Python :: 3",
2727
"Programming Language :: Python :: 3 :: Only",
28-
"Programming Language :: Python :: 3.9",
2928
"Programming Language :: Python :: 3.10",
3029
"Programming Language :: Python :: 3.11",
3130
"Programming Language :: Python :: 3.12",
31+
"Programming Language :: Python :: 3.13",
3232
"Topic :: Scientific/Engineering :: Hydrology",
3333
]
34-
requires-python = ">=3.9"
34+
requires-python = ">=3.10"
3535
dependencies = [
3636
"numpy",
3737
"pandas",
@@ -42,7 +42,7 @@ dependencies = [
4242
dev = ["modflowapi[test,lint]"]
4343
test = [
4444
"filelock",
45-
"modflow-devtools",
45+
"modflow-devtools[dfn] @ git+https://github.com/MODFLOW-ORG/modflow-devtools.git",
4646
"pytest!=8.1.0",
4747
"pytest-order",
4848
"pytest-xdist",
@@ -72,6 +72,10 @@ packages = ["modflowapi"]
7272
[tool.hatch.version]
7373
path = "modflowapi/version.py"
7474

75+
[tool.hatch.metadata]
76+
# temporary, until new devtools release
77+
allow-direct-references = true
78+
7579
[tool.ruff]
7680
line-length = 88
7781

0 commit comments

Comments
 (0)