Force UV_FROZEN=0 for uv-lock hook - #71
Open
jfra1397 wants to merge 1 commit into
Open
Conversation
jfra1397
force-pushed
the
fix-uv-lock-frozen
branch
from
July 14, 2026 08:12
78e12d8 to
11f66f9
Compare
When UV_FROZEN=1 is set in the environment (common in CI), `uv lock` enables --check-exists semantics: it verifies uv.lock exists but does not check if it is up-to-date and does not update it. The hook then passes even when pyproject.toml has drifted from uv.lock, so lockfile drift can slip through pre-commit unnoticed. Prefix the entry with `env UV_FROZEN=0` so the hook always exercises the "update the lockfile" path regardless of what the surrounding environment sets. Users who genuinely want a check-only variant can still call `uv lock --check` directly. Closes astral-sh#70
jfra1397
force-pushed
the
fix-uv-lock-frozen
branch
from
July 14, 2026 08:12
11f66f9 to
52ffe4f
Compare
jfra1397
marked this pull request as ready for review
July 17, 2026 18:16
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.
Closes #70.
When
UV_FROZEN=1is set in the environment (common in CI),uv lockenables its--check-existssemantics: it verifies thatuv.lockexists but does not check if it is up-to-date and does not update it. Theuv-lockpre-commit hook then passes even whenpyproject.tomlhas drifted fromuv.lock, so lockfile drift can slip through pre-commit unnoticed.This PR prefixes the hook's entry with
env UV_FROZEN=0so it always exercises the "update the lockfile" path regardless of what the surrounding environment sets. Users who want a check-only variant can still calluv lock --checkdirectly.Marked as draft — happy to switch to a different approach (e.g.
entry: env -u UV_FROZEN uv lock, orargs: ["--check"]as a behavior change) if the maintainers prefer.Portability note: this relies on
envbeing on PATH, which is true on POSIX systems. Not sure how it fares for pre-commit users on Windows — feedback welcome.