[9.0.0] Add attr.label_list_dict#27550
Merged
meteorcloudy merged 1 commit intobazelbuild:release-9.0.0from Nov 6, 2025
Merged
Conversation
Motivating examples for adding this type: * Packaging rules that bundle targets into substructures (e.g. subdirectories). * Providing hints to aspects via a well-known implicit attribute mapping the names of other attributes to a list of well-known targets representing the semantic meaning of an edge (e.g. "compile time dep", "runtime dep", "third party dep", ...) for use in SBOM generation and packaging. * rules_js and other rulesets have `patches` parameters on their module extensions that accept lists of patches to apply per external dependency. With WORKSPACE, they relied on `attr.string_list_dict`, but the lack of repo mapping means that there is no direct port. Users would need to migrate to individual tags per hub repo and dep to supply patches. Adding this type doesn't incur a significant maintenance cost: * The native attribute type `LABEL_LIST_DICT` already exists (added for `exec_group_compatible_with`), so this only requires wiring it up in Starlark. In fact, some of the added logic (duplicate checking) is relevant for this existing use case, we just forgot to add it. * A Starlark type with equivalent BUILD syntax already exists (`attr.string_list_dict`), so there is no need for tooling to explicitly support the new type. Fixes bazelbuild#7989 RELNOTES[NEW]: The new `attr.label_list_dict` type accepts a dict in which keys are strings and values are lists of labels. Closes bazelbuild#27119. PiperOrigin-RevId: 828510272 Change-Id: Ibf5ba97d049e592af2f61d91dbaa42cfe264f0bb
meteorcloudy
approved these changes
Nov 6, 2025
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.
Motivating examples for adding this type:
patchesparameters on their module extensions that accept lists of patches to apply per external dependency. With WORKSPACE, they relied onattr.string_list_dict, but the lack of repo mapping means that there is no direct port. Users would need to migrate to individual tags per hub repo and dep to supply patches.Adding this type doesn't incur a significant maintenance cost:
LABEL_LIST_DICTalready exists (added forexec_group_compatible_with), so this only requires wiring it up in Starlark. In fact, some of the added logic (duplicate checking) is relevant for this existing use case, we just forgot to add it.attr.string_list_dict), so there is no need for tooling to explicitly support the new type.Fixes #7989
RELNOTES[NEW]: The new
attr.label_list_dicttype accepts a dict in which keys are strings and values are lists of labels.Closes #27119.
PiperOrigin-RevId: 828510272
Change-Id: Ibf5ba97d049e592af2f61d91dbaa42cfe264f0bb
Commit b0f51a9