From b57abf95596212a77ea41acbdad58c836b9a023c Mon Sep 17 00:00:00 2001 From: mcflugen Date: Tue, 18 Feb 2025 12:19:45 -0700 Subject: [PATCH 01/14] bump pre-commit hooks to their latest versions --- .pre-commit-config.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 85d775c..e98c08c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/psf/black - rev: 24.3.0 + rev: 25.1.0 hooks: - id: black name: black @@ -25,7 +25,7 @@ repos: exclude: ^babelizer/data - repo: https://github.com/pycqa/flake8 - rev: 7.0.0 + rev: 7.1.2 hooks: - id: flake8 additional_dependencies: @@ -35,14 +35,14 @@ repos: exclude: ^babelizer/data - repo: https://github.com/asottile/pyupgrade - rev: v3.15.2 + rev: v3.19.1 hooks: - id: pyupgrade args: [--py310-plus] exclude: ^babelizer/data - repo: https://github.com/PyCQA/isort - rev: 5.13.2 + rev: 6.0.0 hooks: - id: isort files: \.py$ @@ -50,7 +50,7 @@ repos: args: [--force-single-line-imports] - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v5.0.0 hooks: - id: check-builtin-literals exclude: ^babelizer/data @@ -76,7 +76,7 @@ repos: ) - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.9.0 + rev: v1.15.0 hooks: - id: mypy additional_dependencies: [types-all] From 2d9197526430ccb9ca9d058e7f3069791afee25e Mon Sep 17 00:00:00 2001 From: mcflugen Date: Tue, 18 Feb 2025 12:20:30 -0700 Subject: [PATCH 02/14] set pyugrade for python 3.11+ --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e98c08c..f8423d9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -38,7 +38,7 @@ repos: rev: v3.19.1 hooks: - id: pyupgrade - args: [--py310-plus] + args: [--py311-plus] exclude: ^babelizer/data - repo: https://github.com/PyCQA/isort From e2e34e409fecc9dac9f479133ea5578ec0e068b2 Mon Sep 17 00:00:00 2001 From: mcflugen Date: Tue, 18 Feb 2025 12:21:17 -0700 Subject: [PATCH 03/14] remove types-all dependency for mypy pre-commit hook --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f8423d9..5e9ec2c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -79,6 +79,6 @@ repos: rev: v1.15.0 hooks: - id: mypy - additional_dependencies: [types-all] + additional_dependencies: [types-PyYAML] files: babelizer/.*\.py$ exclude: ^babelizer/data From 82d6e839f9cb7a4dc8f75817a2edd8f86a9e9a2f Mon Sep 17 00:00:00 2001 From: mcflugen Date: Tue, 18 Feb 2025 12:31:38 -0700 Subject: [PATCH 04/14] support python 3.11, 3.12, 3.13 and drop 3.10 from pyproject.toml --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index cf527ac..912a9b2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "babelizer" -requires-python = ">=3.10" +requires-python = ">=3.11" description = "Wrap BMI libraries with Python bindings" keywords = [ "bmi", @@ -26,9 +26,9 @@ classifiers = [ "Operating System :: MacOS :: MacOS X", "Operating System :: POSIX :: Linux", "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", "Topic :: Software Development :: Code Generators", ] dependencies = [ From f3aacfb3bbcdd42ab39d39ab6f49a6d92f50aefd Mon Sep 17 00:00:00 2001 From: mcflugen Date: Tue, 18 Feb 2025 12:32:23 -0700 Subject: [PATCH 05/14] use builtin tomllib instead of requiring tomli --- babelizer/config.py | 7 +------ noxfile.py | 6 +----- pyproject.toml | 1 - tests/cli_test.py | 7 +------ 4 files changed, 3 insertions(+), 18 deletions(-) diff --git a/babelizer/config.py b/babelizer/config.py index 1e466be..d9d7285 100644 --- a/babelizer/config.py +++ b/babelizer/config.py @@ -4,7 +4,7 @@ import io import pathlib -import sys +import tomllib import warnings from collections import defaultdict from collections.abc import Callable @@ -16,11 +16,6 @@ import tomli_w import yaml -if sys.version_info >= (3, 11): # pragma: no cover (PY11+) - import tomllib -else: # pragma: no cover ( None: def _get_package_metadata(datadir): - if sys.version_info >= (3, 11): - import tomllib - else: - import tomli as tomllib + import tomllib with open(datadir / "babel.toml", "rb") as fp: config = tomllib.load(fp) diff --git a/pyproject.toml b/pyproject.toml index 912a9b2..9e7dc37 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,7 +39,6 @@ dependencies = [ "logoizer@ git+https://github.com/mcflugen/logoizer", "pyyaml", "tomli-w", - "tomli; python_version < '3.11'", ] dynamic = [ "readme", diff --git a/tests/cli_test.py b/tests/cli_test.py index 7037397..57613c4 100644 --- a/tests/cli_test.py +++ b/tests/cli_test.py @@ -1,11 +1,6 @@ """Test the babelizer command-line interface""" -import sys - -if sys.version_info >= (3, 11): # pragma: no cover (PY11+) - import tomllib -else: # pragma: no cover ( Date: Tue, 18 Feb 2025 12:35:08 -0700 Subject: [PATCH 06/14] use new Generator annotation for python 3.11+ --- babelizer/_utils.py | 4 ++-- babelizer/config.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/babelizer/_utils.py b/babelizer/_utils.py index 7b18b67..af3d98e 100644 --- a/babelizer/_utils.py +++ b/babelizer/_utils.py @@ -72,7 +72,7 @@ def get_setup_py_version() -> str | None: @contextmanager -def save_files(files: Iterable[str]) -> Generator[dict[str, str], None, None]: +def save_files(files: Iterable[str]) -> Generator[dict[str, str]]: """Generate repository files through a context. Parameters @@ -96,7 +96,7 @@ def save_files(files: Iterable[str]) -> Generator[dict[str, str], None, None]: @contextmanager -def as_cwd(path: str) -> Generator[None, None, None]: +def as_cwd(path: str) -> Generator[None]: """Change directory context. Parameters diff --git a/babelizer/config.py b/babelizer/config.py index d9d7285..1c24072 100644 --- a/babelizer/config.py +++ b/babelizer/config.py @@ -79,7 +79,7 @@ def __init__( def __getitem__(self, key: str) -> dict[str, Any]: return self._meta[key] - def __iter__(self) -> Generator[str, None, None]: + def __iter__(self) -> Generator[str]: yield from self._meta def __len__(self) -> int: From 8fcfdd780140b2e94425471758258b2c4021e642 Mon Sep 17 00:00:00 2001 From: mcflugen Date: Tue, 18 Feb 2025 12:36:34 -0700 Subject: [PATCH 07/14] add python 3.13 to nox tests, drop 3.10 --- noxfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/noxfile.py b/noxfile.py index 18cd426..4492d63 100644 --- a/noxfile.py +++ b/noxfile.py @@ -8,7 +8,7 @@ PROJECT = "babelizer" ROOT = pathlib.Path(__file__).parent ALL_LANGS = {"c", "cxx", "fortran", "python"} -PYTHON_VERSIONS = ["3.10", "3.11", "3.12"] +PYTHON_VERSIONS = ["3.11", "3.12", "3.13"] @nox.session(python=PYTHON_VERSIONS) From 13ac3d8234e6aee56d376643600fa98d710cdb96 Mon Sep 17 00:00:00 2001 From: mcflugen Date: Tue, 18 Feb 2025 12:38:53 -0700 Subject: [PATCH 08/14] bump the gha docs workflow to python 3.13 --- .github/workflows/docs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 565b221..6489643 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -38,7 +38,7 @@ jobs: - uses: conda-incubator/setup-miniconda@v2 with: auto-update-conda: true - python-version: 3.12 + python-version: 3.13 channels: conda-forge channel-priority: true From 7a648a899ad1a7200ceb9364f900d8cba1ca589f Mon Sep 17 00:00:00 2001 From: mcflugen Date: Tue, 18 Feb 2025 12:39:07 -0700 Subject: [PATCH 09/14] bump the gha lint workflow to python 3.13 --- .github/workflows/lint.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 5ac6b4a..b038f4e 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -16,10 +16,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - name: Set up Python 3.12 + - name: Set up Python 3.13 uses: actions/setup-python@v2 with: - python-version: 3.12 + python-version: 3.13 - name: Lint run: | From 1e739452f36f156f2d288072da9a9551af2a577d Mon Sep 17 00:00:00 2001 From: mcflugen Date: Tue, 18 Feb 2025 12:39:37 -0700 Subject: [PATCH 10/14] bump the gha test-cli workflow to python 3.13, drop 3.10 --- .github/workflows/test-cli.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-cli.yml b/.github/workflows/test-cli.yml index cb3a1f7..3237e77 100644 --- a/.github/workflows/test-cli.yml +++ b/.github/workflows/test-cli.yml @@ -21,7 +21,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, macos-latest] - python-version: ["3.10", "3.11", "3.12"] + python-version: ["3.11", "3.12", "3.13"] steps: - uses: actions/checkout@v3 From 8a09f78588f383308eabb4415016f849ae0ad823 Mon Sep 17 00:00:00 2001 From: mcflugen Date: Tue, 18 Feb 2025 12:40:00 -0700 Subject: [PATCH 11/14] bump the gha test-langs workflow to python 3.13, drop 3.10 --- .github/workflows/test-langs.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-langs.yml b/.github/workflows/test-langs.yml index 2acae11..d0fb685 100644 --- a/.github/workflows/test-langs.yml +++ b/.github/workflows/test-langs.yml @@ -21,7 +21,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, macos-latest] - python-version: ["3.10", "3.11", "3.12"] + python-version: ["3.11", "3.12", "3.13"] language: ["c", "cxx", "python", "fortran"] steps: @@ -47,5 +47,5 @@ jobs: run: nox -s "test-langs-${{ matrix.python-version }}(lang='${{ matrix.language }}')" --python ${{ matrix.python-version }} --verbose - name: Coveralls - if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.9' + if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.13' uses: AndreMiras/coveralls-python-action@v20201129 From 0b2a335537dfa2eca40341608fbaec8fc5091765 Mon Sep 17 00:00:00 2001 From: mcflugen Date: Tue, 18 Feb 2025 12:46:42 -0700 Subject: [PATCH 12/14] build on readthedocs with python 3.13 --- .readthedocs.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.readthedocs.yaml b/.readthedocs.yaml index b19971a..ffdb9c3 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -3,7 +3,7 @@ version: 2 build: os: ubuntu-22.04 tools: - python: "3.11" + python: "3.13" jobs: pre_build: - sphinx-apidoc -e -force --no-toc --module-first -o docs/source/api babelizer From 065a045f3fd65b023a2678fcbc0afe88d03f83d6 Mon Sep 17 00:00:00 2001 From: mcflugen Date: Tue, 18 Feb 2025 12:47:00 -0700 Subject: [PATCH 13/14] require towncrier<24.7 for use with sphinxcontrib-towncrier --- pyproject.toml | 1 + requirements-docs.txt | 1 + 2 files changed, 2 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 9e7dc37..5d2c6e1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -73,6 +73,7 @@ docs = [ "sphinx-inline-tabs", "sphinx>=4", "sphinxcontrib.towncrier", + "towncrier<24.7", ] testing = [ "bmi-tester>=0.5.9", diff --git a/requirements-docs.txt b/requirements-docs.txt index ad7389b..2538ad2 100644 --- a/requirements-docs.txt +++ b/requirements-docs.txt @@ -8,3 +8,4 @@ sphinx-inline-tabs sphinx-inline-tabs sphinx>=4 sphinxcontrib.towncrier +towncrier<24.7 From 14d2afd5d1b05c0dba569759deb048d70fa966d7 Mon Sep 17 00:00:00 2001 From: mcflugen Date: Tue, 18 Feb 2025 13:36:47 -0700 Subject: [PATCH 14/14] add news fragment [skip ci] --- news/110.misc | 1 + 1 file changed, 1 insertion(+) create mode 100644 news/110.misc diff --git a/news/110.misc b/news/110.misc new file mode 100644 index 0000000..8f46931 --- /dev/null +++ b/news/110.misc @@ -0,0 +1 @@ +Added support for Python 3.13 and dropped support for Python 3.10