Hacktoberfest 2026: as issues que os mantenedores marcaram para outubro, abertas e boas para iniciantes. Ver issues do Hacktoberfest

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

Aberta
#4,339 1 comentário 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
3/5
Tempo estimado
1-2 dias
Facilidade para iniciantes
68/100
Tipo de issue
Bug
Clareza
Claramente especificada
Status de atividade
Ativa
Stack de tecnologia
python
Domínio
build-system

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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.

Linguagem predominante
Starlark
Estrelas
688
Forks
728
Merge médio
18h
PRs com merge (30d)
118

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de bazel-contrib/rules_python

Todas as issues de bazel-contrib/rules_python

Issues semelhantes

Mais issues de Build System

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.