Skip to content

PYTHON-5956 Use shared python/setup action for CI setup - #2990

Open
blink1073 wants to merge 10 commits into
mongodb:mainfrom
blink1073:PYTHON-5956
Open

PYTHON-5956 Use shared python/setup action for CI setup#2990
blink1073 wants to merge 10 commits into
mongodb:mainfrom
blink1073:PYTHON-5956

Conversation

@blink1073

@blink1073 blink1073 commented Aug 14, 2026

Copy link
Copy Markdown
Member

PYTHON-5956

Adopts the shared python/setup action from mongodb-labs/drivers-github-tools#117, replacing the uv and just install steps that eight jobs in test-python.yml each carried.

Changes in this PR

  • Eight jobs get Python, uv, and just from one step instead of two or three.
  • Python comes from setup-python, with uv pointed at that interpreter.
  • The five jobs that need project dependencies keep their own just install step.

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's uv lock --check passes, and no job sets UV_EXCLUDE_NEWER.

Checklist

Checklist for Author

  • Did you update the changelog (if necessary)? N/A
  • Is there test coverage? Standard GitHub Actions runs
  • 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?

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

codecov Bot commented Aug 14, 2026

Copy link
Copy Markdown

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.
Comment thread .github/workflows/test-python.yml Dismissed
Comment thread .github/workflows/test-python.yml Dismissed
Comment thread .github/workflows/test-python.yml Dismissed
Comment thread .github/workflows/test-python.yml Dismissed
Comment thread .github/workflows/test-python.yml Dismissed
Comment thread .github/workflows/test-python.yml Dismissed
Comment thread .github/workflows/test-python.yml Dismissed
Comment thread .github/workflows/test-python.yml Dismissed

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 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-just steps with a single shared “Install Python tooling” action step.
  • Standardized Python/uv/just provisioning across the static, build, coverage, doctest, docs, typing, integration_tests, and test_minimum jobs.
  • Kept just install only 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 @v3 tag.
        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 @v3 tag.
        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 @v3 tag.
        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 @v3 tag.
        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 @v3 tag.
        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 @v3 tag.
        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 @v3 tag.
          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.

Comment thread .github/workflows/test-python.yml

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 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 @v3 tag) to reduce supply-chain risk; this repo already follows that pattern for other drivers-github-tools actions (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 @v3 tag) to reduce supply-chain risk; this repo already follows that pattern for other drivers-github-tools actions (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 @v3 tag) to reduce supply-chain risk; this repo already follows that pattern for other drivers-github-tools actions (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 @v3 tag) to reduce supply-chain risk; this repo already follows that pattern for other drivers-github-tools actions (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 @v3 tag) to reduce supply-chain risk; this repo already follows that pattern for other drivers-github-tools actions (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 @v3 tag) to reduce supply-chain risk; this repo already follows that pattern for other drivers-github-tools actions (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 @v3 tag) to reduce supply-chain risk; this repo already follows that pattern for other drivers-github-tools actions (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 @v3 tag) to reduce supply-chain risk; this repo already follows that pattern for other drivers-github-tools actions (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

@blink1073
blink1073 marked this pull request as ready for review September 2, 2026 19:49
@blink1073
blink1073 requested a review from a team as a code owner September 2, 2026 19:49
- 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

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.

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.

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.

Good catch! I'll fix this upstream in github-tools, PR coming soon

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.

4 participants