Skip to content

feat: add uv toolchain extension#943

Merged
jbedard merged 1 commit intomainfrom
uv-toolchain
May 1, 2026
Merged

feat: add uv toolchain extension#943
jbedard merged 1 commit intomainfrom
uv-toolchain

Conversation

@jbedard
Copy link
Copy Markdown
Member

@jbedard jbedard commented Apr 23, 2026

Add a UV module extension/toolchain for fetching UV via bazel.

Changes are visible to end-users: yes

  • Searched for relevant documentation and updated as needed: yes
  • Breaking change (forces users to change their own code or config): no
  • Suggested release notes appear below: yes

The uv module extension's new toolchain() tag downloads a hermetic uv and publishes @uv (host alias) plus @uv//:all (per-platform toolchains).

Test plan

  • Covered by existing test cases
  • New test cases added
  • Manual testing; bazel run @uv -- --help

@aspect-workflows
Copy link
Copy Markdown

aspect-workflows Bot commented Apr 23, 2026

Bazel 8 (Test)

All tests were cache hits

121 tests (100.0%) were fully cached saving 58s.


Bazel 9 (Test)

All tests were cache hits

120 tests (100.0%) were fully cached saving 1m 2s.


Bazel 8 (Test)

e2e

All tests were cache hits

55 tests (100.0%) were fully cached saving 51s.


Bazel 9 (Test)

e2e

All tests were cache hits

55 tests (100.0%) were fully cached saving 1m.


Bazel 8 (Test)

examples/uv_pip_compile

All tests were cache hits

1 test (100.0%) was fully cached saving 444ms.


Buildifier

@jbedard jbedard force-pushed the uv-toolchain branch 4 times, most recently from 5e766ba to 062037c Compare April 23, 2026 22:49
@jbedard jbedard requested a review from Copilot April 23, 2026 22:49
chatgpt-codex-connector[bot]

This comment was marked as outdated.

This comment was marked as outdated.

@jbedard jbedard force-pushed the uv-toolchain branch 2 times, most recently from 46a5543 to 3dd4923 Compare April 23, 2026 23:13
@jbedard jbedard requested a review from Copilot April 23, 2026 23:16

This comment was marked as outdated.

chatgpt-codex-connector[bot]

This comment was marked as outdated.

This comment was marked as resolved.

@jbedard jbedard force-pushed the uv-toolchain branch 3 times, most recently from 7e118d0 to dd5e7dc Compare April 23, 2026 23:58
@jbedard jbedard requested a review from Copilot April 23, 2026 23:59
chatgpt-codex-connector[bot]

This comment was marked as resolved.

This comment was marked as outdated.

@jbedard jbedard force-pushed the uv-toolchain branch 2 times, most recently from a890964 to 11aabbc Compare April 24, 2026 00:27
chatgpt-codex-connector[bot]

This comment was marked as resolved.

@jbedard jbedard changed the base branch from main to llvm-071 April 24, 2026 02:36
Base automatically changed from llvm-071 to main April 24, 2026 02:48
Comment thread uv/private/extension/defs.bzl Outdated
@dzbarsky
Copy link
Copy Markdown
Collaborator

This extension feels bloated. Would be better to split tool and package bits into separate ones, that's how other languages work. You can still name it uv, just put it in separate bzl file. As a bonus it will lead to fewer transitive bzl invalidations.

The other concern I have - is the extension still reproducible given the host -specific bits?

@jbedard jbedard force-pushed the uv-toolchain branch 4 times, most recently from 803777c to 780b5d4 Compare April 28, 2026 20:16
@jbedard
Copy link
Copy Markdown
Member Author

jbedard commented Apr 28, 2026

I've moved this to a new file and new module_extension to better separate the uv tool vs uv-lockfile-consumption, which I think is a good separation?

For the rctx.os-specific alias() within a reproducible=True extension... that seems to be a bit of a grey area, but I think bazel should handle this correctly because the uv_hub_repository() repo rule creating this alias() sets configure = True. IMO we should keep the reproducible=True under the assumption that bazel understands the use of rctx.os.*+configure=True...

@jbedard jbedard force-pushed the uv-toolchain branch 4 times, most recently from 2fe8405 to d990ea3 Compare May 1, 2026 02:48
@jbedard jbedard enabled auto-merge (squash) May 1, 2026 03:12
@jbedard jbedard disabled auto-merge May 1, 2026 03:13
@jbedard jbedard enabled auto-merge (squash) May 1, 2026 03:14
@jbedard jbedard merged commit 39216f8 into main May 1, 2026
3 checks passed
@jbedard jbedard deleted the uv-toolchain branch May 1, 2026 03:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants