uv: lock() .run target for uv.lock omits existing lock and writes to runfiles
Maintainer antworten meist innerhalb von 1 Tag
Ein zugehöriger Pull Request wurde bereits gemerged.
- #4343 von @rickeylev — gemerged
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 68/100
- Issue-Typ
- Bug
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- python
- Bereich
- build-system
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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.
- Vorherrschende Sprache
- Starlark
- Sterne
- 688
- Forks
- 728
- Ø Merge
- 17 Std. 24 Min.
- Gemergte PRs (30 T.)
- 131
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus bazel-contrib/rules_python
-
Broken links in the docsOffen
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 82/100
bazel-contrib/rules_python#4319 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
bazel-contrib/rules_python#4251 · 1 Reaktion ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
bazel-contrib/rules_python#4164 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
need: repro
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 35/100
bazel-contrib/rules_python#4315 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 45/100
bazel-contrib/rules_python#4311 ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in bazel-contrib/rules_python
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 64/100
astral-sh/astral-codec#234 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 83/100
Maintainer antworten meist innerhalb von 1 Tag
-
area:install bug needs-triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
Maintainer antworten meist innerhalb von 3 Tagen
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
Maintainer antworten meist innerhalb von 1 Tag