diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d82ff50..d7131d3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -29,7 +29,7 @@ stages: variables: # The image tag cannot read .python-version, so the minor is repeated here; # .python's before_script fails the job if the two disagree. - PYTHON_VERSION: "3.14" + PYTHON_VERSION: "3.15" # Paths black and flake8 check; mypy takes its paths from [tool.mypy]. CODE_PATHS: src tests scripts # Throwaway database for the test job. None of these are secrets. The diff --git a/.python-version b/.python-version index 6324d40..93a848f 100644 --- a/.python-version +++ b/.python-version @@ -1 +1 @@ -3.14 +3.15 diff --git a/CHANGELOG.md b/CHANGELOG.md index c5e16e0..c9458d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -71,6 +71,13 @@ notes (see [docs/releasing.md](docs/releasing.md)). `RequestBodyLimitMiddleware` answers 413 before any route runs (#13). ### Changed +- Python 3.15: `.python-version` says `3.15`, `requires-python` is + `>=3.15,<4.0`, Black targets `py315`, mypy checks against 3.15 and the GitLab + pipeline runs on `python:3.15-slim`. Every dependency ships a 3.15 wheel or is + pure Python; SQLAlchemy 2.0.x installs as pure Python on 3.15 (Known Issues). + uvicorn 0.54.0 and FastAPI 0.143.1 pass the suite on 3.15, although uvicorn's + 3.15 support is merged and unreleased and FastAPI's CI matrix still ends at + 3.14 (#20). - Annotations use the current syntax: `X | None` instead of `Optional[X]`, `SuccessResponse` is a PEP 695 generic (`class SuccessResponse[T]`), and every route dependency is `Annotated`, through the `SessionDep` and diff --git a/docs/known_issues.md b/docs/known_issues.md index c59b3ce..a4b2a35 100644 --- a/docs/known_issues.md +++ b/docs/known_issues.md @@ -252,11 +252,25 @@ healthy service with its database down. ## Dependencies +### SQLAlchemy 2.0 runs without its C extensions on Python 3.15 + +**Where:** `pyproject.toml` (`sqlalchemy (>=2.0.54,<2.1)`). + +SQLAlchemy 2.0.x publishes compiled wheels up to Python 3.14 only, so on 3.15 +pip installs the pure Python wheel and the Cython speedups (row processing, +result collections) are replaced by their Python implementations. Everything +works and the suite passes; result processing is slower than on 3.14 with the +compiled wheel. SQLAlchemy 2.1.x ships Python 3.15 wheels. + +**Fix:** move to SQLAlchemy 2.1 (a new minor with behaviour changes, read its +migration notes first; SQLModel 0.0.48 allows `<2.2`) and drop the `<2.1` +constraint in `pyproject.toml`. + ### slowapi calls an asyncio API removed in Python 3.16 **Where:** `slowapi/extension.py` (version 0.1.10), surfaced by `pytest.ini`. -On Python 3.14 the test run reports `DeprecationWarning: 'asyncio.iscoroutinefunction' +On Python 3.14 and 3.15 the test run reports `DeprecationWarning: 'asyncio.iscoroutinefunction' is deprecated and slated for removal in Python 3.16; use inspect.iscoroutinefunction()`, raised from slowapi when it wraps a rate-limited route. Nothing is wrong today; on Python 3.16 the rate limiter would stop diff --git a/docs/setup.md b/docs/setup.md index 6122b2e..74f61ae 100644 --- a/docs/setup.md +++ b/docs/setup.md @@ -2,7 +2,7 @@ ## Prerequisites -- Python 3.14 (`.python-version` pins the minor for pyenv, uv and CI; the newest patch release is used) +- Python 3.15 (`.python-version` pins the minor for pyenv, uv and CI; the newest patch release is used) - [Poetry](https://python-poetry.org/) 2.x - PostgreSQL (any supported version; CI tests against 17) diff --git a/poetry.lock b/poetry.lock index 02950b1..f851646 100644 --- a/poetry.lock +++ b/poetry.lock @@ -38,7 +38,6 @@ files = [ [package.dependencies] idna = ">=2.8" -typing_extensions = {version = ">=4.16.0", markers = "python_version < \"3.15\""} [package.extras] trio = ["trio (>=0.32.0)"] @@ -1324,10 +1323,7 @@ ast-serialize = ">=0.11.2,<1.0.0" librt = {version = ">=0.16.0", markers = "platform_python_implementation != \"PyPy\""} mypy_extensions = ">=1.0.0" pathspec = ">=1.0.0" -typing_extensions = [ - {version = ">=4.6.0", markers = "python_version < \"3.15\""}, - {version = ">=4.14.0", markers = "python_version >= \"3.15\""}, -] +typing_extensions = {version = ">=4.14.0", markers = "python_version >= \"3.15\""} [package.extras] dmypy = ["psutil (>=4.0)"] @@ -2369,5 +2365,5 @@ dev = ["pytest", "setuptools"] [metadata] lock-version = "2.1" -python-versions = ">=3.14,<4.0" -content-hash = "640d9915a634f0fe76afc74ca508e334802edccab7f3f09858d610e42b307da5" +python-versions = ">=3.15,<4.0" +content-hash = "8ad3f3642c695b4a9f8fe1268bbb9d8af7c05c66aa262a97d2a78ecdf1d61a3e" diff --git a/pyproject.toml b/pyproject.toml index 5024759..74a73ff 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ authors = [ {name = "JsNcAr",email = "jn.arias@uniandes.edu.co"} ] readme = "README.md" -requires-python = ">=3.14,<4.0" +requires-python = ">=3.15,<4.0" # Ranges are open to the next major: poetry.lock is the exact pin, Dependabot # proposes bumps, CI is the check. Update with `poetry update` and the suite. dependencies = [ @@ -54,12 +54,12 @@ dev = [ [tool.black] line-length = 88 # Keep in step with requires-python above. -target-version = ["py314"] +target-version = ["py315"] # `poetry run mypy src`; CI runs it in the lint job. [tool.mypy] # Keep python_version in step with requires-python; files follows the src/ layout. -python_version = "3.14" +python_version = "3.15" files = ["src", "scripts"] plugins = ["pydantic.mypy"] check_untyped_defs = true