uv: lock() .run target for uv.lock omits existing lock and writes to runfiles
维护者通常 1 天内回复
已经有一个关联 PR 被合并了。
- #4343 来自 @rickeylev —— 已合并
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 68/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- python
- 领域
- build-system
调研方向
Start with _common_lock in python/uv/private/lock.bzl and the uv_lock.sh and uv_lock.bat launchers. Check how the existing lock is added to runfiles and how the launcher handles BUILD_WORKSPACE_DIRECTORY, then reproduce with the provided bazel run command. Done means the existing lock is available to uv and the command updates dev/uv.lock in the source tree.
由索引模型根据 Issue 内容生成。
描述
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_lockin
python/uv/private/lock.bzlpassesctx.files.existing_outputto the build
action'sinputs, but omits it from_RunLockInfo.runfiles. Becauseuv
runs in.runfiles/_mainwhere nouv.lockis present,uv lock
re-resolves all dependencies from scratch instead of incrementally updating
the existing lock. - Output written to
.runfilesinstead of the source tree: Unlike
uv pip compile(which accepts--output-file),uv lockalways reads and
writesuv.lockin the project directory relative to its working directory.
WhenBUILD_WORKSPACE_DIRECTORYis set,uv_lock.shanduv_lock.bat
executeuvimmediately without linking or copying{{project_lock}}to
${BUILD_WORKSPACE_DIRECTORY}/{{src_out}}. The updated lockfile is written
tobazel-bin/.../*.run.runfiles/_main/.../uv.lock, leaving the source tree
untouched.
Reproduction
#!/usr/bin/env bash
set -euo pipefail
git checkout -- dev/uv.lock
bazel run //dev:uv_lock.run -- --upgrade-package certifi==2026.1.4
changes=$(git diff dev/uv.lock | grep -c '^-version = ' || true)
if [[ "$changes" -eq 1 ]]; then
echo "PASS: dev/uv.lock updated 1 package as expected"
else
echo "FAIL: expected 1 package updated in dev/uv.lock, got $changes"
exit 1
fi
Running this prints:
FAIL: expected 1 package updated in dev/uv.lock, got 0
while bazel-bin/dev/uv_lock.run.runfiles/_main/dev/uv.lock contains a full
re-resolution of 18 packages.
- 主要语言
- Starlark
- 星标
- 688
- 派生
- 728
- 平均合并
- 17 小时 24 分钟
- 30 天内合并 PR
- 131
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
bazel-contrib/rules_python 的其他 Issue
-
难度 1/5 1 小时以内 新手友好度 82/100
bazel-contrib/rules_python#4319 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
bazel-contrib/rules_python#4251 · 1 个 reaction ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
bazel-contrib/rules_python#4164 · 1 条评论 ·
维护者通常 1 天内回复
-
need: repro
难度 5/5 一周以上 新手友好度 35/100
bazel-contrib/rules_python#4315 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 45/100
bazel-contrib/rules_python#4311 ·
维护者通常 1 天内回复
查看 bazel-contrib/rules_python 的全部 Issue
相似的 Issue
-
CVE-2026-111497未关闭
难度 1/5 1 小时以内 新手友好度 82/100
fink/fink-distributions#1322 ·
-
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
bug
难度 1/5 1 小时以内 新手友好度 77/100
-
bug good first issue
难度 2/5 1-3 小时 新手友好度 82/100
solongate/agent-security#118 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 64/100
astral-sh/astral-codec#234 ·
维护者通常 1 天内回复