Skip to content

build: support Python 3.15 - #457

Merged
uniqueg merged 6 commits into
devfrom
build/python-3.15
Oct 24, 2026
Merged

uniqueg merged 6 commits into
devfrom
build/python-3.15

Conversation

@uniqueg

@uniqueg uniqueg commented Oct 24, 2026 •

Copy link
Copy Markdown
Member

Summary

Supports Python 3.15 in FOCA 0.18.0 (issue #448):

  • Package metadata: Programming Language :: Python :: 3.15 classifier; requires-python unchanged (>=3.11). On Python 3.15 only, pydantic needs to be 2.14 or later (marker-split requirement), as older pydantic versions pin pydantic-core versions without cp315 wheels; the 2.7 floor stays for 3.11 to 3.14.
  • CI (checks.yml): 3.15 in the unit tests (MongoDB 7.0, plus MongoDB 8.0 next to 3.13, per "all MongoDB variants"), in the image push, scan and publish (dated tags) jobs. The integration tests are now a matrix over the images of Python 3.13 (default) and 3.15; a new aggregate job keeps the required check name "Integration tests (petstore)", like "Unit tests" and "Scan images" (which cover 3.15 through their needs).
  • Release (release.yml): 3.15 in the push, scan and publish matrices; default: true stays on 3.13, so X.Y.Z and latest stay on Python 3.13 and 3.15 gets X.Y.Z-py3.15 only.
  • Weekly scan (scan.yml): 3.15 added. Until the first release with 3.15 images (0.18.0) is out, the 3.15 job scans nothing and passes with a notice (matrix entry first-release: "0.18.0"; remove it after the release), instead of failing on the missing image.
  • Images: built from python:3.15-slim-trixie with the same Dockerfile (pip 26.2.2 already in the base image; the setuptools/wheel uninstall is a no-op).
  • Lowest dependencies: the test-lowest job runs on Python 3.11 and 3.15 (Sourcery finding), as the pydantic lower bound depends on the Python version.
  • Docs: supported versions (3.11 to 3.15) in the README, Getting started (installation and "Docker", with the default-image policy: newest Python version in its security-fix phase) and the contributing guide; a "Python 3.15" section in the migration notes of 0.18.0; the petstore README now names 3.13 as its default (Sourcery finding). Read the Docs pins 3.13 (the default), unchanged.

Dependencies on Python 3.15

Checked in python:3.15-slim-trixie (Python 3.15.1) with all runtime, dev, docs, lint and release dependencies:

  • All compiled dependencies have cp315 (or abi3/py3) wheels (pydantic-core 2.50, pymongo 4.19, cryptography, mypy, coverage, rpds-py, markupsafe, charset-normalizer, aiohttp, ...), except PyYAML (6.0.3, the latest, has no cp315 wheel): pip builds it from the sdist, falling back to pure Python without libyaml; FOCA uses yaml.safe_load only, so it needs no C extension. Not a blocker.
  • Lowest direct versions with binary wheels only resolve to pydantic 2.14 / pydantic-core 2.50 and pymongo 4.19 (4.18.2 has no cp315 wheel but has a pure-Python fallback, so its bound is unchanged); hence the pydantic marker above.
  • Semgrep (its own venv, lint job on 3.13 only) does not install on 3.15 without a compiler (ruamel.yaml.clib has no cp315 wheel). Not relevant for CI or users.

Verification

  • python:3.15-slim-trixie, MongoDB 7.0: pip install -e .[dev,docs] -r requirements/lint.txt -r requirements/release.txt OK; coverage run -m pytest: 2072 passed (1 failure: test_no_personal_email_addresses, needs git, which the image lacks), coverage 100%; mypy foca: no issues.
  • Same with uv pip install --resolution lowest-direct --only-binary :all: (PyYAML from sdist): 2072 passed; and without --only-binary in python:3.15-trixie (as the new 3.15 test-lowest job does): pydantic 2.14.0, pymongo 4.18.2 (built from source), PyYAML 6.0.1; 2072 passed.
  • docker build -f docker/Dockerfile --build-arg PY_IMAGE=3.15-slim-trixie .: builds; FOCA, PyYAML and pydantic-core import.
  • uv pip compile --resolution lowest-direct: pydantic 2.7.0 on 3.11, 2.14.0 on 3.15.
  • Host (Python 3.13): pre-commit run --all-files passed; mypy no issues; mkdocs build --strict OK.
  • version_ge skip logic of scan.yml checked in a shell (0.17.x skip; 0.18.0, 0.18.1, 1.0.0 scan).
  • Reviews: adversarial and quality reviewers, 2 rounds; findings fixed (comment accuracy, re-wrapping, policy paragraph, pydantic bound and its migration note, requires-python wording).
  • CI: all checks passed (unit tests incl. 3.15 with MongoDB 7.0 and 8.0, integration tests on the 3.13 and 3.15 images, image scans 3.11 to 3.15, lint, docs, charts, CodeQL).

Declined review findings

  • Remove or test the first-release entry in scan.yml: the comment says to remove it once 0.18.0 is released; the skip branch only runs on workflow_dispatch/schedule, checked in a shell instead.
  • Drop or soften the PyYAML sentence in the migration notes: verified (no cp315 wheel for PyYAML 6.0.3; image build passes with yaml.__with_libyaml__ == False).
  • State the default-image policy in one place only: the migration notes link to Getting started; deployment.md ("default 3.13 one") stays correct until the yearly rotation.

Open questions

None.

Closes #448

🤖 Generated with Claude Code

uniqueg and others added 5 commits October 24, 2026 08:36
Add the Python 3.15 classifier and Python 3.15 to the matrices of the
unit tests (MongoDB 7.0 and 8.0), the image build, scan and publish jobs
of checks.yml and release.yml, and the weekly scan of the release
images. The integration tests now run on the images of Python 3.13 (the
default) and 3.15, with the aggregate check "Integration tests
(petstore)" keeping the name of the required check.

The unsuffixed image tags stay on Python 3.13 (default: true), the
newest version in its security-fix phase. The weekly scan skips Python
versions whose first release with images is not out yet (3.15 until
0.18.0), with a notice, instead of failing on the missing image.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
List Python 3.11 to 3.15 as supported in the README, Getting started
and the contributing guide, describe the Python 3.15 images and the
policy for the Python version of the default image in Getting started
("Docker"), and add Python 3.15 to the migration notes of 0.18.0.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Older pydantic versions pin pydantic-core versions without Python 3.15
wheels, which pip would build from source (Rust). The lower bound stays
at 2.7 on Python 3.11 to 3.14.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Give the default-image policy a paragraph of its own in Getting started,
say where the bounds of the supported Python versions are declared,
re-wrap the CI description in the contributing guide, and say which
Python version runs the integration tests in checks.yml.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@uniqueg uniqueg added this to the v0.18.0 milestone Oct 24, 2026
@sourcery-ai

sourcery-ai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Adds end-to-end Python 3.15 support: dependency metadata and documentation are updated, CI validates the new runtime and image, release workflows publish Python-versioned images while retaining Python 3.13 as the default, and weekly scanning safely handles the pre-0.18.0 image gap.

Sequence diagram for Python 3.15 integration testing

sequenceDiagram
    participant CI as GitHub Actions
    participant Build as FOCA image build
    participant Petstore as Petstore integration tests
    CI->>Build: Build 3.13 or 3.15 image
    Build-->>CI: Image available
    CI->>Petstore: Set PETSTORE_PY_IMAGE
    Petstore->>Petstore: Run integration tests
    Petstore-->>CI: Test result
    CI->>CI: integration-passed
Loading

Flow diagram for Python-versioned release tags

flowchart TD
    Release[Release workflow] --> Matrix[Build and publish Python 3.11-3.15 images]
    Matrix --> Default[Python 3.13 marked default]
    Default --> Stable[Unsuffixed X.Y.Z and latest tags]
    Matrix --> Suffixed[Python-versioned tags]
    Suffixed --> Py315[ X.Y.Z-py3.15 tag ]
Loading

File-Level Changes

Change Details Files
Extends package metadata and dependency resolution for Python 3.15, including a version-specific pydantic floor.
  • Adds the Python 3.15 classifier.
  • Keeps the Python requirement at 3.11+ while requiring pydantic 2.14+ only on Python 3.15.
  • Documents the supported interpreter range and the pydantic/PyYAML considerations.
pyproject.toml
README.md
docs/contributing.md
docs/getting-started.md
docs/migration-0.18.md
Expands CI coverage and preserves stable required-check names while testing the new image.
  • Adds Python 3.15 to unit tests, MongoDB 8.0 coverage, image push, scanning, and publishing matrices.
  • Runs petstore integration tests against Python 3.13 and 3.15 images, with an aggregate job retaining the required Integration tests (petstore) check.
  • Keeps test execution on Python 3.13 while varying the container image used by integration tests.
.github/workflows/checks.yml
Publishes and scans Python 3.15 images without changing the default release image.
  • Adds Python 3.15 to release build, scan, and publish matrices.
  • Retains Python 3.13 as the default for unsuffixed and latest tags, publishing Python 3.15 under suffixed tags.
  • Adds a first-release guard so weekly scans pass with a notice before the 0.18.0 Python 3.15 image exists.
.github/workflows/release.yml
.github/workflows/scan.yml

Assessment against linked issues

Issue Objective Addressed Explanation
#448 Add Python 3.15 support to package metadata and dependencies while keeping the minimum Python version unchanged, and verify runtime, test, and development dependencies work on 3.15. ✅
#448 Build and publish Python 3.15 images and extend CI and scheduled scanning to cover them, while keeping unsuffixed/default image tags on Python 3.13. ✅
#448 Update documentation for Python 3.15 support, the 0.18.0 migration, and the default-image version policy. ✅

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@github-advanced-security

Copy link
Copy Markdown

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

@codecov

codecov Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (d8c3159) to head (9ba5659).

Additional details and impacted files
@@            Coverage Diff            @@
##               dev      #457   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           28        28           
  Lines         3266      3266           
=========================================
  Hits          3266      3266           
Flag Coverage Δ
test_unit 100.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@uniqueg
uniqueg marked this pull request as ready for review October 24, 2026 06:49

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 2 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path=".github/workflows/checks.yml" line_range="128" />
<code_context>
       fail-fast: false
       matrix:
-        python-version: ["3.11", "3.12", "3.13", "3.14"]
+        python-version: ["3.11", "3.12", "3.13", "3.14", "3.15"]
         mongodb-version: ["7.0"]
+        # MongoDB 8.0 with the Python version of the default image and the
</code_context>
<issue_to_address>
**Python 3.15 lower bound is not CI-tested**

When the Python 3.15 pydantic lower bound or its compatibility with FOCA regresses, the `test-lowest` job still runs only on Python 3.11, so CI never installs the Python 3.15-specific minimum, pydantic 2.14, and runs the suite against it. A regression in that minimum-version combination can therefore pass CI while breaking users who install FOCA on Python 3.15 with the allowed minimum dependency.

Add a lowest-direct dependency test on Python 3.15, or otherwise exercise the marker-selected minimum in CI.

Also at `pyproject.toml:59`.
</issue_to_address>

### Comment 2
<location path="docs/getting-started.md" line_range="111-115" />
<code_context>
+the `dev` branch are tagged with their date and the Python version (e.g.,
+`20261019-py3.13`).
+
+The default Python version is the newest one in its security-fix phase (cf.
+the [status of Python versions](https://devguide.python.org/versions/));
+newer versions, still in their bugfix phase, get suffixed tags only. The
+default moves on about once a year, after a new Python version is released,
+so pin a suffixed tag to keep the Python version.
+
+Images are signed and come with SBOM and provenance attestations, and CI
</code_context>
<issue_to_address>
**Petstore docs promise wrong default**

When a user follows the Petstore README after Python 3.15 is added as a supported version, users following the Petstore README are told its default uses the latest supported Python, so they expect Python 3.15; `docker-compose.yaml` actually defaults to Python 3.13, and the new policy says newer bugfix-phase versions get suffixed tags only. The setup instructions therefore give users the wrong expectation about the image they build.

Update the Petstore README to say that the default uses Python 3.13, or clarify that users must set `PETSTORE_PY_IMAGE` to select another supported version.
</issue_to_address>

Sourcery assessment

Needs a human reviewer. 1 finding to address first, and if the Python 3.15 dependency constraint or image build is wrong, installs could resolve an incompatible Pydantic version or a broken 3.15 image could be published. The affected installs and image tags can outlive a revert, but the impact is limited to Python 3.15 and can be repaired with corrected constraints or images.

Blocking findings: .github/workflows/checks.yml:128


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread .github/workflows/checks.yml Resolved
Comment thread docs/getting-started.md Resolved
The lower bound of pydantic depends on the Python version (2.14 on
3.15), so run the lowest-direct unit tests on the oldest and the newest
supported Python version. Also correct the default Python version in
the README of the petstore example (3.13, not the newest one).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@uniqueg
uniqueg merged commit 83b9926 into dev Oct 24, 2026
32 checks passed
@uniqueg
uniqueg deleted the build/python-3.15 branch October 24, 2026 07:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

build: support Python 3.15

2 participants