Repository navigation
feat(uv): add @uv//:uv and //python/uv/bin:uv targets to run uv - #4371
Conversation
Users could not run the Bazel-configured `uv` binary directly because `//python/uv:current_toolchain` had restricted visibility and omitted the underlying `uv` binary from its runfiles and executable symlink flag. Make `//python/uv:current_toolchain` public, mark its symlink executable while preserving any file extension (such as `.exe` on Windows), and include the underlying `uv` binary in its runfiles. Expose convenient public aliases at `@uv//bin:bin`, `//python/uv/bin:bin`, and `//python/uv/bin:uv` so users can invoke `uv` directly via `bazel run`.
|
AI Disclosure: This pull request was developed with the assistance of an AI coding agent ( PR Comment Handling: Review comments on this PR will be reviewed and addressed with human oversight before any responses or follow-up changes are posted. This is an automatically generated agent comment. |
|
The targets I like most are:
But both of those names are somewhat taken. Read below.
We could make the I like the brevity of e.g. The next best option IMHO is @rules_python//python/uv:bin` And we can create an alias in the |
Define `$(UV)` alongside `$(UV_BIN)` in `//python/uv:current_toolchain` and document `bazel_env.bzl` usage per review feedback. Update `uv_help_test.py` to match `uv.exe` in Windows `--help` output.
|
Extra:
That said, in addition to those, we should provide @UV so that users have a choice. :) |
Use @uv//:uv as the sole uv binary alias in the @UV repository so users can run `bazel run @uv` or `bazel run @uv//:uv` directly without a separate bin subpackage.
Exposing two aliases inside //python/uv/bin adds redundant API surface when @uv//:uv already provides package-shorthand execution (`bazel run @uv`). Keep //python/uv/bin:uv as the sole alias in //python/uv/bin and update its documentation, news entry, and toolchain test.
Users inspecting //python/uv:current_toolchain in the API reference could miss the shorter aliases that forward to it. Note both //python/uv/bin:uv and @uv//:uv in the current_toolchain target documentation.
Users could not run the Bazel-configured
uvbinary directly because//python/uv:current_toolchainhad restricted visibility and omittedthe underlying
uvbinary from its runfiles and executable symlinkflag.
Make
//python/uv:current_toolchainpublic, mark its symlink executablewhile preserving any file extension (such as
.exeon Windows),include the underlying
uvbinary in its runfiles, and expose the$(UV)Make variable alongside$(UV_BIN). Expose convenient publicaliases at
@uv//:uvand//python/uv/bin:uvso users can invokeuvdirectly via
bazel run.