Skip to content

PYTHON-5956 Export UV_PYTHON as a version instead of an interpreter path - #126

Open
blink1073 wants to merge 1 commit into
mongodb-labs:mainfrom
blink1073:PYTHON-5956-uv-python
Open

PYTHON-5956 Export UV_PYTHON as a version instead of an interpreter path#126
blink1073 wants to merge 1 commit into
mongodb-labs:mainfrom
blink1073:PYTHON-5956-uv-python

Conversation

@blink1073

Copy link
Copy Markdown
Member

PYTHON-5956

UV_PYTHON held 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.toml and .python-version, and still beats a second setup-python that a later action puts on PATH, which drivers-evergreen-tools does. UV_PYTHON_PREFERENCE=only-system keeps 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/python3 rather than the tool cache. Every matrix entry still resolves, including 3.15 to CPython 3.15.0rc2 and pypy-3.11 to 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.

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.

Copilot AI 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.

🔵 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_PYTHON as ${{ inputs.python-version }} (version request) rather than actions/setup-python’s python-path (absolute path).
  • Export UV_PYTHON_PREFERENCE=only-system so uv won’t download its own interpreter when setup-python already provided one.
  • Update python/README.md to 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
blink1073 marked this pull request as ready for review September 3, 2026 00:21
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.

2 participants