PYTHON-5956 Export UV_PYTHON as a version instead of an interpreter path - #126
Open
blink1073 wants to merge 1 commit into
Open
PYTHON-5956 Export UV_PYTHON as a version instead of an interpreter path#126blink1073 wants to merge 1 commit into
blink1073 wants to merge 1 commit into
Conversation
An absolute interpreter path outranks a virtual environment the job activates later, so `uv pip install` targeted the setup-python interpreter instead of the venv. mongo-python-driver's minimum-dependency job created a venv, activated it, installed into the interpreter behind it, and passed. A version request still overrides pyproject.toml and .python-version, and still beats a later setup-python on PATH, but a matching activated venv now wins. UV_PYTHON_PREFERENCE keeps the promise that uv never downloads an interpreter.
There was a problem hiding this comment.
🔵 Needs a closer look
It changes cross-repository CI behavior via environment-variable semantics in a shared setup action, warranting a final human verification of downstream compatibility.
Pull request overview
Updates the python/setup composite action so uv is configured using a Python version request (instead of an absolute interpreter path), allowing a subsequently activated virtual environment to take precedence while still keeping Python selection pinned to the requested version.
Changes:
- Export
UV_PYTHONas${{ inputs.python-version }}(version request) rather thanactions/setup-python’spython-path(absolute path). - Export
UV_PYTHON_PREFERENCE=only-systemso uv won’t download its own interpreter whensetup-pythonalready provided one. - Update
python/README.mdto document the new behavior and rationale.
File summaries
| File | Description |
|---|---|
| python/setup/action.yml | Switch uv configuration from interpreter path to version request and set UV_PYTHON_PREFERENCE=only-system. |
| python/README.md | Document the updated UV_PYTHON/UV_PYTHON_PREFERENCE behavior and why it avoids venv precedence issues. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
blink1073
marked this pull request as ready for review
September 3, 2026 00:21
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PYTHON-5956
UV_PYTHONheld an absolute interpreter path, which outranks a virtual environment the job activates later. mongo-python-driver's minimum-dependency job created a venv, activated it, and then installed into the setup-python interpreter behind it, passing all the while. Reported by @aclark4life on mongodb/mongo-python-driver#2990.A version request lets a matching activated venv win. It still overrides
pyproject.tomland.python-version, and still beats a secondsetup-pythonthat a later action puts onPATH, which drivers-evergreen-tools does.UV_PYTHON_PREFERENCE=only-systemkeeps uv from downloading an interpreter.Validation
Ran mongo-python-driver's workflow against this branch: 13 of 14 jobs green. The minimum-dependency job now runs pytest from
.venv/bin/python3rather than the tool cache. Every matrix entry still resolves, including3.15to CPython 3.15.0rc2 andpypy-3.11to PyPy 3.11.15.The failure is a CSOT timing test on PyPy, alongside 4763 passing. That job resolved the correct interpreter, so it is independent of this change.