uv lock(): support non-quiet output from the .run target

Open Beginner friendly
#4,164 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
build-system

Research direction

Start in @rules_python//python/uv:lock.bzl and inspect how the lock() macro assembles the .run target's uv command. Add the optional quiet behavior described in the issue, preserving the existing default, and verify that quiet = False allows normal output while the default still passes --no-progress and --quiet.

Written by the indexing model from the issue text.

Description

Problem

The lock() macro in @rules_python//python/uv:lock.bzl generates a .run target whose shell script hardcodes --no-progress --quiet when invoked via bazel run:

exec '.../uv' 'lock' '--no-python-downloads' '--no-cache' '--project' '.' '--python' '...' '--no-progress' '--quiet' "$@"

This means all uv output is suppressed. Passing --verbose does not work — uv rejects --quiet and --verbose together with an error:

error: the argument '--quiet...' cannot be used with '--verbose...'

Use case

We call bazel run //:uv_lock.run -- --check from a just recipe to verify that uv.lock is consistent with pyproject.toml (a developer workflow check, not a CI test). With --quiet hardcoded, there is no feedback on success and no details on failure about what changed. We want uv's normal output (e.g. "Resolved 562 packages in 5.75s" on success, or the list of changed packages on failure).

Proposed solution

Add an optional quiet attribute to the lock() macro (defaulting to True to preserve existing behavior) that controls whether --quiet and --no-progress are passed to the .run script:

lock(
    name = "uv_lock",
    srcs = ["pyproject.toml", "uv.lock"],
    out = "uv.lock",
    quiet = False,  # show uv output when running bazel run //:uv_lock.run
)

Workaround

We currently work around this by adding a custom Starlark rule (uv_lock_check_run) that inherits the same runfiles as .run but finds the uv binary at runtime and calls it directly without --quiet. This wrapper exists solely because the attribute is not exposed.

Dominant language
Starlark
Stars
690
Forks
722
Avg merge
18h 7m
Merged PRs (30d)
56

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from bazel-contrib/rules_python

All issues in bazel-contrib/rules_python

Similar issues

More Build System issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.