Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

depset vs. starlark set: add conversion methods and documentation about which one to use #25130

Open
tetromino opened this issue Jan 29, 2025 · 1 comment
Assignees
Labels
P3 We're not considering working on this, but happy to review a PR. (No assignee) team-Rules-API API for writing rules/aspects: providers, runfiles, actions, artifacts team-Starlark-Interpreter Issues involving the Starlark interpreter used by Bazel type: feature request

Comments

@tetromino
Copy link
Contributor

Now that Bazel has sets as a core data structure in the Starlark language, we ought to

  • document why both depsets and Starlark sets exist, compare their performance characteristics, and explain which one you should use in which case
  • add a to_set (or maybe to_mutable_set?) method to depset objects
  • optimize the depset constructor when constructing from a starlark set rather than an arbitrary sequence value
@tetromino tetromino added P3 We're not considering working on this, but happy to review a PR. (No assignee) team-Rules-API API for writing rules/aspects: providers, runfiles, actions, artifacts team-Starlark-Interpreter Issues involving the Starlark interpreter used by Bazel labels Jan 29, 2025
@tetromino tetromino self-assigned this Jan 29, 2025
@tetromino
Copy link
Contributor Author

tetromino commented Jan 30, 2025

Note that depset.to_set() would require --incompatible_always_check_depset_elements to be enabled (which is the case by default)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 We're not considering working on this, but happy to review a PR. (No assignee) team-Rules-API API for writing rules/aspects: providers, runfiles, actions, artifacts team-Starlark-Interpreter Issues involving the Starlark interpreter used by Bazel type: feature request
Projects
None yet
Development

No branches or pull requests

1 participant