Skip to content

PYTHON-6077 Officially support Python 3.15 - #3042

Merged
blink1073 merged 53 commits into
mongodb:mainfrom
blink1073:worktree-PYTHON-6077-officially-support-py315
Sep 18, 2026
Merged

blink1073 merged 53 commits into
mongodb:mainfrom
blink1073:worktree-PYTHON-6077-officially-support-py315

Conversation

@blink1073

@blink1073 blink1073 commented Sep 5, 2026

Copy link
Copy Markdown
Member

PYTHON-6077

Changes in this PR

  • Added Python 3.15 (standard and free-threaded) to the Evergreen test matrix and wheel builds.
  • Fixed enterprise-auth keytab decoding for Python 3.15's stricter base64.
  • Fixed async_socket_sendall for compatibility with Python 3.15. This is the trickiest change.
  • Added the Python 3.15 classifier and changelog entry.
  • Most of the lines of code in the diff are from the regenerated tasks spanning the new python verisons.

Test Plan

  • Ran an Evergreen patch across all the new Python 3.15 builds.
  • Since 3.15 is now the max CPython ( MIN_MAX_PYTHON[-1]), it runs in 80 of the PR tasks.

Checklist

Checklist for Author

  • Did you update the changelog (if necessary)?
  • Is there test coverage? Added Evergreen CI coverage for the new versions.
  • Is any followup work tracked in a JIRA ticket? If so, add link(s). N/A

Checklist for Reviewer

  • Does the title of the PR reference a JIRA Ticket?
  • Do you fully understand the implementation? (Would you be comfortable explaining how this code works to someone else?)
  • Is all relevant documentation (README or docstring) updated?

@codecov

codecov Bot commented Sep 5, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.00000% with 6 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pymongo/network_layer.py 75.00% 6 Missing ⚠️

📢 Thoughts on this report? Let us know!

Comment thread .evergreen/scripts/setup_tests.py Outdated
write_env("KRB5_CONFIG", krb_conf)
LOGGER.info("Writing keytab")
keytab = base64.b64decode(config["KEYTAB_BASE64"])
keytab_b64 = config["KEYTAB_BASE64"]

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This change was needed for Python 3.15 support

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The fallback selects a 64-bit interpreter for Win32 coverage and performs avoidable rate-limited API requests.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds official Python 3.15 and free-threaded 3.15 support across packaging and CI.

Changes:

  • Adds Python 3.15 metadata, changelog, tests, and wheels.
  • Standardizes CI interpreter selection through UV_PYTHON.
  • Adds a python-build-standalone fallback and stricter keytab decoding.
File summaries
File Description
pyproject.toml Adds the Python 3.15 classifier.
doc/changelog.rst Documents Python 3.15 support.
.github/workflows/dist.yml Builds and verifies 3.15 wheels.
.evergreen/scripts/setup-uv-python.sh Resolves toolchain interpreters.
.evergreen/scripts/setup-dev-env.sh Installs or fetches missing interpreters.
.evergreen/scripts/setup_tests.py Corrects keytab Base64 padding.
.evergreen/scripts/generate_config.py Generates UV_PYTHON-based tasks.
.evergreen/scripts/generate_config_utils.py Defines 3.15 versions and helpers.
.evergreen/scripts/fetch-python.sh Fetches standalone Python builds.
.evergreen/generated_configs/variants.yml Adds 3.15 compression variants.
.evergreen/generated_configs/tasks.yml Adds and migrates generated tasks.
.evergreen/generated_configs/functions.yml Propagates UV_PYTHON.
Review details

Suppressed comments (1)

.evergreen/scripts/fetch-python.sh:35

  • This unauthenticated GitHub API request runs before the existing-install check at line 53, so every repeated setup still consumes a request even after the large interpreter has been cached. Python 3.15 tasks source this setup more than once, making shared CI egress susceptible to GitHub's unauthenticated rate limit and causing otherwise cached jobs to fail. Resolve the cache path and return it before querying the release API, or cache the release metadata separately.
release="$(curl -fsSL --retry 3 https://api.github.com/repos/astral-sh/python-build-standalone/releases/latest)"
  • Files reviewed: 11/12 changed files
  • Comments generated: 1
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread .evergreen/scripts/fetch-python.sh Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The new python-build-standalone fallback currently sets UV_PYTHON to a directory (not an interpreter path), which is inconsistent with how UV_PYTHON is handled elsewhere and can break uv run interpreter selection.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Suppressed comments (1)

Previously missed (1) — in code that hasn't changed since the last review.

doc/changelog.rst:4

  • The changelog header uses an invalid date placeholder ("2026/XX/XX"), which can be confusing and may break tooling that expects a real date. Consider using an explicit "Unreleased" marker until the release date is known.
  • Files reviewed: 11/12 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment thread .evergreen/scripts/setup-dev-env.sh Outdated
@blink1073
blink1073 requested a balanced review from Copilot September 17, 2026 20:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Timeout cleanup can race with an active socket worker, and FIPS warning handling can incorrectly report FIPS as disabled.

Get a fresh assessment by requesting another Copilot review.

Review details
  • Files reviewed: 19/19 changed files
  • Comments generated: 2
  • Review effort level: Balanced

Comment thread pymongo/network_layer.py Outdated
Comment thread test/asynchronous/__init__.py Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Worker exceptions can mask cancellation, and the wheel check can pass without a standard CPython 3.15 wheel.

Get a fresh assessment by requesting another Copilot review.

Review details
  • Files reviewed: 19/19 changed files
  • Comments generated: 2
  • Review effort level: Balanced

Comment thread .github/workflows/dist.yml Outdated
Comment thread pymongo/network_layer.py Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Repeated cancellation can still let the socket worker outlive its caller, and the TLS compatibility path lacks direct regression coverage.

Get a fresh assessment by requesting another Copilot review.

Review details

Suppressed comments (1)

Previously missed (1) — in code that hasn't changed since the last review.

pymongo/network_layer.py:84

  • The Python 3.15 compatibility fix itself is not covered: the added tests call the generic helper with len/sleep functions, but none invokes async_socket_sendall with a TLS socket. Please add a regression test that exercises this branch and verifies the peer-reset translation (and ideally timeout translation), so the behavior described by this PR cannot regress while the helper tests still pass.
  • Files reviewed: 19/19 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment thread pymongo/network_layer.py Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

The asynchronous SSL timeout behavior and extensive generated CI matrix warrant final human validation.

Review details
  • Files reviewed: 19/19 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

@blink1073
blink1073 marked this pull request as ready for review September 18, 2026 11:41
@blink1073
blink1073 requested a review from a team as a code owner September 18, 2026 11:41
@codeowners-service-app

Copy link
Copy Markdown

Assigned sleepyStick for team dbx-python because aclark4life is out of office.

@sleepyStick sleepyStick left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

took me a minute to understand what was happening but i think i get it now lol great work!

@blink1073
blink1073 merged commit b566879 into mongodb:main Sep 18, 2026
90 of 94 checks passed
@blink1073
blink1073 deleted the worktree-PYTHON-6077-officially-support-py315 branch September 18, 2026 22:06
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.

3 participants