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 0e3edfa..aaf1485 100644 --- a/noxfile.py +++ b/noxfile.py @@ -10,13 +10,14 @@ 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 - "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 @@ -133,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" @@ -240,12 +241,10 @@ def lint_code(session: nox.Session) -> None: "flake8-executable", "flake8-implicit-str-concat", "flake8-logging", - "flake8-pie", "flake8-pyproject", "flake8-pytest-style", "flake8-quotes", "flake8-raise", - "flake8-return", "flake8-sfs", "flake8-simplify", "flake8-tidy-imports", @@ -359,6 +358,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`. @@ -530,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") @@ -549,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. diff --git a/pyproject.toml b/pyproject.toml index 63994f8..48a7273 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" @@ -107,12 +109,10 @@ 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)", "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)", @@ -251,16 +251,12 @@ 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) "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 @@ -302,12 +298,16 @@ 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 # "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 @@ -338,14 +338,8 @@ 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. - "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). @@ -445,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 @@ -534,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 @@ -634,14 +634,10 @@ 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 "Q", - # flake8-return ("R5") => Consistent return statements - "RET", # flake8-raise ("R1") => No parentheses for exceptions without arguments "RSE", # flake8-bandit => Common security issues @@ -679,12 +675,16 @@ 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 "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 a9e4ec7..a018d94 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" @@ -1141,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" @@ -4028,12 +4004,10 @@ 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" }, { name = "flake8-raise" }, - { name = "flake8-return" }, { name = "flake8-sfs" }, { name = "flake8-simplify" }, { name = "flake8-tidy-imports" }, @@ -4114,12 +4088,10 @@ 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" }, { 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" },