fix(uv): deduplicate whl_install wheel file labels#1208
Open
jimmyt857 wants to merge 1 commit into
Open
Conversation
py_binary startup benchmark
sys.path quality
✅ No regression detected (PR is +1.5% vs HEAD main) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
uv.lockcan contain multiple wheel entries that resolve to the same fetched wheel repository label. One way this happens is when duplicate package records have wheel URLs with different basenames but the same hash, sorules_pyfetches them through the samehttp_filerepository.Before this change, the uv extension forwarded those duplicate labels directly to the
whl_install.whl_fileslabel_listattr. Bazel rejects duplicate labels during repository rule instantiation, so the install fails before wheel metadata can be extracted.This change deduplicates the non-empty wheel file labels while preserving order, then changes
whl_installmetadata extraction to map the deduplicated labels back to the serialized prebuild targets by label string instead of relying on positional pairing. That keeps the label_list valid without losing top-level metadata for selectable wheels.Regression Test
Adds
e2e/cases/uv-duplicate-whl-labels, whose lockfile contains twosix==1.16.0wheel entries with the same hash and different wheel basenames. Without the fix, the test fails during repository rule setup with a duplicatewhl_fileslabel error.Testing
bazel run //:gazellebazel test //uv/private/extension:all //uv/private/whl_install:all(cd e2e && bazel test //cases/uv-duplicate-whl-labels:test_import //cases/uv-dup-lock-records:all)pre-commit run buildifier --files e2e/MODULE.bazel e2e/cases/uv-duplicate-whl-labels/BUILD.bazel e2e/cases/uv-duplicate-whl-labels/setup.MODULE.bazel uv/private/extension/defs.bzl uv/private/whl_install/repository.bzlNote:
pre-commit run buildifier-lint --files ...still reports existing warnings in touched upstream files, so I kept this patch focused on the regression rather than sweeping unrelated lint cleanup.