You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
uv: lock() .run target for uv.lock omits existing lock and writes to runfiles #4339
Running bazel run <name>.run on a lock() target with a uv.lock output
(e.g. bazel run //dev:uv_lock.run -- --upgrade-package certifi==2026.1.4)
fails to update the workspace lockfile in place due to two bugs:
Missing existing lock in runfiles: _common_lock in python/uv/private/lock.bzl passes ctx.files.existing_output to the build
action's inputs, but omits it from _RunLockInfo.runfiles. Because uv
runs in .runfiles/_main where no uv.lock is present, uv lock
re-resolves all dependencies from scratch instead of incrementally updating
the existing lock.
Output written to .runfiles instead of the source tree: Unlike uv pip compile (which accepts --output-file), uv lock always reads and
writes uv.lock in the project directory relative to its working directory.
When BUILD_WORKSPACE_DIRECTORY is set, uv_lock.sh and uv_lock.bat
execute uv immediately without linking or copying {{project_lock}} to ${BUILD_WORKSPACE_DIRECTORY}/{{src_out}}. The updated lockfile is written
to bazel-bin/.../*.run.runfiles/_main/.../uv.lock, leaving the source tree
untouched.
This is a bug, right? I noticed that the integration test is verifying that the file in runfiles is being updated. Which I find rather strange -- runfiles are typically read-only, so writing to such a file is unsound.
Fixing this might be tricky, though. AFAICT uv lock doesn't have a flag to control where output goes. But weren't we planning on synthesizing a folder structure in runfiles so workspace could work, and so project files from other repos could be integrated? Maybe we'll have to change it to create a temporary directory at runtime and operate within that?
Activity
rickeylev commentedon Oct 24, 2026
This is a bug, right? I noticed that the integration test is verifying that the file in runfiles is being updated. Which I find rather strange -- runfiles are typically read-only, so writing to such a file is unsound.
Fixing this might be tricky, though. AFAICT
uv lockdoesn't have a flag to control where output goes. But weren't we planning on synthesizing a folder structure in runfiles so workspace could work, and so project files from other repos could be integrated? Maybe we'll have to change it to create a temporary directory at runtime and operate within that?