Skip to content

Commit 78eee25

Browse files
authored
Merge pull request #154 from MODFLOW-USGS/v1.5.0
Release 1.5.0
2 parents 5182e3b + 9302fd8 commit 78eee25

33 files changed

Lines changed: 549 additions & 380 deletions

.github/workflows/ci.yml

Lines changed: 31 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,10 @@ jobs:
3030
cache-dependency-path: pyproject.toml
3131

3232
- name: Install Python packages
33-
run: |
34-
pip install .
35-
pip install ".[lint]"
36-
37-
- name: Run isort
38-
run: isort --verbose --check --diff modflow_devtools
39-
40-
- name: Run black
41-
run: black --check --diff modflow_devtools
42-
43-
- name: Run flake8
44-
run: flake8 --count --show-source --exit-zero modflow_devtools
33+
run: pip install ".[lint]"
4534

46-
- name: Run pylint
47-
run: pylint --jobs=0 --errors-only --exit-zero modflow_devtools
35+
- name: Run ruff
36+
run: ruff check .
4837

4938
build:
5039
name: Build
@@ -120,6 +109,11 @@ jobs:
120109

121110
- name: Install executables
122111
uses: modflowpy/install-modflow-action@v1
112+
113+
- name: Install nightly build
114+
uses: modflowpy/install-modflow-action@v1
115+
with:
116+
repo: modflow6-nightly-build
123117

124118
- name: Setup GNU Fortran ${{ env.GCC_V }}
125119
uses: awvwgk/setup-fortran@main
@@ -134,26 +128,29 @@ jobs:
134128

135129
- name: Install Python packages
136130
working-directory: modflow-devtools
137-
run: |
138-
pip install .
139-
pip install ".[test]"
140-
131+
run: pip install ".[test]"
132+
141133
- name: Cache modflow6 examples
134+
if: matrix.python != 3.8
142135
id: cache-examples
143136
uses: actions/cache@v3
144137
with:
145138
path: modflow6-examples/examples
146139
key: modflow6-examples-${{ hashFiles('modflow6-examples/data/**') }}
147140

148141
- name: Install extra Python packages
149-
if: steps.cache-examples.outputs.cache-hit != 'true'
142+
if: matrix.python != 3.8
150143
working-directory: modflow6-examples/etc
151144
run: |
152145
pip install -r requirements.pip.txt
153146
pip install -r requirements.usgs.txt
154147
148+
- name: Update FloPy packages
149+
if: matrix.python != 3.8
150+
run: python -m flopy.mf6.utils.generate_classes --ref develop --no-backup
151+
155152
- name: Build modflow6 example models
156-
if: steps.cache-examples.outputs.cache-hit != 'true'
153+
if: matrix.python != 3.8 && steps.cache-examples.outputs.cache-hit != 'true'
157154
working-directory: modflow6-examples/autotest
158155
run: pytest -v -n auto test_scripts.py --init
159156

@@ -173,4 +170,17 @@ jobs:
173170
env:
174171
REPOS_PATH: ${{ github.workspace }}
175172
GITHUB_TOKEN: ${{ github.token }}
176-
run: pytest -v -n auto --durations 0 test_download.py
173+
run: pytest -v -n auto --durations 0 test_download.py
174+
175+
rtd:
176+
name: Docs
177+
needs: test
178+
runs-on: ubuntu-22.04
179+
if: github.repository_owner == 'MODFLOW-USGS' && github.event_name == 'push'
180+
steps:
181+
- name: Trigger RTD
182+
uses: dfm/rtds-action@v1
183+
with:
184+
webhook_url: ${{ secrets.RTDS_WEBHOOK_URL }}
185+
webhook_token: ${{ secrets.RTDS_WEBHOOK_TOKEN }}
186+
commit_ref: ${{ github.ref }}

.github/workflows/release.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ jobs:
4545
ref="${{ github.ref_name }}"
4646
version="${ref#"v"}"
4747
python scripts/update_version.py -v "$version"
48-
python scripts/lint.py
4948
python -c "import modflow_devtools; print('Version: ', modflow_devtools.__version__)"
5049
echo "version=$version" >> $GITHUB_OUTPUT
5150

HISTORY.md

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,26 @@
1-
### Version 1.4.0
1+
### Version 1.5.0
22

33
#### New features
44

5-
* [feat(Executables)](https://github.com/MODFLOW-USGS/modflow-devtools/commit/3129417dae2de3aece80c8056a2ac50eede56b91): Support collection-style membership test (#131). Committed by wpbonelli on 2023-12-18.
6-
* [feat](https://github.com/MODFLOW-USGS/modflow-devtools/commit/6728859a984a3080f8fd4f1135de36bc17454098): Add latex and plot style utilities (#132). Committed by wpbonelli on 2024-01-09.
7-
* [feat(misc)](https://github.com/MODFLOW-USGS/modflow-devtools/commit/a9b801932866a26a996ed3a45f16048b15246472): Parse literals from environment variables (#135). Committed by wpbonelli on 2024-01-21.
8-
* [feat(ostags)](https://github.com/MODFLOW-USGS/modflow-devtools/commit/0ad10751ea6ce752e59d83e8cd6275906d73fa70): Apple silicon (#139). Committed by wpbonelli on 2024-02-18.
5+
* [feat(markers)](https://github.com/MODFLOW-USGS/modflow-devtools/commit/1f358de2bc721c1000c3d0823b9440776432e3b0): Add no_parallel marker, support differing pkg/module names (#148). Committed by wpbonelli on 2024-04-12.
6+
* [feat(snapshots)](https://github.com/MODFLOW-USGS/modflow-devtools/commit/c9e445dd1544413f3729c7a78c2a77038db80050): Add snapshot fixtures, remove pandas fixture (#151). Committed by wpbonelli on 2024-05-13.
97

10-
#### Bug fixes
8+
#### Refactoring
9+
10+
* [refactor(latex)](https://github.com/MODFLOW-USGS/modflow-devtools/commit/827b5ec63ebe0b9ea833957637d6b60fdc2f3198): Support path-like, add docstrings (#142). Committed by wpbonelli on 2024-02-25.
11+
* [refactor(snapshots)](https://github.com/MODFLOW-USGS/modflow-devtools/commit/d96089e512fbb79408e4fb58c89ee63da60dc727): Move to separate module (#152). Committed by wpbonelli on 2024-05-13.
1112

12-
* [fix](https://github.com/MODFLOW-USGS/modflow-devtools/commit/fd215000c6215b0891e78ee621e40abb2a20b28a): Drop plot styles (already in flopy) (#133). Committed by wpbonelli on 2024-01-09.
13+
### Version 1.4.0
14+
15+
#### New features
16+
17+
* [feat(latex)](https://github.com/MODFLOW-USGS/modflow-devtools/commit/6728859a984a3080f8fd4f1135de36bc17454098): Add latex utilities (#132). Committed by wpbonelli on 2024-01-09.
18+
* [feat(misc)](https://github.com/MODFLOW-USGS/modflow-devtools/commit/a9b801932866a26a996ed3a45f16048b15246472): Parse literals from environment variables (#135). Committed by wpbonelli on 2024-01-21.
19+
* [feat(ostags)](https://github.com/MODFLOW-USGS/modflow-devtools/commit/0ad10751ea6ce752e59d83e8cd6275906d73fa70): add OS tags for Apple silicon (#139). Committed by wpbonelli on 2024-02-18.
1320

1421
#### Refactoring
1522

16-
* [refactor](https://github.com/MODFLOW-USGS/modflow-devtools/commit/9356e067ea813aeeeda2582cf7ec174c11d80159): Remove executables module/class (#136). Committed by wpbonelli on 2024-01-25.
23+
* [refactor](https://github.com/MODFLOW-USGS/modflow-devtools/commit/9356e067ea813aeeeda2582cf7ec174c11d80159): Remove executables module/class (#136). Committed by wpbonelli on 2024-01-25. Should be in a major release per semver, but nothing is using it, so this should be safe.
1724
* [refactor(fixtures)](https://github.com/MODFLOW-USGS/modflow-devtools/commit/613ad010ff6fc782f231b7fa21d1cc660732e7be): Support pytest>=8, drop pytest-cases dependency (#137). Committed by wpbonelli on 2024-01-31.
1825

1926
### Version 1.3.1

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ Python3.8+, dependency-free, but pairs well with `pytest` and select plugins, e.
5656

5757
- [`pytest-dotenv`](https://github.com/quiqua/pytest-dotenv)
5858
- [`pytest-xdist`](https://github.com/pytest-dev/pytest-xdist)
59+
- [`syrupy`](https://github.com/tophat/syrupy)
5960

6061
## Installation
6162

@@ -65,15 +66,15 @@ Python3.8+, dependency-free, but pairs well with `pytest` and select plugins, e.
6566
pip install modflow-devtools
6667
```
6768

68-
Pytest, pytest plugins, and other optional dependencies can be installed with:
69+
Pytest, pytest plugins, and other testing-related dependencies can be installed with:
6970

7071
```shell
7172
pip install "modflow-devtools[test]"
7273
```
7374

7475
To install from source and set up a development environment please see the [developer documentation](DEVELOPER.md).
7576

76-
To import `pytest` fixtures in a project consuming `modflow-devtools`, add the following to a `conftest.py` file:
77+
To import `pytest` fixtures in a project consuming `modflow-devtools`, add the following to a test file or `conftest.py` file:
7778

7879
```python
7980
pytest_plugins = [ "modflow_devtools.fixtures" ]
Binary file not shown.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[1.1 2.2 3.3]
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
1.100000000000000089e+00
2+
2.200000000000000178e+00
3+
3.299999999999999822e+00

autotest/test_build.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@
1616
_system = platform.system()
1717
_exe_ext = ".exe" if _system == "Windows" else ""
1818
_lib_ext = (
19-
".so"
20-
if _system == "Linux"
21-
else (".dylib" if _system == "Darwin" else ".dll")
19+
".so" if _system == "Linux" else (".dylib" if _system == "Darwin" else ".dll")
2220
)
2321

2422

autotest/test_download.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@
2121
@pytest.mark.parametrize("retries", [-1, 0, 1.5])
2222
def test_get_releases_bad_params(per_page, retries):
2323
with pytest.raises(ValueError):
24-
get_releases(
25-
"executables", per_page=per_page, retries=retries, verbose=True
26-
)
24+
get_releases("executables", per_page=per_page, retries=retries, verbose=True)
2725

2826

2927
@flaky
@@ -53,7 +51,8 @@ def test_get_release(repo):
5351
actual_names = [asset["name"] for asset in assets]
5452

5553
if repo == "MODFLOW-USGS/modflow6":
56-
# can remove if modflow6 releases follow asset name conventions followed in executables and nightly build repos
54+
# can remove if modflow6 releases follow asset name
55+
# conventions followed in executables and nightly build repos
5756
assert set([a.rpartition("_")[2] for a in actual_names]) >= set(
5857
[a for a in expected_names if not a.startswith("win")]
5958
)
@@ -109,9 +108,7 @@ def test_download_and_unzip(function_tmpdir, delete_zip):
109108
zip_name = "mf6.3.0_linux.zip"
110109
dir_name = zip_name.replace(".zip", "")
111110
url = f"https://github.com/MODFLOW-USGS/modflow6/releases/download/6.3.0/{zip_name}"
112-
download_and_unzip(
113-
url, function_tmpdir, delete_zip=delete_zip, verbose=True
114-
)
111+
download_and_unzip(url, function_tmpdir, delete_zip=delete_zip, verbose=True)
115112

116113
assert (function_tmpdir / zip_name).is_file() != delete_zip
117114

autotest/test_fixtures.py

Lines changed: 8 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
from _pytest.config import ExitCode
77

88
system = platform.system()
9-
proj_root = Path(__file__).parent.parent.parent.parent
9+
proj_root = Path(__file__).parents[1]
10+
module_path = Path(inspect.getmodulename(__file__))
1011

1112

1213
# test temporary directory fixtures
@@ -39,8 +40,7 @@ def test_function_scoped_tmpdir_slash_in_name(function_tmpdir, name):
3940
replaced1 = name.replace("/", "_").replace("\\", "_").replace(":", "_")
4041
replaced2 = name.replace("/", "_").replace("\\", "__").replace(":", "_")
4142
assert (
42-
f"{inspect.currentframe().f_code.co_name}[{replaced1}]"
43-
in function_tmpdir.stem
43+
f"{inspect.currentframe().f_code.co_name}[{replaced1}]" in function_tmpdir.stem
4444
or f"{inspect.currentframe().f_code.co_name}[{replaced2}]"
4545
in function_tmpdir.stem
4646
)
@@ -64,7 +64,7 @@ def test_class_scoped_tmpdir(self, class_tmpdir):
6464
def test_module_scoped_tmpdir(module_tmpdir):
6565
assert isinstance(module_tmpdir, Path)
6666
assert module_tmpdir.is_dir()
67-
assert Path(inspect.getmodulename(__file__)).stem in module_tmpdir.name
67+
assert module_path.stem in module_tmpdir.name
6868

6969

7070
def test_session_scoped_tmpdir(session_tmpdir):
@@ -144,9 +144,7 @@ def test_keep_class_scoped_tmpdir(tmp_path, arg):
144144
]
145145
assert pytest.main(args) == ExitCode.OK
146146
assert Path(
147-
tmp_path
148-
/ f"{TestKeepClassScopedTmpdirInner.__name__}0"
149-
/ test_keep_fname
147+
tmp_path / f"{TestKeepClassScopedTmpdirInner.__name__}0" / test_keep_fname
150148
).is_file()
151149

152150

@@ -165,9 +163,7 @@ def test_keep_module_scoped_tmpdir(tmp_path, arg):
165163
]
166164
assert pytest.main(args) == ExitCode.OK
167165
this_path = Path(__file__)
168-
keep_path = (
169-
tmp_path / f"{str(this_path.parent.name)}.{str(this_path.stem)}0"
170-
)
166+
keep_path = tmp_path / f"{str(this_path.parent.name)}.{str(this_path.stem)}0"
171167
assert test_keep_fname in [f.name for f in keep_path.glob("*")]
172168

173169

@@ -206,9 +202,7 @@ def test_keep_failed_function_scoped_tmpdir(function_tmpdir, keep):
206202
args += ["--keep-failed", function_tmpdir]
207203
assert pytest.main(args) == ExitCode.TESTS_FAILED
208204

209-
kept_file = Path(
210-
function_tmpdir / f"{inner_fn}0" / test_keep_fname
211-
).is_file()
205+
kept_file = Path(function_tmpdir / f"{inner_fn}0" / test_keep_fname).is_file()
212206
assert kept_file if keep else not kept_file
213207

214208

@@ -276,41 +270,7 @@ def test_large_test_model(large_test_model):
276270
assert large_test_model.name == "mfsim.nam"
277271

278272

279-
# test pandas fixture
280-
281-
test_pandas_fname = "pandas.txt"
282-
283-
284-
@pytest.mark.meta("test_pandas")
285-
def test_pandas_inner(function_tmpdir, use_pandas):
286-
with open(function_tmpdir / test_pandas_fname, "w") as f:
287-
f.write(str(use_pandas))
288-
289-
290-
@pytest.mark.parametrize("pandas", ["yes", "no", "random"])
291-
@pytest.mark.parametrize("arg", ["--pandas", "-P"])
292-
def test_pandas(pandas, arg, function_tmpdir):
293-
inner_fn = test_pandas_inner.__name__
294-
args = [
295-
__file__,
296-
"-v",
297-
"-s",
298-
"-k",
299-
inner_fn,
300-
arg,
301-
pandas,
302-
"--keep",
303-
function_tmpdir,
304-
"-M",
305-
"test_pandas",
306-
]
307-
assert pytest.main(args) == ExitCode.OK
308-
res = open(next(function_tmpdir.rglob(test_pandas_fname))).readlines()[0]
309-
assert res
310-
if pandas == "yes":
311-
assert "True" in res
312-
elif pandas == "no":
313-
assert "False" in res
273+
# test tabular data format fixture
314274

315275

316276
test_tabular_fname = "tabular.txt"

0 commit comments

Comments
 (0)