PYTHON-5862 Remove usage of uv lock file#2881
Draft
aclark4life wants to merge 9 commits into
Draft
Conversation
Contributor
There was a problem hiding this comment.
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-lockpre-commit hook and addeduv.lockto.gitignore. - Set
UV_NO_LOCK=1in GitHub Actions and Evergreen scripts to prevent lock-file generation. - Simplified Evergreen cleanup logic that previously reset
uv.lock, and introduced anUV_EXCLUDE_NEWERwindow 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. |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
…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
…t-manual' for Dependabot guidance lint-manual only runs shellcheck/doc8/slotscheck; 'just lint' also runs ruff/ruff-format.
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
… 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.
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.
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-5862
Changes in this PR
Removes the
uv.lockfile 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 inpyproject.toml.What changed
uv.lock.pre-commit-config.yamluv-lockhook.evergreen/run-tests.sh.evergreen/scripts/setup-dev-env.shUV_NO_LOCK=1unconditionally (before the CI guard) so alluvinvocations — includingjust resyncon Evergreen — never create or update a lock file.evergreen/scripts/setup_tests.pyUV_NO_LOCK=1; always writeUV_EXCLUDE_NEWERtotest-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.shUV_NO_LOCKandUV_EXCLUDE_NEWERbefore sourcingsetup-dev-env.sh, which callsuv syncinternally.github/workflows/test-python.ymlUV_NO_LOCK=1at workflow level; add aSet UV_EXCLUDE_NEWERstep in each uv-using job using${UV_EXCLUDE_NEWER:-$(date ...)}so a pre-set value is never overwrittenCONTRIBUTING.mdjust lint, runjust typingif needed, commit and pushWhy
UV_EXCLUDE_NEWERWithout a lock file,
uvresolves the latest available versions on every run.UV_EXCLUDE_NEWERsets 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
Checklist for Reviewer