Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Python 3.13, drop 3.10 #110

Merged
merged 14 commits into from
Feb 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-langs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
16 changes: 8 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/psf/black
rev: 24.3.0
rev: 25.1.0
hooks:
- id: black
name: black
Expand All @@ -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:
Expand All @@ -35,22 +35,22 @@ repos:
exclude: ^babelizer/data

- repo: https://github.com/asottile/pyupgrade
rev: v3.15.2
rev: v3.19.1
hooks:
- id: pyupgrade
args: [--py310-plus]
args: [--py311-plus]
exclude: ^babelizer/data

- repo: https://github.com/PyCQA/isort
rev: 5.13.2
rev: 6.0.0
hooks:
- id: isort
files: \.py$
exclude: ^babelizer/data
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
Expand All @@ -76,9 +76,9 @@ repos:
)

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.9.0
rev: v1.15.0
hooks:
- id: mypy
additional_dependencies: [types-all]
additional_dependencies: [types-PyYAML]
files: babelizer/.*\.py$
exclude: ^babelizer/data
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions babelizer/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
9 changes: 2 additions & 7 deletions babelizer/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import io
import pathlib
import sys
import tomllib
import warnings
from collections import defaultdict
from collections.abc import Callable
Expand All @@ -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 (<PY311)
import tomli as tomllib

from babelizer._utils import parse_entry_point
from babelizer._utils import validate_dict_keys
from babelizer.errors import ScanError
Expand Down Expand Up @@ -84,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:
Expand Down
1 change: 1 addition & 0 deletions news/110.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added support for Python 3.13 and dropped support for Python 3.10
8 changes: 2 additions & 6 deletions noxfile.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import os
import pathlib
import shutil
import sys
from itertools import chain

import nox

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)
Expand Down Expand Up @@ -65,10 +64,7 @@ def test_langs(session: nox.session, lang) -> 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)
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "babelizer"
requires-python = ">=3.10"
requires-python = ">=3.11"
description = "Wrap BMI libraries with Python bindings"
keywords = [
"bmi",
Expand All @@ -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 = [
Expand All @@ -39,7 +39,6 @@ dependencies = [
"logoizer@ git+https://github.com/mcflugen/logoizer",
"pyyaml",
"tomli-w",
"tomli; python_version < '3.11'",
]
dynamic = [
"readme",
Expand Down Expand Up @@ -74,6 +73,7 @@ docs = [
"sphinx-inline-tabs",
"sphinx>=4",
"sphinxcontrib.towncrier",
"towncrier<24.7",
]
testing = [
"bmi-tester>=0.5.9",
Expand Down
1 change: 1 addition & 0 deletions requirements-docs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ sphinx-inline-tabs
sphinx-inline-tabs
sphinx>=4
sphinxcontrib.towncrier
towncrier<24.7
7 changes: 1 addition & 6 deletions tests/cli_test.py
Original file line number Diff line number Diff line change
@@ -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 (<PY311)
import tomli as tomllib
import tomllib

from click.testing import CliRunner

Expand Down