From 524f8589a5d3f008ed744eea91c766029d993e97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Hensgen?= <24550538+sebhmg@users.noreply.github.com> Date: Wed, 18 Feb 2026 10:22:10 -0500 Subject: [PATCH 1/3] [GEOPY-2661] remove obsolete mypy plugin for numpy --- pyproject.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index bc7052a..ad0d966 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -176,7 +176,6 @@ show_column_numbers = true check_untyped_defs = true plugins = [ - "numpy.typing.mypy_plugin", "pydantic.mypy" ] From 931ab376d76e3e4d40d8a16359517a4c1f53577e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Hensgen?= <24550538+sebhmg@users.noreply.github.com> Date: Thu, 19 Feb 2026 09:15:30 -0500 Subject: [PATCH 2/3] [GEOPY-2661] address mypy warning in tests --- tests/transformations_test.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/transformations_test.py b/tests/transformations_test.py index 9104da4..19d7a4c 100644 --- a/tests/transformations_test.py +++ b/tests/transformations_test.py @@ -89,9 +89,9 @@ def test_spherical_to_direction_and_dip_upwards(theta, phi, polarity, expected): def test_spherical_values(tmp_path): # pylint: disable=too-many-locals - theta, phi = np.meshgrid(np.arange(0, 360, 10), np.arange(-90, 90, 10)) - theta = theta.flatten() - phi = phi.flatten() + theta_multi, phi_multi = np.meshgrid(np.arange(0, 360, 10), np.arange(-90, 90, 10)) + theta = theta_multi.flatten() + phi = phi_multi.flatten() rad = 100.0 x = rad * np.cos(np.radians(theta)) * np.cos(np.radians(phi)) From e3f42a0b2755454004673acb0a3210006821a353 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Hensgen?= <24550538+sebhmg@users.noreply.github.com> Date: Thu, 19 Feb 2026 09:21:54 -0500 Subject: [PATCH 3/3] [GEOPY-2661] pre-commit auto-update and address warnings --- .pre-commit-config.yaml | 12 ++++++------ geoapps_utils/base.py | 4 ++-- tests/driver_test.py | 2 +- tests/transformations_test.py | 2 +- tests/uijson_run_test.py | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index db97e0c..e9f07fd 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -17,21 +17,21 @@ repos: # - id: poetry-check # args: [--no-plugins] - repo: https://github.com/hadialqattan/pycln - rev: v2.5.0 + rev: v2.6.0 hooks: - id: pycln args: [--config=pyproject.toml] - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.11.4 + rev: v0.15.1 hooks: - - id: ruff + - id: ruff-check args: - --fix - --exit-non-zero-on-fix # - --unsafe-fixes - id: ruff-format - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.15.0 + rev: v1.19.1 hooks: - id: mypy additional_dependencies: [ @@ -71,7 +71,7 @@ repos: exclude: (-lock\.ya?ml|\benvironments/.*\.ya?ml|\.ipynb|^THIRD_PARTY_SOFTWARE\.rst)$ entry: codespell -I .codespellignore - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v5.0.0 + rev: v6.0.0 hooks: - id: trailing-whitespace exclude: \.mdj$ @@ -99,7 +99,7 @@ repos: exclude_types: [jupyter] exclude: ^docs/(.*/)?images/ - repo: https://github.com/rstcheck/rstcheck - rev: v6.2.4 + rev: v6.2.5 hooks: - id: rstcheck exclude: ^THIRD_PARTY_SOFTWARE.rst$ diff --git a/geoapps_utils/base.py b/geoapps_utils/base.py index a74abc4..26515ce 100644 --- a/geoapps_utils/base.py +++ b/geoapps_utils/base.py @@ -43,7 +43,7 @@ class Driver(ABC): :param params: Application parameters. """ - _params_class: type[Options | BaseParams] + _params_class: type[Options] | type[BaseParams] _validations: dict | None = None def __init__(self, params: Options | BaseParams): @@ -56,7 +56,7 @@ def params(self): return self._params @params.setter - def params(self, val: Options): + def params(self, val: Options | BaseParams): if not isinstance(val, self._params_class): raise TypeError( f"Parameters must be of type {self._params_class}.\n" diff --git a/tests/driver_test.py b/tests/driver_test.py index b174ec7..ae19a77 100644 --- a/tests/driver_test.py +++ b/tests/driver_test.py @@ -188,7 +188,7 @@ def test_fetch_driver(tmp_path): # Repeat with missing run_command del dict_params["run_command"] - with pytest.raises(KeyError, match="'run_command' in ui.json must be a string"): + with pytest.raises(KeyError, match=r"'run_command' in ui\.json must be a string"): fetch_driver_class(dict_params) # Repeat with missing driver in module diff --git a/tests/transformations_test.py b/tests/transformations_test.py index 19d7a4c..bcf779c 100644 --- a/tests/transformations_test.py +++ b/tests/transformations_test.py @@ -211,7 +211,7 @@ def test_cartesian_to_polar(): polar[:, 1], np.rad2deg(azm) ) # All other distances positive - with pytest.raises(ValueError, match="Origin must be an iterable of length 3."): + with pytest.raises(ValueError, match=r"Origin must be an iterable of length 3\."): _ = cartesian_to_polar(locations, origin=(5.0, "abc")) # Mean reference locations diff --git a/tests/uijson_run_test.py b/tests/uijson_run_test.py index 00ae0d8..028f23b 100644 --- a/tests/uijson_run_test.py +++ b/tests/uijson_run_test.py @@ -212,7 +212,7 @@ def test_out_group_errors(tmp_path): def test_utils_errors(tmp_path): create_uijson(tmp_path) - with pytest.raises(ValueError, match="Invalid ui.json file"): + with pytest.raises(ValueError, match=r"Invalid ui\.json file"): load_ui_json_as_dict(123) # type: ignore with pytest.raises(FileExistsError, match="File "):