Skip to content

PYTHON-6091 Pin a consistent uv binary version in CI and locally - #3053

Merged
blink1073 merged 29 commits into
mongodb:mainfrom
blink1073:PYTHON-6091
Sep 24, 2026
Merged

blink1073 merged 29 commits into
mongodb:mainfrom
blink1073:PYTHON-6091

Conversation

@blink1073

@blink1073 blink1073 commented Sep 11, 2026 •

Copy link
Copy Markdown
Member

PYTHON-6091

Changes in this PR

Enforces a consistent version of uv in Evergreen CI, GitHub Actions, and local development.

  • Pins the uv binary version using [tool.uv] required-version in pyproject.toml, enforced locally and honored by astral-sh/setup-uv.
  • Bumps the uv version to one that can install Python 3.15 binaries.
  • Bootstrapping uv is now much more robust, using ensure-uv.sh from drivers-tools.

Test Plan

Tested on a spawn host and on a variety of hosts with patch build.

Checklist

Checklist for Author

  • Did you update the changelog (if necessary)? N/A
  • Is there test coverage? Yes
  • Is any followup work tracked in a JIRA ticket? If so, add link(s). PYTHON-6084 builds on this work to clean up Python selection and installation, including pre-release versions that are not yet in the toolchain.

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?

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

Windows self-updates and PATH handling can leave setup failing or the pinned tools unavailable.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Pins one uv version across local development, GitHub Actions, and Evergreen.

Changes:

  • Adds the central uv version pin and documentation.
  • Installs pinned tooling into dedicated binary directories.
  • Updates CI and spawn-host PATH configuration.
File summaries
File Description
pyproject.toml Defines the required uv version.
CONTRIBUTING.md Documents version management and installation.
.evergreen/scripts/setup-system.sh Configures non-CI shell PATH persistence.
.evergreen/scripts/setup-dev-env.sh Reorders dependency and Python setup.
.evergreen/scripts/install-dependencies.sh Discovers and installs pinned tooling.
.evergreen/scripts/configure-env.sh Establishes task-local binary paths.
Review details
  • Files reviewed: 6/6 changed files
  • Comments generated: 3
  • 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/install-dependencies.sh Outdated
Comment thread .evergreen/scripts/setup-dev-env.sh Outdated
Comment thread .evergreen/scripts/setup-system.sh 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

Version enforcement can block bootstrap installation, and the CI fallback directory is shared rather than task-local.

Get a fresh assessment by requesting another Copilot review.

Review details

Suppressed comments (3)

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

.evergreen/scripts/configure-env.sh:26

  • The /tmp/pymongo-bin fallback is host-global, not task-local as documented. Concurrent tasks or later tasks under another user can race on, overwrite, or be unable to update the same executables; use the checkout's existing task-local .local directory instead.

.evergreen/scripts/install-dependencies.sh:84

  • An unpinned uv found on the toolchain or PATH is invoked from the project root here, so the newly added required-version check rejects it before it can install that required version. Bootstrap with project config disabled for this command.
      uv tool install -q --force --from "uv${_uv_pin}" uv

.evergreen/scripts/install-dependencies.sh:102

  • After an external bootstrap uv installs the pinned binary, PATH still resolves uv to that external (potentially mismatched) version. If just is absent, this command therefore fails the project's required-version check; invoke the newly installed pinned binary instead.
    uv tool install rust-just
  • Files reviewed: 6/6 changed files
  • Comments generated: 2
  • Review effort level: Balanced

Comment thread .evergreen/scripts/install-dependencies.sh Outdated
Comment thread .evergreen/scripts/setup-dev-env.sh 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

Shared CI paths and stale spawn-host environment files can cause races or make installed tools unavailable.

Get a fresh assessment by requesting another Copilot review.

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

Comment thread .evergreen/scripts/configure-env.sh Outdated
Comment thread .evergreen/scripts/setup-system.sh 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 revised bootstrap does not provision a pinned uvx executable as intended.

Review details

Suppressed comments (1)

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

.evergreen/scripts/install-dependencies.sh:84

  • The new bootstrap no longer provisions uvx. The pinned PyPI uv package builds only the uv executable, while the removed toolchain bootstrap explicitly linked both uv and uvx; therefore a fresh toolchain-based setup leaves no uvx, and the astral fallback can leave an unpinned uvx beside the pinned uv. This also conflicts with the PR's stated intent to discover/install uv/uvx/just. Please create a platform-appropriate uvx alias/copy from the pinned binary after this install (including when the existing target uv already matches).
  • Files reviewed: 6/7 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

@codecov

codecov Bot commented Sep 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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 review overview

🟡 Changes recommended

The bootstrap currently mishandles local PATH persistence and may expose or execute values from credential-bearing uv environment variables.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 2 High severity · 2 Medium severity

Open (4)

Comment thread .evergreen/scripts/setup-uv.py Outdated
Comment thread .evergreen/scripts/setup-uv.py Outdated
Comment thread .evergreen/scripts/setup-dev-env.sh
Comment thread .evergreen/scripts/setup-dev-env.sh 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.

Copilot review overview

🟡 Changes recommended

The bootstrap loses task-local Python storage configuration and performs costly, side-effecting dependency synchronization as a version check.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 2 Medium severity

Open (2)
Resolved since last review (4)

Comment thread .evergreen/scripts/install-dependencies.sh Outdated
Comment thread .evergreen/scripts/setup-uv.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.

Copilot review overview

🔵 Needs a closer look

The cross-platform bootstrap and persistent environment changes require final human validation across supported Evergreen and local host configurations.

Review effort: Balanced
Findings: None

Resolved since last review (2)

@blink1073
blink1073 marked this pull request as ready for review September 23, 2026 00:09
@blink1073
blink1073 requested a review from a team as a code owner September 23, 2026 00:09
Comment thread .evergreen/scripts/configure-env.sh Outdated
DRIVERS_TOOLS_BINARIES=$(cygpath -m "$DRIVERS_TOOLS_BINARIES")
MONGODB_BINARIES=$(cygpath -m "$MONGODB_BINARIES")
PYMONGO_BIN_DIR=$(cygpath -m "$PYMONGO_BIN_DIR")
PYMONGO_BIN_DIR=$(cygpath -u "$PYMONGO_BIN_DIR")

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.

wait why did this change do -u?

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.

It made a bunch of the other consumers simpler, like comparing paths. But I see your point about being consistent here, so I added PYMONGO_BIN_DIR_POSIX as well. Sound good?

The variable stays in native (Windows) form on cygwin, uniform with the
other paths in configure-env.sh, for consumers like uv; the derived
PYMONGO_BIN_DIR_POSIX is used for bash PATH contexts (PATH_EXT, the
dedupe/prepend steps, and the shell rc writer).
@blink1073
blink1073 merged commit e23bd66 into mongodb:main Sep 24, 2026
105 of 108 checks passed
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