From 7cee0cfce9b4e9e0ba5e236da8d9867868764908 Mon Sep 17 00:00:00 2001 From: Benjamin Thomas Schwertfeger Date: Mon, 2 Nov 2026 07:04:05 +0100 Subject: [PATCH 1/3] Test against Python 3.11-3.15 --- .github/workflows/_build.yaml | 2 +- .github/workflows/cicd.yaml | 6 +++--- .pre-commit-config.yaml | 10 +++++----- README.md | 2 +- doc/links.rst | 2 +- pyproject.toml | 3 +-- 6 files changed, 12 insertions(+), 13 deletions(-) diff --git a/.github/workflows/_build.yaml b/.github/workflows/_build.yaml index 0ba2dd3..be31ab8 100644 --- a/.github/workflows/_build.yaml +++ b/.github/workflows/_build.yaml @@ -87,7 +87,7 @@ jobs: - name: Store the distribution packages uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 # upload artifacts with the oldest supported version - if: runner.os == 'linux' && inputs.python-version == '3.9' + if: runner.os == 'linux' && inputs.python-version == '3.11' with: name: python-package-distributions path: dist/ diff --git a/.github/workflows/cicd.yaml b/.github/workflows/cicd.yaml index 462ef2c..b497188 100644 --- a/.github/workflows/cicd.yaml +++ b/.github/workflows/cicd.yaml @@ -43,7 +43,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest] - python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"] + python-version: ["3.11", "3.12", "3.13", "3.14", "3.15"] with: os: ${{ matrix.os }} python-version: ${{ matrix.python-version }} @@ -57,7 +57,7 @@ jobs: os: ubuntu-latest python-version: "3.11" - ## Run the unit tests for Python 3.9 until 3.14 and upload the + ## Run the unit tests for Python 3.11 until 3.15 and upload the ## coverage statistics to codecov ## Test: @@ -68,7 +68,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, windows-latest] - python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"] + python-version: ["3.11", "3.12", "3.13", "3.14", "3.15"] with: os: ${{ matrix.os }} python-version: ${{ matrix.python-version }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2930a68..61df20d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -7,7 +7,7 @@ repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.14.4 + rev: v0.17.3 hooks: - id: ruff args: @@ -25,12 +25,12 @@ repos: # - --install-types # - --non-interactive - repo: https://github.com/codespell-project/codespell - rev: v2.4.1 + rev: v2.4.3 hooks: - id: codespell additional_dependencies: [tomli] - repo: https://github.com/gitleaks/gitleaks - rev: v8.29.0 + rev: v8.30.1 hooks: - id: gitleaks - repo: https://github.com/pre-commit/pre-commit-hooks @@ -77,7 +77,7 @@ repos: - id: isort args: [--profile=black] - repo: https://github.com/PyCQA/bandit - rev: 1.8.6 + rev: 1.9.4 hooks: - id: bandit exclude: "^tests/.*|examples/.*" @@ -90,7 +90,7 @@ repos: - --max-modules=B - --max-absolute=C - repo: https://github.com/rbubley/mirrors-prettier - rev: v3.6.2 + rev: v3.9.10 hooks: - id: prettier exclude: '\.nc$|^tests/fixture/|\.ipynb$' diff --git a/README.md b/README.md index 69cf72f..21723c6 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@
[![GitHub](https://badgen.net/badge/icon/github?icon=github&label)](https://github.com/btschwertfeger/python-cmethods) -[![Generic badge](https://img.shields.io/badge/python-3.9_|_3.10_|_3.11|_3.12|_3.13-blue.svg)](https://shields.io/) +[![Generic badge](https://img.shields.io/badge/python-3.11_|_3.12_|_3.13_|_3.14_|_3.15-blue.svg)](https://shields.io/) [![License: GPL v3](https://img.shields.io/badge/License-GPLv3-orange.svg)](https://www.gnu.org/licenses/gpl-3.0) [![PyPI Downloads](https://pepy.tech/badge/python-cmethods)](https://pepy.tech/project/python-cmethods) diff --git a/doc/links.rst b/doc/links.rst index 520b64b..ffe3720 100644 --- a/doc/links.rst +++ b/doc/links.rst @@ -36,7 +36,7 @@ :target: https://github.com/btschwertfeger/python-cmethods .. |License badge| image:: https://img.shields.io/badge/License-GPLv3-orange.svg :target: https://www.gnu.org/licenses/gpl-3.0 -.. |PyVersions badge| image:: https://img.shields.io/badge/python-3.9_|_3.10_|_3.11|_3.12|_3.13-blue.svg +.. |PyVersions badge| image:: https://img.shields.io/badge/python-3.11_|_3.12_|_3.13_|_3.14_|_3.15-blue.svg :target: https://github.com/btschwertfeger/python-cmethods .. |Downloads badge| image:: https://static.pepy.tech/personalized-badge/python-cmethods?period=total&units=abbreviation&left_color=grey&right_color=orange&left_text=downloads :target: https://pepy.tech/project/python-cmethods diff --git a/pyproject.toml b/pyproject.toml index ce9ae49..4fb0292 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,12 +46,11 @@ keywords = [ ] classifiers = [ "Programming Language :: Python", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Programming Language :: Python :: 3.14", + "Programming Language :: Python :: 3.15", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Utilities", "Topic :: Scientific/Engineering", From 357fe89046c40e81372e3e2874e864d554856f60 Mon Sep 17 00:00:00 2001 From: Benjamin Thomas Schwertfeger Date: Mon, 2 Nov 2026 07:33:46 +0100 Subject: [PATCH 2/3] chore: suppress new ruff rules in cli module --- cmethods/__init__.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cmethods/__init__.py b/cmethods/__init__.py index 2778b2e..1c20d74 100644 --- a/cmethods/__init__.py +++ b/cmethods/__init__.py @@ -59,21 +59,21 @@ __all__ = ["adjust"] -def print_version( +def print_version( # ruff: ignore[non-empty-init-module] ctx: Context, - param: Any, # noqa: ARG001 + param: Any, # ruff: ignore[unused-function-argument] value: Any, ) -> None: """Prints the version of the package""" if not value or ctx.resilient_parsing: return - from importlib.metadata import version # noqa: PLC0415 + from importlib.metadata import version # ruff: ignore[import-outside-top-level] echo(version("python-cmethods")) ctx.exit() -@command( +@command( # ruff: ignore[non-empty-init-module] context_settings={ "auto_envvar_prefix": "CMETHODS", "help_option_names": ["-h", "--help"], @@ -147,7 +147,7 @@ def print_version( "--output", required=True, type=str, - callback=lambda _, __, value: (value if value.endswith(".nc") else f"{value}.nc"), + callback=lambda _, __, value: value if value.endswith(".nc") else f"{value}.nc", help="Output file name", ) @option_group( @@ -189,7 +189,7 @@ def cli(**kwargs) -> None: ) log = logging.getLogger(__name__) log.info("Loading data sets ...") - try: + try: # ruff: ignore[too-many-statements-in-try-clause] for key, message in zip( ("obs", "simh", "simp"), ( From 87a9b0e32cd1e8c4f4ab677a0aece41a8dba9f2b Mon Sep 17 00:00:00 2001 From: Benjamin Thomas Schwertfeger Date: Mon, 2 Nov 2026 07:50:33 +0100 Subject: [PATCH 3/3] make prek happy --- cmethods/core.py | 6 +++--- cmethods/utils.py | 2 +- doc/conf.py | 2 +- tests/test_zarr_dask_compatibility.py | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cmethods/core.py b/cmethods/core.py index bbb25b1..e76f5ea 100644 --- a/cmethods/core.py +++ b/cmethods/core.py @@ -64,10 +64,10 @@ def _add_cmethods_metadata( :return: Result with added metadata """ try: - from importlib.metadata import version # noqa: PLC0415 + from importlib.metadata import version # ruff: ignore[import-outside-top-level] pkg_version = version("python-cmethods") - except Exception: # noqa: BLE001 + except Exception: # ruff: ignore[blind-except] pkg_version = "unknown" attrs_to_add = { @@ -190,7 +190,7 @@ def adjust( kwargs["adjust_called"] = True ensure_xr_dataarray(obs=obs, simh=simh, simp=simp) - if method == "detrended_quantile_mapping": # noqa: PLR2004 + if method == "detrended_quantile_mapping": # ruff: ignore[magic-value-comparison] raise ValueError( "This function is not available for detrended quantile mapping." " Please use cmethods.CMethods.detrended_quantile_mapping", diff --git a/cmethods/utils.py b/cmethods/utils.py index f675d92..0f4d5d0 100644 --- a/cmethods/utils.py +++ b/cmethods/utils.py @@ -46,7 +46,7 @@ def __init__(self: UnknownMethodError, method: str, available_methods: list): def check_adjust_called( function_name: str, - adjust_called: Optional[bool] = None, # noqa: FBT001 + adjust_called: Optional[bool] = None, # ruff: ignore[boolean-type-hint-positional-argument] ) -> None: """ Displays a user warning in case a correction function was not called via diff --git a/doc/conf.py b/doc/conf.py index f2650f8..6d16b01 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -48,7 +48,7 @@ rst_epilog += f.read() -def setup(app) -> None: # noqa: ARG001 +def setup(app) -> None: # ruff: ignore[unused-function-argument] copyfile(join("..", "examples", "examples.ipynb"), "examples.ipynb") diff --git a/tests/test_zarr_dask_compatibility.py b/tests/test_zarr_dask_compatibility.py index d6e827c..8b0ac8e 100644 --- a/tests/test_zarr_dask_compatibility.py +++ b/tests/test_zarr_dask_compatibility.py @@ -35,7 +35,7 @@ def test_3d_scaling_zarr( datasets_from_zarr: xr.Dataset, method: str, kind: str, - dask_cluster: Any, # noqa: ARG001 + dask_cluster: Any, # ruff: ignore[unused-function-argument] ) -> None: variable: str = "tas" if kind == "+" else "pr" obsh: xr.DataArray = datasets_from_zarr[kind]["obsh"][variable] @@ -79,7 +79,7 @@ def test_3d_distribution_zarr( datasets_from_zarr: dict, method: str, kind: str, - dask_cluster: Any, # noqa: ARG001 + dask_cluster: Any, # ruff: ignore[unused-function-argument] ) -> None: variable: str = "tas" if kind == "+" else "pr" obsh: XRData_t = datasets_from_zarr[kind]["obsh"][variable]