Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

uv: lock() .run target for uv.lock omits existing lock and writes to runfiles

クローズ
#4,339 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

関連するプルリクエストがすでにマージされています。

  • #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:

  1. 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.
  2. 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.
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分
マージ済み PR(30日)
131

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

bazel-contrib/rules_python のほかの issue

bazel-contrib/rules_python の issue をすべて見る

似ている issue

Build System の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。