fix(uv): Reuse the uv cache in runnable lock targets - #4180
Open
hartikainen wants to merge 1 commit into
Open
hartikainen wants to merge 1 commit into
hartikainen wants to merge 1 commit into
Conversation
hartikainen
force-pushed
the
uv-lock-cache
branch
from
September 23, 2026 18:12
08ccaed to
f34ce54
Compare
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Correct the integration test lock-file path and update the news entry’s required references.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (1)
What changed in this PR
Updates lock() runnable targets to reuse the caller’s uv cache while preserving cache isolation for build actions.
Changes:
- Moves
--no-cacheto build-action arguments. - Adds cache analysis and integration tests.
- Documents the new runnable cache behavior.
| File | Summary |
|---|---|
tests/uv/lock/lock_run_test.py |
Updates runnable-script expectations and cache setup. |
tests/uv/lock/cache_tests.bzl |
Adds cache-policy analysis tests. |
tests/uv/lock/BUILD.bazel |
Registers cache tests. |
tests/integration/uv_lock/BUILD.bazel |
Adds the integration lock target. |
tests/integration/uv_lock_test.py |
Tests cache reuse and bypass behavior; the lock-file path needs correction. |
python/uv/private/lock.bzl |
Separates build-only and runnable cache flags. |
news/uv-lock-run-cache.fixed.md |
Documents the change; needs required formatting and issue cross-reference updates. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| The `lock()` macro's `.run` target uses the `uv` cache and honors | ||
| `UV_CACHE_DIR` and `UV_NO_CACHE`. Pass `--refresh` to refresh cached data or | ||
| `--no-cache` to disable caching. Lock build actions, including those used by | ||
| `.update`, disable the `uv` cache. |
hartikainen
force-pushed
the
uv-lock-cache
branch
from
September 23, 2026 18:36
f34ce54 to
e8d08f1
Compare
Keep `--no-cache` on Bazel build actions while allowing `.run` targets to reuse the persistent `uv` cache. Document the cache controls and test both lock formats, cache opt-outs, and POSIX and Windows script generation. The integration regression resolves against a local authenticated package index, deletes the output, and regenerates the lockfile offline. It fails for both formats when `.run` receives `--no-cache` by default. Related to [bazel-contrib#4164](bazel-contrib#4164). This applies the same separation between build-action flags and `.run` defaults to caching. Output verbosity remains unchanged.
hartikainen
force-pushed
the
uv-lock-cache
branch
from
September 23, 2026 18:41
e8d08f1 to
1ab4682
Compare
This branch has not been deployed
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.

This PR lets
.runtargets reuse the caller'suvcache by moving--no-cachefrom the shared arguments to the build-action arguments. Repeated runs can reuse registry metadata, Git checkouts, and build metadata. Build actions retain cache isolation, and callers can still pass--no-cache.The lock tests use a sandbox-writable
UV_CACHE_DIRand verify that.runcreates it.Closes #4179.