Skip to content

fix(uv): restore Bazel 7 compatibility by replacing set() with a bazel_features-aware compat shim#1070

Draft
xangcastle wants to merge 1 commit into
mainfrom
xangcastle/compatibility-bazel7
Draft

fix(uv): restore Bazel 7 compatibility by replacing set() with a bazel_features-aware compat shim#1070
xangcastle wants to merge 1 commit into
mainfrom
xangcastle/compatibility-bazel7

Conversation

@xangcastle

Copy link
Copy Markdown
Member

Problem

Users on Bazel 7 hit a load-time error in graph_utils.bzl and
uv_project/repository.bzl because set() is a Starlark built-in
that was only introduced in Bazel 8. Any workspace still on Bazel 7
fails immediately with:

  name 'set' is not defined

Solution

Adds uv/private/compat.bzl, a thin shim that uses bazel_features
(already a project dependency) to select the right implementation at
repository evaluation time:

  • Bazel 8+: delegates to the native set() constructor — O(1)
    membership, zero overhead.
  • Bazel 7: falls back to a plain dict used as a set, which is the
    standard Starlark idiom and fully compatible.

Iteration (for x in s) and membership (x in s) work identically on
both a native set and a dict, so call-site ergonomics are unchanged.

Affected files

  • uv/private/compat.bzl — new shim (new_set / set_add)
  • uv/private/extension/graph_utils.bzl — was line 25
  • uv/private/uv_project/repository.bzl — was line 93

Changes are visible to end-users: no

Test plan

  • Covered by existing test cases

@xangcastle xangcastle requested a review from jbedard June 1, 2026 17:14
@aspect-workflows

aspect-workflows Bot commented Jun 1, 2026

Copy link
Copy Markdown

✨ Aspect Workflows Tasks

📅 Mon Jun 1 17:14:30 UTC 2026

✅ 7 successful tasks

  • ✅ buildifier · ⏱ 21.3s · 🐙 GitHub Actions · ☑️ Check
    💬 Format complete (clean)
  • ✅ gazelle · ⏱ 37.4s · 🐙 GitHub Actions · ☑️ Check
    💬 Gazelle complete (clean)
  • ✅ test (test-e2e-bazel-8) · ⏱ 28m 40s · 🐙 GitHub Actions · ☑️ Check
    💬 Bazel test complete (137/137 passed)
  • ✅ test (test-e2e-bazel-9) · ⏱ 28m 47s · 🐙 GitHub Actions · ☑️ Check
    💬 Bazel test complete (132/132 passed)
  • ✅ test (test-examples-uv_pip_compile-bazel-8) · ⏱ 36.1s · 🐙 GitHub Actions · ☑️ Check
    💬 Bazel test complete (1/1 passed · 1 cached)
  • ✅ test (test-root-bazel-8) · ⏱ 20m 49s · 🐙 GitHub Actions · ☑️ Check
    💬 Bazel test complete (185/185 passed)
  • ✅ test (test-root-bazel-9) · ⏱ 22m 41s · 🐙 GitHub Actions · ☑️ Check
    💬 Bazel test complete (184/184 passed)

⏱ Last updated Mon Jun 1 17:44:44 UTC 2026 · 📊 GitHub API quota 1,507/15,000 (10% used, resets in 36m, throttle 3×)
🚀 Powered by Aspect CLI (v2026.22.39)  |  Aspect Build · X · LinkedIn · YouTube

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.

1 participant