Skip to content

Commit 26bfa6d

Browse files
authored
fix(uv): Correct repo metadata usage & support pre-Bazel 8 (#736)
- fix: repo metadata needs to be returned; not for side-effects - fix: repo metadata needs to be conditional on Bazel > 8.3 ### 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 ### Test plan Manual.
1 parent d22cb68 commit 26bfa6d

File tree

6 files changed

+12
-16
lines changed

6 files changed

+12
-16
lines changed

.bcr/patches/remove_dev_deps.patch

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
--- a/MODULE.bazel 2025-11-22 20:51:10
2-
+++ b/MODULE.bazel 2025-11-22 20:51:10
3-
@@ -39,558 +39,4 @@
4-
1+
--- a/MODULE.bazel 2025-12-01 15:38:57
2+
+++ b/MODULE.bazel 2025-12-01 15:38:57
3+
@@ -41,556 +41,3 @@
54
# HACK: In prod the includer's patch inserts the use_repo for multitool. This
65
# solves the problem of needing a use_repo here in prod and below in dev.
7-
-
6+
87
-################################################################################
98
-# Dev deps
109
-#
@@ -284,7 +283,7 @@
284283
- target_triple = "x86_64-unknown-linux-musl",
285284
- versions = [RUST_VERSION], # "versions" only set in first instance of "rust_darwin_x86_64" repository_set (see comment above)
286285
-)
287-
286+
-
288287
-# -> linux arm (musl)
289288
-rust.repository_set(
290289
- name = "rust_darwin_x86_64",
@@ -421,7 +420,6 @@
421420
-# from bazel/include/test.MODULE.bazel
422421
-# TODO: Replace with bazel_features?
423422
-# cf. https://github.com/bazel-contrib/bazelrc-preset.bzl/blob/main/MODULE.bazel#L8C1-L10C70
424-
-bazel_dep(name = "bazel_features", version = "1.0.0")
425423
-bazel_dep(name = "rules_shell", version = "0.6.1")
426424
-
427425
-version = use_extension("@bazel_features//private:extensions.bzl", "version_extension")

MODULE.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ module(
77

88
# TODO(arrdem): Consolidate on just needing the one bazel_lib
99
bazel_dep(name = "aspect_bazel_lib", version = "2.21.2")
10+
bazel_dep(name = "bazel_features", version = "1.38.0")
1011
bazel_dep(name = "bazel_lib", version = "3.0.0")
1112
bazel_dep(name = "bazel_skylib", version = "1.4.2")
1213
bazel_dep(name = "platforms", version = "1.0.0")
@@ -456,7 +457,6 @@ use_repo(crate, "crates")
456457
# from bazel/include/test.MODULE.bazel
457458
# TODO: Replace with bazel_features?
458459
# cf. https://github.com/bazel-contrib/bazelrc-preset.bzl/blob/main/MODULE.bazel#L8C1-L10C70
459-
bazel_dep(name = "bazel_features", version = "1.0.0")
460460
bazel_dep(name = "rules_shell", version = "0.6.1")
461461

462462
version = use_extension("@bazel_features//private:extensions.bzl", "version_extension")

bazel/include/e2e.MODULE.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# FIXME: These are really the prod deps. Should be includeable.
2+
bazel_dep(name = "bazel_features", version = "1.38.0")
23
bazel_dep(name = "aspect_bazel_lib", version = "2.21.2")
34
bazel_dep(name = "bazel_skylib", version = "1.4.2")
45
bazel_dep(name = "bazel_lib", version = "3.0.0")

bazel/include/test.MODULE.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# TODO: Replace with bazel_features?
22
# cf. https://github.com/bazel-contrib/bazelrc-preset.bzl/blob/main/MODULE.bazel#L8C1-L10C70
3-
bazel_dep(name = "bazel_features", version = "1.0.0")
43
bazel_dep(name = "rules_shell", version = "0.6.1")
54

65
version = use_extension("@bazel_features//private:extensions.bzl", "version_extension")

doc/venv_linking.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Bazel managed virtualenvs

uv/private/extension.bzl

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,9 @@ Relies on the lockfile to enumerate:
3737

3838
# Note that platform constraints are specified by markers in the lockfile, they cannot be explicitly specified.
3939

40-
# FIXME: Need to add package name sanitization/mangling
41-
# https://github.com/bazel-contrib/rules_python/blob/main/python/private/normalize_name.bzl
42-
4340
# FIXME: Need to explicitly test a lockfile with platform-conditional deps (tensorflow cpu vs gpu mac/linux)
4441

42+
load("@bazel_features//:features.bzl", features = "bazel_features")
4543
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file")
4644
load("//uv/private/constraints:repository.bzl", "configurations_hub")
4745
load("//uv/private/constraints/platform:defs.bzl", "supported_platform")
@@ -867,10 +865,6 @@ def _uv_impl(module_ctx):
867865
868866
"""
869867

870-
# Set the reproducible bit for this repo. This at least reduces how much
871-
# junk we dump into the lockfile.
872-
module_ctx.extension_metadata(reproducible = True)
873-
874868
hub_specs = _parse_hubs(module_ctx)
875869

876870
venv_specs = _parse_venvs(module_ctx, hub_specs)
@@ -917,6 +911,9 @@ def _uv_impl(module_ctx):
917911
configurations = configurations,
918912
)
919913

914+
if features.external_deps.extension_metadata_has_reproducible:
915+
return module_ctx.extension_metadata(reproducible = True)
916+
920917
_hub_tag = tag_class(
921918
attrs = {
922919
"hub_name": attr.string(mandatory = True),

0 commit comments

Comments
 (0)