Skip to content

Commit 5182e3b

Browse files
authored
Merge pull request #140 from MODFLOW-USGS/v1.4.0
Release 1.4.0
2 parents 2e9adad + d05f607 commit 5182e3b

26 files changed

Lines changed: 283 additions & 268 deletions

.github/workflows/ci.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,16 @@ on:
33
push:
44
paths-ignore:
55
- '**.md'
6+
- '.github/workflows/release.yml'
7+
- '.gitignore'
68
pull_request:
79
branches:
810
- main
911
- develop
1012
paths-ignore:
1113
- '**.md'
14+
- '.github/workflows/release.yml'
15+
- '.gitignore'
1216
jobs:
1317
lint:
1418
name: Lint
@@ -150,8 +154,8 @@ jobs:
150154
151155
- name: Build modflow6 example models
152156
if: steps.cache-examples.outputs.cache-hit != 'true'
153-
working-directory: modflow6-examples/etc
154-
run: python ci_build_files.py
157+
working-directory: modflow6-examples/autotest
158+
run: pytest -v -n auto test_scripts.py --init
155159

156160
- name: Run local tests
157161
working-directory: modflow-devtools/autotest

.github/workflows/release.yml

Lines changed: 1 addition & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ jobs:
115115
body='
116116
# Release '$ver'
117117
118-
The release can be approved by merging this pull request into `main`. This will trigger jobs to publish the release to PyPI and reset `develop` from `main`, incrementing the patch version number.
118+
The release can be approved by merging this pull request into `main`. This will trigger a job to publish the release to PyPI.
119119
120120
## Changelog
121121
@@ -200,68 +200,3 @@ jobs:
200200

201201
- name: Publish to PyPI
202202
uses: pypa/gh-action-pypi-publish@release/v1
203-
204-
reset:
205-
name: Draft reset PR
206-
if: ${{ github.event_name == 'release' }}
207-
runs-on: ubuntu-22.04
208-
permissions:
209-
contents: write
210-
pull-requests: write
211-
steps:
212-
213-
- name: Checkout main branch
214-
uses: actions/checkout@v3
215-
with:
216-
ref: main
217-
218-
- name: Setup Python
219-
uses: actions/setup-python@v4
220-
with:
221-
python-version: 3.8
222-
cache: 'pip'
223-
cache-dependency-path: pyproject.toml
224-
225-
- name: Install Python dependencies
226-
run: |
227-
pip install --upgrade pip
228-
pip install .
229-
pip install ".[lint, test]"
230-
231-
- name: Get release tag
232-
uses: oprypin/find-latest-tag@v1
233-
id: latest_tag
234-
with:
235-
repository: ${{ github.repository }}
236-
releases-only: true
237-
238-
- name: Draft pull request
239-
env:
240-
GITHUB_TOKEN: ${{ github.token }}
241-
run: |
242-
# create reset branch from main
243-
reset_branch="post-release-${{ steps.latest_tag.outputs.tag }}-reset"
244-
git switch -c $reset_branch
245-
246-
# increment minor version
247-
major_version=$(echo "${{ steps.latest_tag.outputs.tag }}" | cut -d. -f1)
248-
minor_version=$(echo "${{ steps.latest_tag.outputs.tag }}" | cut -d. -f2)
249-
version="$major_version.$((minor_version + 1)).0.dev0"
250-
python scripts/update_version.py -v "$version"
251-
python scripts/lint.py
252-
253-
# commit and push reset branch
254-
git config core.sharedRepository true
255-
git config user.name "github-actions[bot]"
256-
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
257-
git add -A
258-
git commit -m "ci(release): update to development version $version"
259-
git push -u origin $reset_branch
260-
261-
# create PR into develop
262-
body='
263-
# Reinitialize for development
264-
265-
Updates the `develop` branch from `main` following a successful release. Increments the patch version number.
266-
'
267-
gh pr create -B "develop" -H "$reset_branch" --title "Reinitialize develop branch" --draft --body "$body"

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,3 +142,5 @@ app
142142
# in case developer installs modflow executables in the project root
143143
bin
144144

145+
**.DS_Store
146+
data_backup

HISTORY.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
### Version 1.4.0
2+
3+
#### New features
4+
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.
9+
10+
#### Bug fixes
11+
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+
14+
#### Refactoring
15+
16+
* [refactor](https://github.com/MODFLOW-USGS/modflow-devtools/commit/9356e067ea813aeeeda2582cf7ec174c11d80159): Remove executables module/class (#136). Committed by wpbonelli on 2024-01-25.
17+
* [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.
18+
119
### Version 1.3.1
220

321
#### Refactoring

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@ Python development tools for MODFLOW 6.
3131

3232
This is a small toolkit for developing MODFLOW 6, FloPy, and related projects. It includes standalone utilities and optional [Pytest](https://github.com/pytest-dev/pytest) extensions.
3333

34-
The former include a very minimal GitHub API client for retrieving release information and downloading assets, a `ZipFile` subclass that [preserves file permissions](https://stackoverflow.com/questions/39296101/python-zipfile-removes-execute-permissions-from-binaries) (workaround for [Python #15795](https://bugs.python.org/issue15795)), and other release/distribution-related tools.
34+
Utilities include:
35+
36+
* a minimal GitHub API client for retrieving release information and downloading assets
37+
* a `ZipFile` subclass that [preserves file permissions](https://stackoverflow.com/questions/39296101/python-zipfile-removes-execute-permissions-from-binaries) (workaround for [Python #15795](https://bugs.python.org/issue15795))
38+
* other release/distribution-related tools
3539

3640
Pytest features include:
3741

autotest/test_executables.py

Lines changed: 0 additions & 28 deletions
This file was deleted.

autotest/test_fixtures.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ def test_keep_session_scoped_tmpdir(tmp_path, arg, request):
186186
]
187187
assert pytest.main(args) == ExitCode.OK
188188
assert Path(
189-
tmp_path / f"{request.session.name}0" / test_keep_fname
189+
tmp_path / f"{request.config.rootpath.name}0" / test_keep_fname
190190
).is_file()
191191

192192

autotest/test_latex.py

Whitespace-only changes.

autotest/test_misc.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import pytest
1010

1111
from modflow_devtools.misc import (
12+
get_env,
1213
get_model_paths,
1314
get_namefile_paths,
1415
get_packages,
@@ -280,3 +281,25 @@ def sleep1dec():
280281
cap = capfd.readouterr()
281282
print(cap.out)
282283
assert re.match(r"sleep1dec took \d+\.\d+ ms", cap.out)
284+
285+
286+
def test_get_env():
287+
assert get_env("NO_VALUE") is None
288+
289+
with set_env(TEST_VALUE=str(True)):
290+
assert get_env("NO_VALUE", True) == True
291+
assert get_env("TEST_VALUE") == True
292+
assert get_env("TEST_VALUE", default=False) == True
293+
assert get_env("TEST_VALUE", default=1) == 1
294+
295+
with set_env(TEST_VALUE=str(1)):
296+
assert get_env("NO_VALUE", 1) == 1
297+
assert get_env("TEST_VALUE") == 1
298+
assert get_env("TEST_VALUE", default=2) == 1
299+
assert get_env("TEST_VALUE", default=2.1) == 2.1
300+
301+
with set_env(TEST_VALUE=str(1.1)):
302+
assert get_env("NO_VALUE", 1.1) == 1.1
303+
assert get_env("TEST_VALUE") == 1.1
304+
assert get_env("TEST_VALUE", default=2.1) == 1.1
305+
assert get_env("TEST_VALUE", default=False) == False

autotest/test_ostags.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1-
from platform import system
1+
from platform import processor, system
22

33
import pytest
44

55
from modflow_devtools.ostags import (
6-
OSTag,
6+
convert_ostag,
77
get_binary_suffixes,
88
get_github_ostag,
99
get_modflow_ostag,
1010
)
1111

1212
_system = system()
13+
_processor = processor()
1314

1415

1516
def test_get_modflow_ostag():
@@ -19,7 +20,7 @@ def test_get_modflow_ostag():
1920
elif _system == "Linux":
2021
assert t == "linux"
2122
elif _system == "Darwin":
22-
assert t == "mac"
23+
assert t == "macarm" if _processor == "arm" else "mac"
2324
else:
2425
pytest.skip(reason="Unsupported platform")
2526

@@ -35,17 +36,17 @@ def test_get_github_ostag():
3536

3637

3738
@pytest.mark.parametrize(
38-
"cvt,tag,exp",
39+
"map,tag,exp",
3940
[
4041
("py2mf", "Windows", "win64"),
4142
("mf2py", "win64", "Windows"),
42-
("py2mf", "Darwin", "mac"),
43+
("py2mf", "Darwin", "macarm" if _processor == "arm" else "mac"),
4344
("mf2py", "mac", "Darwin"),
4445
("py2mf", "Linux", "linux"),
4546
("mf2py", "linux", "Linux"),
4647
("gh2mf", "Windows", "win64"),
4748
("mf2gh", "win64", "Windows"),
48-
("gh2mf", "macOS", "mac"),
49+
("gh2mf", "macOS", "macarm" if _processor == "arm" else "mac"),
4950
("mf2gh", "mac", "macOS"),
5051
("gh2mf", "Linux", "linux"),
5152
("mf2gh", "linux", "Linux"),
@@ -57,8 +58,8 @@ def test_get_github_ostag():
5758
("gh2py", "Linux", "Linux"),
5859
],
5960
)
60-
def test_ostag_convert(cvt, tag, exp):
61-
assert OSTag.convert(tag, cvt) == exp
61+
def test_convert_ostag(map, tag, exp):
62+
assert convert_ostag(tag, map) == exp
6263

6364

6465
def test_get_binary_suffixes():

0 commit comments

Comments
 (0)