PYTHON-5956 Use shared python/setup action for CI setup - #2990
PYTHON-5956 Use shared python/setup action for CI setup#2990blink1073 wants to merge 10 commits into
Conversation
Replaces the uv, just, and dependency-install steps that eight jobs each carried with the shared drivers-github-tools action. TESTING ONLY: pinned to a fork SHA of the action so this can run before the action lands upstream. Repoint at mongodb-labs/...@V3 before merging. The static job still installs separately, because its lock check has to run before the install. Jobs that never use just, or that let a just recipe handle their own dependencies, pass run-install: false. The build job allows prereleases, which its beta Python needs now that Python comes from setup-python rather than uv.
allow-prereleases now defaults to true in the action, so the build job no longer passes it. Repoints at the action commit that drops exclude-newer, so this run exercises the version being merged.
run-install is off by default now, so the four jobs that need project dependencies ask for them and the four that do not say nothing. Repoints at the action commit that made the switch.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
The setup action no longer runs recipes, so each job that needs project dependencies installs them itself.
Conflict in test-python.yml: main bumped setup-uv to v10.0.1 on the eight `Install uv` steps this branch replaced with the python/setup action. Kept the replacement, which pins the same version inside the action.
drivers-github-tools#117 merged and the v3 tag now carries python/setup, so the eight references point at the released action instead of a fork commit.
There was a problem hiding this comment.
🟡 Changes recommended
The newly introduced third-party GitHub Action references are not pinned to an immutable commit SHA, which is a supply-chain security risk in CI.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR updates the CI workflow to use the shared mongodb-labs/drivers-github-tools/python/setup composite action to install Python, uv, and just across multiple jobs, reducing duplicated setup steps in test-python.yml.
Changes:
- Replaced per-job
setup-uv+uv tool install rust-juststeps with a single shared “Install Python tooling” action step. - Standardized Python/uv/just provisioning across the
static,build,coverage,doctest,docs,typing,integration_tests, andtest_minimumjobs. - Kept
just installonly in jobs that need project dependencies installed.
File summaries
| File | Description |
|---|---|
| .github/workflows/test-python.yml | Consolidates Python tooling setup in CI by switching to the shared python/setup composite action across multiple jobs. |
Review details
Suppressed comments (7)
.github/workflows/test-python.yml:83
- For supply-chain safety, pin this third-party composite action to a full commit SHA (and apply the same pin to the other occurrences in this workflow) instead of using the mutable
@v3tag.
uses: mongodb-labs/drivers-github-tools/python/setup@v3
.github/workflows/test-python.yml:105
- For supply-chain safety, pin this third-party composite action to a full commit SHA (and apply the same pin to the other occurrences in this workflow) instead of using the mutable
@v3tag.
uses: mongodb-labs/drivers-github-tools/python/setup@v3
.github/workflows/test-python.yml:130
- For supply-chain safety, pin this third-party composite action to a full commit SHA (and apply the same pin to the other occurrences in this workflow) instead of using the mutable
@v3tag.
uses: mongodb-labs/drivers-github-tools/python/setup@v3
.github/workflows/test-python.yml:152
- For supply-chain safety, pin this third-party composite action to a full commit SHA (and apply the same pin to the other occurrences in this workflow) instead of using the mutable
@v3tag.
uses: mongodb-labs/drivers-github-tools/python/setup@v3
.github/workflows/test-python.yml:171
- For supply-chain safety, pin this third-party composite action to a full commit SHA (and apply the same pin to the other occurrences in this workflow) instead of using the mutable
@v3tag.
uses: mongodb-labs/drivers-github-tools/python/setup@v3
.github/workflows/test-python.yml:188
- For supply-chain safety, pin this third-party composite action to a full commit SHA (and apply the same pin to the other occurrences in this workflow) instead of using the mutable
@v3tag.
uses: mongodb-labs/drivers-github-tools/python/setup@v3
.github/workflows/test-python.yml:274
- For supply-chain safety, pin this third-party composite action to a full commit SHA (and apply the same pin to the other occurrences in this workflow) instead of using the mutable
@v3tag.
uses: mongodb-labs/drivers-github-tools/python/setup@v3
- Files reviewed: 1/1 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
🔵 Needs a closer look
The workflow now references mongodb-labs/drivers-github-tools/python/setup@v3 (mutable tag) in multiple jobs and should pin to a commit SHA to reduce supply-chain risk.
Review details
Suppressed comments (8)
.github/workflows/test-python.yml:29
- Pin this third-party action to a specific commit SHA (instead of the mutable
@v3tag) to reduce supply-chain risk; this repo already follows that pattern for otherdrivers-github-toolsactions (e.g.,.github/workflows/uv-lock-update.yml:38).
uses: mongodb-labs/drivers-github-tools/python/setup@v3
.github/workflows/test-python.yml:83
- Pin this third-party action to a specific commit SHA (instead of the mutable
@v3tag) to reduce supply-chain risk; this repo already follows that pattern for otherdrivers-github-toolsactions (e.g.,.github/workflows/uv-lock-update.yml:38).
uses: mongodb-labs/drivers-github-tools/python/setup@v3
.github/workflows/test-python.yml:105
- Pin this third-party action to a specific commit SHA (instead of the mutable
@v3tag) to reduce supply-chain risk; this repo already follows that pattern for otherdrivers-github-toolsactions (e.g.,.github/workflows/uv-lock-update.yml:38).
uses: mongodb-labs/drivers-github-tools/python/setup@v3
.github/workflows/test-python.yml:130
- Pin this third-party action to a specific commit SHA (instead of the mutable
@v3tag) to reduce supply-chain risk; this repo already follows that pattern for otherdrivers-github-toolsactions (e.g.,.github/workflows/uv-lock-update.yml:38).
uses: mongodb-labs/drivers-github-tools/python/setup@v3
.github/workflows/test-python.yml:152
- Pin this third-party action to a specific commit SHA (instead of the mutable
@v3tag) to reduce supply-chain risk; this repo already follows that pattern for otherdrivers-github-toolsactions (e.g.,.github/workflows/uv-lock-update.yml:38).
uses: mongodb-labs/drivers-github-tools/python/setup@v3
.github/workflows/test-python.yml:171
- Pin this third-party action to a specific commit SHA (instead of the mutable
@v3tag) to reduce supply-chain risk; this repo already follows that pattern for otherdrivers-github-toolsactions (e.g.,.github/workflows/uv-lock-update.yml:38).
uses: mongodb-labs/drivers-github-tools/python/setup@v3
.github/workflows/test-python.yml:188
- Pin this third-party action to a specific commit SHA (instead of the mutable
@v3tag) to reduce supply-chain risk; this repo already follows that pattern for otherdrivers-github-toolsactions (e.g.,.github/workflows/uv-lock-update.yml:38).
uses: mongodb-labs/drivers-github-tools/python/setup@v3
.github/workflows/test-python.yml:274
- Pin this third-party action to a specific commit SHA (instead of the mutable
@v3tag) to reduce supply-chain risk; this repo already follows that pattern for otherdrivers-github-toolsactions (e.g.,.github/workflows/uv-lock-update.yml:38).
uses: mongodb-labs/drivers-github-tools/python/setup@v3
- Files reviewed: 1/1 changed files
- Comments generated: 0 new
- Review effort level: Lite
| - name: Install uv | ||
| uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1 | ||
| - name: Install Python tooling | ||
| uses: mongodb-labs/drivers-github-tools/python/setup@v3 |
There was a problem hiding this comment.
This job manages its own venv but the action sets UV_PYTHON to an absolute interpreter path which takes precedence over the activated VIRTUAL_ENV so uv pip install now targets the setup-python interpreter instead of the .venv.
There was a problem hiding this comment.
Good catch! I'll fix this upstream in github-tools, PR coming soon
PYTHON-5956
Adopts the shared
python/setupaction from mongodb-labs/drivers-github-tools#117, replacing the uv and just install steps that eight jobs intest-python.ymleach carried.Changes in this PR
setup-python, with uv pointed at that interpreter.just installstep.Test Plan
CI-only, so the workflow running green is the test: 14 jobs green.
Interpreters were read from the job logs per matrix entry rather than inferred from a green tick: CPython 3.10.20, free-threaded 3.13.15t, 3.15.0-rc.1, PyPy 7.3.23, and 3.9.25.
static'suv lock --checkpasses, and no job setsUV_EXCLUDE_NEWER.Checklist
Checklist for Author
Checklist for Reviewer