Skip to content

Commit

Permalink
Release 1.3.0 (#204)
Browse files Browse the repository at this point in the history
* ci(release): update version to 1.2.11.dev0

* ci: fix schedule for windows (#193)

* fix(requests): update available assets (#194)

Add macarm.zip asset

* chore: reformat Python code with line length = 88 (#198)

Reformat the code with a maximum line length of 88 characters to better represent the code.

See modflowpy/flopy#2362 for a related PR with rational and discussion.

Also change some of Ruff's configuration:

- Remove target-version, since it is automatically evaluated from pyproject.toml
- Remove include so that Ruff will work globally in this repo

* fix: cleanup _get_optlevel verbose param in pymake_base (#199)

Co-authored-by: mjreno <mjreno@IGSAAA071L01144.gs.doi.net>

* refactor: clean-up strings and Path related aspects, add a few Ruff rules (#200)

Refactor a few semi-related aspects:

- Revise strings and whitespace using a few methods with Ruff and manual edits
- Revise a few aspects of pathlib.Path -- these changes are added here to shorten some string formatting, but remain consistent throughout the code base
- Fix one more instance of removed verbose parameter in _get_optlevel(), similar to #199
- Apply Ruff pyupgrade (UP) rules
- Apply Ruff section-underline-matches-section-length (D409) rule
- Apply Ruff-specific rules (RUF)

* build(deps): bump dawidd6/action-download-artifact from 6 to 7 (#201)

* update for mf6.6.0 (#203)

* fix fortran submodule evaluation 
* update sutra and mfusg_gsi versions.
* update pixi version

* ci(release): set version to 1.3.0

---------

Co-authored-by: wpbonelli <wbonelli@ucar.edu>
Co-authored-by: jdhughes-usgs <jdhughes@usgs.gov>
Co-authored-by: Mike Taves <mwtoews@gmail.com>
Co-authored-by: mjreno <renomik@gmail.com>
Co-authored-by: mjreno <mjreno@IGSAAA071L01144.gs.doi.net>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
7 people authored Dec 20, 2024
1 parent 516b61e commit 9e611df
Show file tree
Hide file tree
Showing 38 changed files with 6,653 additions and 6,485 deletions.
41 changes: 20 additions & 21 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,19 @@ jobs:
matrix:
include:
# test latest gcc and python
- {os: ubuntu-latest, FC: gcc, FC_V: 13}
- {os: macos-latest, FC: gcc, FC_V: 13}
- {os: windows-latest, FC: gcc, FC_V: 13}
- {os: ubuntu-latest, FC: gcc, FC_V: 13, shell: bash}
- {os: macos-latest, FC: gcc, FC_V: 13, shell: bash}
- {os: windows-latest, FC: gcc, FC_V: 13, shell: pwsh}
# test latest python and intel-classic
- {os: ubuntu-latest, FC: intel-classic, FC_V: 2021.7}
- {os: macos-13, FC: intel-classic, FC_V: 2021.7}
- {os: windows-2019, FC: intel-classic, FC_V: 2021.7}
- {os: ubuntu-latest, FC: intel-classic, FC_V: 2021.7, shell: bash}
- {os: macos-13, FC: intel-classic, FC_V: 2021.7, shell: bash}
- {os: windows-2019, FC: intel-classic, FC_V: 2021.7, shell: pwsh}
# test latest python and previous gcc
- {os: ubuntu-latest, FC: gcc, FC_V: 12}
- {os: ubuntu-latest, FC: gcc, FC_V: 11}
- {os: ubuntu-latest, FC: gcc, FC_V: 12, shell: bash}
- {os: ubuntu-latest, FC: gcc, FC_V: 11, shell: bash}
defaults:
run:
shell: bash
shell: ${{ matrix.shell }}

steps:
- name: Checkout repo
Expand All @@ -57,7 +57,7 @@ jobs:
- name: Setup pixi
uses: prefix-dev/setup-pixi@v0.8.1
with:
pixi-version: v0.19.1
pixi-version: v0.34.0
manifest-path: "pixi.toml"

- name: pixi post-install
Expand Down Expand Up @@ -91,7 +91,6 @@ jobs:
- name: test on Windows
if: runner.os == 'Windows'
shell: pwsh
run: |
pixi run autotest-base
Expand Down Expand Up @@ -122,16 +121,16 @@ jobs:
matrix:
include:
# test latest gcc and python
- {os: ubuntu-latest, FC: gcc, FC_V: 13}
- {os: macos-latest, FC: gcc, FC_V: 13}
- {os: windows-latest, FC: gcc, FC_V: 13}
- {os: ubuntu-latest, FC: gcc, FC_V: 13, shell: bash}
- {os: macos-latest, FC: gcc, FC_V: 13, shell: bash}
- {os: windows-latest, FC: gcc, FC_V: 13, shell: pwsh}
# test latest python and intel
- {os: ubuntu-latest, FC: intel-classic, FC_V: 2021.7}
- {os: macos-13, FC: intel-classic, FC_V: 2021.7}
- {os: windows-2019, FC: intel-classic, FC_V: 2021.7}
- {os: ubuntu-latest, FC: intel-classic, FC_V: 2021.7, shell: bash}
- {os: macos-13, FC: intel-classic, FC_V: 2021.7, shell: bash}
- {os: windows-2019, FC: intel-classic, FC_V: 2021.7, shell: pwsh}
defaults:
run:
shell: bash
shell: ${{ matrix.shell }}

steps:
- name: Checkout repo
Expand All @@ -149,7 +148,7 @@ jobs:
- name: Setup pixi
uses: prefix-dev/setup-pixi@v0.8.1
with:
pixi-version: v0.19.1
pixi-version: v0.34.0
manifest-path: "pixi.toml"

- name: pixi post-install
Expand All @@ -170,13 +169,13 @@ jobs:
- name: Run scheduled tests
run: |
pixi run autotest-schedule
- name: Upload failed test output
if: failure()
uses: actions/upload-artifact@v4
with:
name: failed-schedule-${{ matrix.os }}-${{ matrix.FC }}-${{ matrix.FC_V }}
path: ./autotest/.failed
path: autotest/.failed

- name: Print coverage report before upload
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pymake-linting-install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Setup pixi
uses: prefix-dev/setup-pixi@v0.8.1
with:
pixi-version: v0.19.1
pixi-version: v0.34.0
manifest-path: "pixi.toml"

- name: Lint
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pymake-requests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: Setup pixi
uses: prefix-dev/setup-pixi@v0.8.1
with:
pixi-version: v0.19.1
pixi-version: v0.34.0
manifest-path: "pixi.toml"

- name: pixi post-install
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ jobs:
pip install ".[test]"
- name: Download artifacts
uses: dawidd6/action-download-artifact@v6
uses: dawidd6/action-download-artifact@v7

- name: Draft release
env:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Python package for building MODFLOW-based programs from source files.

### Version 1.2.10
### Version 1.3.0

[![PyPI Version](https://img.shields.io/pypi/v/mfpymake.png)](https://pypi.python.org/pypi/mfpymake)
[![Anaconda Version](https://anaconda.org/conda-forge/mfpymake/badges/version.svg)](https://anaconda.org/conda-forge/mfpymake)
Expand Down
7 changes: 3 additions & 4 deletions autotest/ci_setup.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import os
import pathlib as pl
import shutil
from pathlib import Path

from modflow_devtools.misc import get_model_paths

import pymake

temp_pth = pl.Path("temp")
if not temp_pth.exists():
temp_pth.mkdir()
temp_pth = Path("temp")
temp_pth.mkdir(exist_ok=True)
mf6_exdir = temp_pth / "mf6examples"
if mf6_exdir.is_dir():
shutil.rmtree(mf6_exdir)
Expand Down
16 changes: 2 additions & 14 deletions autotest/test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,7 @@ def test_build(function_tmpdir, target: str) -> None:
pm.inplace = True
fc = os.environ.get("FC", "gfortran")
assert (
pymake.build_apps(
target,
pm,
verbose=True,
clean=False,
)
== 0
pymake.build_apps(target, pm, verbose=True, clean=False) == 0
), f"could not compile {target}"


Expand All @@ -80,13 +74,7 @@ def test_meson_build(function_tmpdir, target: str) -> None:
pymake.linker_update_environment(cc=cc, fc=fc)
with set_dir(function_tmpdir):
assert (
pymake.build_apps(
target,
verbose=True,
clean=False,
meson=True,
)
== 0
pymake.build_apps(target, verbose=True, clean=False, meson=True) == 0
), f"could not compile {target}"


Expand Down
42 changes: 12 additions & 30 deletions autotest/test_cli_cmds.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import os
import pathlib as pl
import subprocess
from pathlib import Path
from platform import system
from textwrap import dedent

import pytest
from flaky import flaky
Expand Down Expand Up @@ -47,13 +48,7 @@ def run_cli_cmd(cmd: list) -> None:
@pytest.mark.parametrize("target", targets)
def test_make_program(function_tmpdir, target: str) -> None:
with set_dir(function_tmpdir):
cmd = [
"make-program",
target,
"--appdir",
str(function_tmpdir),
"--verbose",
]
cmd = ["make-program", target, "--appdir", ".", "--verbose"]
run_cli_cmd(cmd)


Expand All @@ -62,28 +57,15 @@ def test_make_program(function_tmpdir, target: str) -> None:
@pytest.mark.base
def test_make_program_double(function_tmpdir) -> None:
with set_dir(function_tmpdir):
cmd = [
"make-program",
"mf2005",
"--double",
"--verbose",
"--appdir",
str(function_tmpdir),
]
cmd = ["make-program", "mf2005", "--double", "--verbose", "--appdir", "."]
run_cli_cmd(cmd)


@pytest.mark.dependency(name="make_program_all")
@pytest.mark.schedule
def test_make_program_all(module_tmpdir) -> None:
with set_dir(module_tmpdir):
cmd = [
"make-program",
":",
"--appdir",
str(module_tmpdir / "all"),
"--verbose",
]
cmd = ["make-program", ":", "--appdir", ".", "--verbose"]
run_cli_cmd(cmd)


Expand All @@ -93,13 +75,13 @@ def test_make_program_all(module_tmpdir) -> None:
@pytest.mark.parametrize("meson", meson_parm)
def test_mfpymake(function_tmpdir, meson: bool) -> None:
with set_dir(function_tmpdir):
src = (
"program hello\n"
+ " ! This is a comment line; it is ignored by the compiler\n"
+ " print *, 'Hello, World!'\n"
+ "end program hello\n"
)
src_file = pl.Path("src/hello.f90")
src = dedent("""\
program hello
! This is a comment line; it is ignored by the compiler
print *, 'Hello, World!'
end program hello
""")
src_file = Path("src/hello.f90")
src_file.parent.mkdir(parents=True, exist_ok=True)
with open(src_file, "w") as f:
f.write(src)
Expand Down
12 changes: 4 additions & 8 deletions autotest/test_gridgen.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pathlib as pl
import subprocess
from os import environ
from pathlib import Path
from platform import system

import pytest
Expand All @@ -11,7 +11,7 @@


@pytest.fixture(scope="module")
def target(module_tmpdir) -> pl.Path:
def target(module_tmpdir) -> Path:
name = TARGET_NAME
ext = ".exe" if system() == "Windows" else ""
return module_tmpdir / f"{name}{ext}"
Expand All @@ -23,7 +23,7 @@ def prog_data(target) -> dict:


@pytest.fixture(scope="module")
def workspace(module_tmpdir, prog_data) -> pl.Path:
def workspace(module_tmpdir, prog_data) -> Path:
return module_tmpdir / prog_data.dirname


Expand All @@ -42,11 +42,7 @@ def pm(module_tmpdir, target) -> pymake.Pymake:

def run_command(args, cwd):
p = subprocess.Popen(
args,
shell=False,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
cwd=cwd,
args, shell=False, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, cwd=cwd
)
for line in p.stdout.readlines():
print(line.decode().strip())
Expand Down
4 changes: 1 addition & 3 deletions autotest/test_mf2005.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,5 @@ def test_mf2005(namefile, workspace, target):
if not (example_ws / namefile).is_file():
pytest.skip(f"{namefile} does not exist")

success, _ = flopy.run_model(
target, namefile, model_ws=example_ws, silent=False
)
success, _ = flopy.run_model(target, namefile, model_ws=example_ws, silent=False)
assert success, f"could not run {namefile} with {target}"
14 changes: 4 additions & 10 deletions autotest/test_mf6_existing_meson.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,10 @@ def test_build_with_existing_meson(pm, module_tmpdir, workspace, targets):
linker_update_environment(cc=cc, fc=fc)

# make modflow 6 with existing meson.build file
returncode = pymake.meson_build(
workspace,
fc,
cc,
appdir=pm.appdir,
)
assert returncode == 0, (
"could not build modflow 6 applications "
+ "using existing meson.build file"
)
returncode = pymake.meson_build(workspace, fc, cc, appdir=pm.appdir)
assert (
returncode == 0
), "could not build modflow 6 applications using existing meson.build file"

# check that all of the executables exist
for executable in targets:
Expand Down
20 changes: 4 additions & 16 deletions autotest/test_mp6.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,12 @@ def update_files(fn, workspace):
if rf in fn.lower():
fname1 = workspace / f"{rf}.locations"
fname2 = workspace / f"{rf}_mod.locations"
print(
"copy {} to {}".format(
os.path.basename(fname1), os.path.basename(fname2)
)
)
print(f"copy {os.path.basename(fname1)} to {os.path.basename(fname2)}")
shutil.copy(fname1, fname2)
print(f"deleting {os.path.basename(fname1)}")
os.remove(fname1)
fname1 = workspace / f"{rf.upper()}.locations"
print(
"renmae {} to {}".format(
os.path.basename(fname2), os.path.basename(fname1)
)
)
print(f"renmae {os.path.basename(fname2)} to {os.path.basename(fname1)}")
os.rename(fname2, fname1)


Expand All @@ -79,16 +71,12 @@ def test_compile(pm, target):
@pytest.mark.dependency(name="test", depends=["build"])
@pytest.mark.xdist_group(TARGET_NAME)
@pytest.mark.regression
@pytest.mark.parametrize(
"namefile", [f"EXAMPLE-{n}.mpsim" for n in range(1, 10)]
)
@pytest.mark.parametrize("namefile", [f"EXAMPLE-{n}.mpsim" for n in range(1, 10)])
def test_mp6(namefile, workspace, target):
example_ws = workspace / "example-run"
if not (example_ws / namefile).is_file():
pytest.skip(f"Namefile {namefile} does not exist")

update_files(namefile, example_ws)
success, _ = flopy.run_model(
target, namefile, model_ws=example_ws, silent=False
)
success, _ = flopy.run_model(target, namefile, model_ws=example_ws, silent=False)
assert success, f"could not run {namefile}"
Loading

0 comments on commit 9e611df

Please sign in to comment.