From 5609e8ec6e185599ef191f63be324caefc430e77 Mon Sep 17 00:00:00 2001 From: Alexander Hess Date: Wed, 2 Dec 2026 17:42:43 +0100 Subject: [PATCH 1/6] Test with Python 3.14 and 3.15 The new "test-with" session runs the test suite with non-main Python versions; yet, `MAIN_PYTHON` stays at 3.13 --- noxfile.py | 12 ++++++++++++ pyproject.toml | 2 ++ 2 files changed, 14 insertions(+) diff --git a/noxfile.py b/noxfile.py index 0e3edfa..a38a4cc 100644 --- a/noxfile.py +++ b/noxfile.py @@ -10,6 +10,7 @@ By default, `uv run nox` runs the sessions that assure code quality: Further sessions run on demand with `uv run nox -s `: +- "test-with-x.y": Run the test suite with non-main Python versions - "docs": Build the documentation with `sphinx` - "venv": Set up the local develop environment in ".venv" - "deps-audit": Check dependencies for known vulnerabilities @@ -359,6 +360,17 @@ def test_types(session: nox.Session) -> None: session.run("pytest", *(session.posargs or (TESTS_LOCATION,))) +# This is a separate session on purpose +# => The "test" session keeps its name and does not become "test-{MAIN_PYTHON}" +@nox.session( + name="test-with", + python=[py for py in SUPPORTED_PYTHONS if py != MAIN_PYTHON], +) +def test_code_with_non_main_python(session: nox.Session) -> None: + """Run the test suite with non-main Python versions.""" + test_code(session) + + @nox.session(name="docs", python=MAIN_PYTHON) def build_docs(session: nox.Session) -> None: """Build the documentation with `sphinx`. diff --git a/pyproject.toml b/pyproject.toml index 63994f8..9ca5226 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,6 +30,8 @@ classifiers = [ # loaded by `nox`, our task runner, and made available # for testing in isolated environments "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", + "Programming Language :: Python :: 3.15", ] requires-python = ">=3.13,<4.0" From 80d2573f0d23e2cf9649514baf0e633f9bd5b32d Mon Sep 17 00:00:00 2001 From: Alexander Hess Date: Wed, 2 Dec 2026 21:26:01 +0100 Subject: [PATCH 2/6] Remove `flake8-pie` It crashes on Python 3.14 (`ast.Str` is gone) and is unmaintained. `ruff` covers its rules. --- noxfile.py | 1 - pyproject.toml | 11 ++++------- uv.lock | 14 -------------- 3 files changed, 4 insertions(+), 22 deletions(-) diff --git a/noxfile.py b/noxfile.py index a38a4cc..405d27c 100644 --- a/noxfile.py +++ b/noxfile.py @@ -241,7 +241,6 @@ def lint_code(session: nox.Session) -> None: "flake8-executable", "flake8-implicit-str-concat", "flake8-logging", - "flake8-pie", "flake8-pyproject", "flake8-pytest-style", "flake8-quotes", diff --git a/pyproject.toml b/pyproject.toml index 9ca5226..7a690fc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -109,7 +109,6 @@ dev = [ "flake8-executable (>=2.1.3,<3.0.0)", "flake8-implicit-str-concat (>=0.7.0,<0.8.0)", "flake8-logging (>=1.8.0,<2.0.0)", - "flake8-pie (>=0.16.0,<0.17.0)", "flake8-pyproject (>=1.2.4,<2.0.0)", "flake8-pytest-style (>=2.2.0,<3.0.0)", "flake8-quotes (>=3.4.0,<4.0.0)", @@ -253,8 +252,6 @@ select = [ "ISC", # flake8-logging => Correct use of `logging` "LOG", - # flake8-pie => No unnecessary constructs - "PIE", # flake8-pytest-style => Enforce a consistent style with pytest "PT0", # flake8-quotes => Use double quotes everywhere (complying with black) @@ -304,6 +301,8 @@ select = [ # "PERF", # pygrep-hooks => Specific "# noqa" and "# type: ignore" comments # "PGH", + # flake8-pie => No unnecessary constructs + # "PIE", # Pylint => Fewer bugs and simpler code # "PL", # flake8-use-pathlib => `pathlib` instead of `os` functions @@ -340,8 +339,6 @@ extend-ignore = [ "FBT003", # Every `.add()` looks like `pandas` to this rule (`ruff` omits it). "PD005", - # `len()` is needed for `pandas` objects, as their truth value is ambiguous. - "PIE787", # Let's not do `@pytest.mark.no_cover()` instead of `@pytest.mark.no_cover`. "PT023", # `ruff`'s RET504 does this better, as it allows statements in between. @@ -636,8 +633,6 @@ select = [ "N", # pandas-vet => Idiomatic `pandas` "PD", - # flake8-pie => No unnecessary constructs - "PIE", # flake8-pytest-style => Enforce a consistent style with pytest "PT", # flake8-quotes => Use double quotes everywhere @@ -681,6 +676,8 @@ select = [ "PERF", # pygrep-hooks => Specific "# noqa" and "# type: ignore" comments "PGH", + # flake8-pie => No unnecessary constructs + "PIE", # Pylint => Fewer bugs and simpler code "PL", # flake8-use-pathlib => `pathlib` instead of `os` functions diff --git a/uv.lock b/uv.lock index a9e4ec7..26143f1 100644 --- a/uv.lock +++ b/uv.lock @@ -1075,18 +1075,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/7d/a3/0192ec49e7fe062130d545f4f6188142ca448b9b63a2622a4ba8ce7e728d/flake8_logging-1.8.0-py3-none-any.whl", hash = "sha256:bb3fcf0fb2b4f35d7ebb0c1dc02af16db00c7c858c5a018370172e939dd6f225", size = 11114, upload-time = "2025-09-08T23:44:43.32Z" }, ] -[[package]] -name = "flake8-pie" -version = "0.16.0" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "typing-extensions" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/ae/11/cebfe54fda9897188ca40d1cd755d1be13908ceedfea9e500fae162f06a9/flake8-pie-0.16.0.tar.gz", hash = "sha256:b8dcb7b92706fa33d05d92a4b3e49b7a9fd3f0041849166275b646ba50e515ba", size = 28334, upload-time = "2022-08-08T23:51:12.62Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/83/4c/e953c2402b663155525faba5315df8abe6c02ea7f989cbf43327f5088fc3/flake8_pie-0.16.0-py3-none-any.whl", hash = "sha256:24cd7849b0eee22e2328b9e9d2a1dea40013b0a3106864bbadd06a4b05dbb71f", size = 49171, upload-time = "2022-08-08T23:51:14.535Z" }, -] - [[package]] name = "flake8-plugin-utils" version = "1.3.3" @@ -4028,7 +4016,6 @@ dev = [ { name = "flake8-executable" }, { name = "flake8-implicit-str-concat" }, { name = "flake8-logging" }, - { name = "flake8-pie" }, { name = "flake8-pyproject" }, { name = "flake8-pytest-style" }, { name = "flake8-quotes" }, @@ -4114,7 +4101,6 @@ dev = [ { name = "flake8-executable", specifier = ">=2.1.3,<3.0.0" }, { name = "flake8-implicit-str-concat", specifier = ">=0.7.0,<0.8.0" }, { name = "flake8-logging", specifier = ">=1.8.0,<2.0.0" }, - { name = "flake8-pie", specifier = ">=0.16.0,<0.17.0" }, { name = "flake8-pyproject", specifier = ">=1.2.4,<2.0.0" }, { name = "flake8-pytest-style", specifier = ">=2.2.0,<3.0.0" }, { name = "flake8-quotes", specifier = ">=3.4.0,<4.0.0" }, From b947337bd1b1263d53f4cb37aa965f65098b51d5 Mon Sep 17 00:00:00 2001 From: Alexander Hess Date: Wed, 2 Dec 2026 21:39:00 +0100 Subject: [PATCH 3/6] Remove `flake8-return` It crashes on Python 3.14 (`ast.NameConstant` is gone) and is unmaintained. `ruff` covers its rules. --- noxfile.py | 1 - pyproject.toml | 13 ++++--------- uv.lock | 14 -------------- 3 files changed, 4 insertions(+), 24 deletions(-) diff --git a/noxfile.py b/noxfile.py index 405d27c..fcc6f6c 100644 --- a/noxfile.py +++ b/noxfile.py @@ -245,7 +245,6 @@ def lint_code(session: nox.Session) -> None: "flake8-pytest-style", "flake8-quotes", "flake8-raise", - "flake8-return", "flake8-sfs", "flake8-simplify", "flake8-tidy-imports", diff --git a/pyproject.toml b/pyproject.toml index 7a690fc..dc245dd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -113,7 +113,6 @@ dev = [ "flake8-pytest-style (>=2.2.0,<3.0.0)", "flake8-quotes (>=3.4.0,<4.0.0)", "flake8-raise (>=0.0.5,<0.1.0)", - "flake8-return (>=1.2.0,<2.0.0)", "flake8-sfs (>=1.0.1,<2.0.0)", "flake8-simplify (>=0.31.1,<0.32.0)", "flake8-tidy-imports (>=4.12.0,<5.0.0)", @@ -258,8 +257,6 @@ select = [ "Q0", # flake8-raise => No parentheses for exceptions without arguments "R1", - # flake8-return => Consistent return statements - "R5", # flake8-sfs => Use f-strings as the only type of string formatting "SFS", # flake8-simplify => Simpler code @@ -309,6 +306,8 @@ select = [ # "PTH", # flake8-pyi (only two codes) => `t.Self` instead of the class name # "PYI019", "PYI034", + # flake8-return => Consistent return statements + # "RET", # Ruff-specific rules => Fewer bugs and cleaner code # "RUF", # flake8-self => No access to private members from outside @@ -341,10 +340,6 @@ extend-ignore = [ "PD005", # Let's not do `@pytest.mark.no_cover()` instead of `@pytest.mark.no_cover`. "PT023", - # `ruff`'s RET504 does this better, as it allows statements in between. - "R504", - # An `elif` after a `return` keeps a case distinction together. - "R505", # Allow f-strings as the only type of string formatting. "SFS301", # `bool()` around a comparison can be deliberate (`ruff` omits this rule). @@ -637,8 +632,6 @@ select = [ "PT", # flake8-quotes => Use double quotes everywhere "Q", - # flake8-return ("R5") => Consistent return statements - "RET", # flake8-raise ("R1") => No parentheses for exceptions without arguments "RSE", # flake8-bandit => Common security issues @@ -684,6 +677,8 @@ select = [ "PTH", # flake8-pyi (only two codes) => `t.Self` instead of the class name "PYI019", "PYI034", + # flake8-return => Consistent return statements + "RET", # Ruff-specific rules => Fewer bugs and cleaner code "RUF", # flake8-self => No access to private members from outside diff --git a/uv.lock b/uv.lock index 26143f1..a018d94 100644 --- a/uv.lock +++ b/uv.lock @@ -1129,18 +1129,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/da/b7/b8edb1ae5c517b8d3cd693129daab16282c5a4b4fc6ad4522cedc29eba61/flake8_raise-0.0.5-py3-none-any.whl", hash = "sha256:df26e5c542a58c8f8786d978e18ad7e54126a0ef5c6241c35dafaca7e2bbb808", size = 3694, upload-time = "2020-01-26T13:53:13.431Z" }, ] -[[package]] -name = "flake8-return" -version = "1.2.0" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "flake8-plugin-utils" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/83/49/43ee60c21b61fbec8e86858b2dac7d11a9bdd9958fd7f59077387b6a7197/flake8-return-1.2.0.tar.gz", hash = "sha256:68dfa56582cd704febd02ad86dcf5df67e38e0836d62f1ceae7930d76d3dd955", size = 10033, upload-time = "2022-10-28T09:37:12.507Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/f0/8c/6aece77ad2d0d68d8f6e8d5471fd06638de11df656db7d76de810815c437/flake8_return-1.2.0-py3-none-any.whl", hash = "sha256:1f07af12954ed03ebe2c2aac2418f78b55374e9929d4956109664588f31582a1", size = 10121, upload-time = "2022-10-28T09:37:14.468Z" }, -] - [[package]] name = "flake8-sfs" version = "1.0.1" @@ -4020,7 +4008,6 @@ dev = [ { name = "flake8-pytest-style" }, { name = "flake8-quotes" }, { name = "flake8-raise" }, - { name = "flake8-return" }, { name = "flake8-sfs" }, { name = "flake8-simplify" }, { name = "flake8-tidy-imports" }, @@ -4105,7 +4092,6 @@ dev = [ { name = "flake8-pytest-style", specifier = ">=2.2.0,<3.0.0" }, { name = "flake8-quotes", specifier = ">=3.4.0,<4.0.0" }, { name = "flake8-raise", specifier = ">=0.0.5,<0.1.0" }, - { name = "flake8-return", specifier = ">=1.2.0,<2.0.0" }, { name = "flake8-sfs", specifier = ">=1.0.1,<2.0.0" }, { name = "flake8-simplify", specifier = ">=0.31.1,<0.32.0" }, { name = "flake8-tidy-imports", specifier = ">=4.12.0,<5.0.0" }, From 67917ae3f61acb3d2ba3c5e46ba78022155f690d Mon Sep 17 00:00:00 2001 From: Alexander Hess Date: Wed, 2 Dec 2026 21:41:00 +0100 Subject: [PATCH 4/6] Type check against the oldest Python version Without a configured version, `mypy` and `pyright` check against the Python that runs them. With `MAIN_PYTHON` at 3.14, they would accept `stdlib` APIs and `typing` features new in 3.14. Yet, `requires-python` promises 3.13; so, the type checkers must flag such code. `black` and `ruff` already target 3.13 for the same reason. --- pyproject.toml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index dc245dd..48a7273 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -439,6 +439,9 @@ force_single_line = true cache_dir = ".cache/mypy" +# Check against the oldest supported Python version, not the one running `mypy` +python_version = "3.13" + # Check the interior of functions without type annotations check_untyped_defs = true @@ -528,6 +531,9 @@ ignore_missing_imports = true [tool.pyright] # Source: https://microsoft.github.io/pyright/#/configuration +# Check against the oldest supported Python version, not the one running `pyright` +pythonVersion = "3.13" + # Treat libraries without type annotations as `Any`, like `mypy` does useLibraryCodeForTypes = false From df53ce7bc4107557666df11dab72992ff3131c7d Mon Sep 17 00:00:00 2001 From: Alexander Hess Date: Wed, 2 Dec 2026 21:43:23 +0100 Subject: [PATCH 5/6] Pin `MAIN_PYTHON` in the "init-project" session Otherwise, `uv` creates ".venv" with the newest installed Python. --- noxfile.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/noxfile.py b/noxfile.py index fcc6f6c..eae5e76 100644 --- a/noxfile.py +++ b/noxfile.py @@ -17,7 +17,7 @@ Further sessions run on demand with `uv run nox -s `: - "deps-lock": Lock dependencies after manual changes in pyproject.toml - "deps-upgrade": Upgrade dependencies within their allowed ranges - "deps-upgrade-check": Show newer versions and the age of all pinned releases -- "init-project": Install the `pre-commit` hooks and configure `git blame` +- "init-project": Set up a freshly cloned project - "clean-cwd": Run approx. `git clean -X` with minor exceptions - "verify-db-objects": Compare a live database with the ORM models @@ -540,7 +540,16 @@ def check_dependency_upgrades(session: nox.Session) -> None: @nox.session(name="init-project", python=MAIN_PYTHON, venv_backend="none") def initialize_project(session: nox.Session) -> None: - """Install the `pre-commit` hooks and configure `git blame`.""" + """Set up a freshly cloned project. + + This does the following: + - Pin the `MAIN_PYTHON` for `uv` + - Install the `pre-commit` hooks + - Configure `git blame` + """ + # Without a ".python-version" file, `uv` picks the newest installed Python + session.run("uv", "python", "pin", MAIN_PYTHON) + # .pre-commit-config.yaml sets the hook types via "default_install_hook_types" session.run("uv", "run", "pre-commit", "install") @@ -559,7 +568,7 @@ def clean_cwd(session: nox.Session) -> None: """Remove (almost) all glob patterns listed in git's ignore file. Compared to `git clean -X`, never remove local environment variables - in the ".env" and ".envrc" files, pyenv's ".python-version" file, + in the ".env" and ".envrc" files, the ".python-version" file, and the local develop environment in ".venv". An existing ".cache/" folder is always deleted first. From 2a64958a939e360e0a8444df41aa71991a537150 Mon Sep 17 00:00:00 2001 From: Alexander Hess Date: Wed, 2 Dec 2026 21:54:00 +0100 Subject: [PATCH 6/6] Make Python 3.14 the `MAIN_VERSION` `requires-python` stays at ">=3.13"; so, `uv.lock` is unchanged and 3.13 is tested with the "test-with" session. --- .forgejo/workflows/ci.yaml | 6 +++--- noxfile.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.forgejo/workflows/ci.yaml b/.forgejo/workflows/ci.yaml index 3393ed8..4a9cb6e 100644 --- a/.forgejo/workflows/ci.yaml +++ b/.forgejo/workflows/ci.yaml @@ -14,7 +14,7 @@ defaults: jobs: checks: - name: Checks (Python 3.13) + name: Checks (Python 3.14) runs-on: debian-13 # Throwaway database, reachable from the job as host `postgres` @@ -60,11 +60,11 @@ jobs: -y # Same `uv` version as pinned in pyproject.toml - - name: Install `uv` and `python3.13` + - name: Install `uv` and `python3.14` run: | curl -LsSf https://astral.sh/uv/0.13.10/install.sh | sh echo "$HOME/.local/bin" >> "$FORGEJO_PATH" - "$HOME/.local/bin/uv" python install 3.13 + "$HOME/.local/bin/uv" python install 3.14 - name: Install `velofy` and its dependencies run: uv sync --locked diff --git a/noxfile.py b/noxfile.py index eae5e76..aaf1485 100644 --- a/noxfile.py +++ b/noxfile.py @@ -134,7 +134,7 @@ SUPPORTED_PYTHONS = load_supported_python_versions() # Must be listed in the "classifiers", which is checked at the bottom # of this file, and satisfy "requires-python" in pyproject.toml -MAIN_PYTHON = "3.13" +MAIN_PYTHON = "3.14" nox.options.default_venv_backend = "uv"