Skip to content

PYTHON-5862 Remove usage of uv lock file#2881

Draft
aclark4life wants to merge 9 commits into
mongodb:masterfrom
aclark4life:PYTHON-5862
Draft

PYTHON-5862 Remove usage of uv lock file#2881
aclark4life wants to merge 9 commits into
mongodb:masterfrom
aclark4life:PYTHON-5862

Conversation

@aclark4life

@aclark4life aclark4life commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

PYTHON-5862

Changes in this PR

Removes the uv.lock file and all machinery around it. Keeping a lock file for a driver library causes more churn than it prevents — Dependabot raises weekly PRs that require manual regeneration, and the lock is redundant with the pinning strategy already applied in pyproject.toml.

What changed

File Change
uv.lock Deleted
.pre-commit-config.yaml Removed uv-lock hook
.evergreen/run-tests.sh Removed post-test lock-file cleanup
.evergreen/scripts/setup-dev-env.sh Export UV_NO_LOCK=1 unconditionally (before the CI guard) so all uv invocations — including just resync on Evergreen — never create or update a lock file
.evergreen/scripts/setup_tests.py Set UV_NO_LOCK=1; always write UV_EXCLUDE_NEWER to test-env.sh (using existing env value when set, computing a 7-day-ago default otherwise) so the value survives into new shell sessions
.evergreen/combine-coverage.sh Export UV_NO_LOCK and UV_EXCLUDE_NEWER before sourcing setup-dev-env.sh, which calls uv sync internally
.github/workflows/test-python.yml Set UV_NO_LOCK=1 at workflow level; add a Set UV_EXCLUDE_NEWER step in each uv-using job using ${UV_EXCLUDE_NEWER:-$(date ...)} so a pre-set value is never overwritten
CONTRIBUTING.md Update Dependabot triage guidance: check out PR, run just lint, run just typing if needed, commit and push

Why UV_EXCLUDE_NEWER

Without a lock file, uv resolves the latest available versions on every run. UV_EXCLUDE_NEWER sets a cutoff date (7 days ago by default, overridable) so resolution is stable across CI runs on the same day and avoids picking up packages published within the last week.

Test Plan

CI-infrastructure change only — no driver logic altered. Verified by running the Evergreen patch and confirming no unexpected lock files are created.

Checklist

Checklist for Author

  • Did you update the changelog (if necessary)?
  • Is there test coverage?
  • Is any followup work tracked in a JIRA ticket? If so, add link(s).

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 review requested due to automatic review settings June 17, 2026 17:01
@aclark4life aclark4life requested a review from a team as a code owner June 17, 2026 17:01
@aclark4life aclark4life requested a review from sleepyStick June 17, 2026 17:01

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.

Pull request overview

This PR removes reliance on uv.lock in the PyMongo repo’s developer/CI workflows by disabling lock generation and removing the pre-commit hook that maintained the lock file.

Changes:

  • Removed the uv-lock pre-commit hook and added uv.lock to .gitignore.
  • Set UV_NO_LOCK=1 in GitHub Actions and Evergreen scripts to prevent lock-file generation.
  • Simplified Evergreen cleanup logic that previously reset uv.lock, and introduced an UV_EXCLUDE_NEWER window for dependency resolution in Evergreen.

Reviewed changes

Copilot reviewed 6 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
.pre-commit-config.yaml Removes the uv-lock hook that updated uv.lock.
.gitignore Ignores uv.lock so it won’t show up as an untracked/dirty file.
.github/workflows/test-python.yml Sets UV_NO_LOCK for GitHub Actions runs.
.evergreen/scripts/setup-dev-env.sh Disables lock generation during local uv sync in dev-env setup.
.evergreen/scripts/setup_tests.py Disables lock generation for test env setup; adds UV_EXCLUDE_NEWER behavior.
.evergreen/run-tests.sh Removes cleanup that reverted uv.lock.
.evergreen/combine-coverage.sh Disables lock generation for coverage environment; sets UV_EXCLUDE_NEWER.

Comment thread .pre-commit-config.yaml
Comment thread .evergreen/scripts/setup_tests.py
Comment thread .evergreen/combine-coverage.sh
@codecov-commenter

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.

Pull request overview

Copilot reviewed 7 out of 9 changed files in this pull request and generated 3 comments.

Comment thread .evergreen/combine-coverage.sh
Comment thread CONTRIBUTING.md Outdated
Comment thread .github/workflows/test-python.yml
…UV_EXCLUDE_NEWER in GHA

- Fix nested double-quote bash syntax in combine-coverage.sh (python3 -c argument
  must use single quotes inside the ${...:-$(...)} expansion)
- Add actionable steps to CONTRIBUTING.md Dependabot section
- Compute and export UV_EXCLUDE_NEWER in all uv-using GitHub Actions jobs for
  deterministic package resolution without a lock file
@aclark4life aclark4life requested a review from Copilot June 17, 2026 19:38

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.

Pull request overview

Copilot reviewed 7 out of 9 changed files in this pull request and generated 1 comment.

Comment thread CONTRIBUTING.md
…t-manual' for Dependabot guidance

lint-manual only runs shellcheck/doc8/slotscheck; 'just lint' also runs ruff/ruff-format.

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.

Pull request overview

Copilot reviewed 7 out of 9 changed files in this pull request and generated 2 comments.

Comment thread .evergreen/combine-coverage.sh Outdated
Comment thread .github/workflows/test-python.yml Outdated
sleepyStick
sleepyStick previously approved these changes Jun 17, 2026
…-dev-env, make UV_EXCLUDE_NEWER conditional in GHA

- combine-coverage.sh: export UV_NO_LOCK and UV_EXCLUDE_NEWER before sourcing
  setup-dev-env.sh, which calls uv sync internally; without this the first sync
  ran without the intended settings
- test-python.yml: use ${UV_EXCLUDE_NEWER:-$(date ...)} so the computed default
  does not overwrite a value already set via repository/environment variables

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.

Pull request overview

Copilot reviewed 7 out of 9 changed files in this pull request and generated 2 comments.

Comment thread .evergreen/scripts/setup-dev-env.sh
Comment thread .evergreen/scripts/setup_tests.py Outdated
… value if set

Previously, if UV_EXCLUDE_NEWER was already in the environment the write_env
call was skipped entirely. If test-env.sh is later sourced in a new shell the
variable wouldn't be present, causing inconsistent resolution. Now the value is
always written: the existing env var is used when set, otherwise a default of
7 days ago is computed.

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.

Pull request overview

Copilot reviewed 7 out of 9 changed files in this pull request and generated 1 comment.

Comment thread .evergreen/scripts/setup-dev-env.sh
Previously UV_NO_LOCK=1 was only exported inside the non-CI branch. On
Evergreen (CI=1), just recipes like 'resync' that call uv sync would run
without it, allowing uv.lock to be created or updated. Moving the export
before the CI guard ensures all uv invocations in both CI and local
environments respect the no-lock setting.

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.

Pull request overview

Copilot reviewed 7 out of 9 changed files in this pull request and generated no new comments.

@aclark4life aclark4life requested a review from sleepyStick June 18, 2026 14:44
@aclark4life aclark4life marked this pull request as draft June 18, 2026 19:26
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