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

Advertise PyInfo provider #2506

Open
phst opened this issue Dec 15, 2024 · 1 comment
Open

Advertise PyInfo provider #2506

phst opened this issue Dec 15, 2024 · 1 comment

Comments

@phst
Copy link
Contributor

phst commented Dec 15, 2024

🚀 feature request

Relevant Rules

py_library, py_binary, py_test (basically all rules that consume Python files)

Description

Currently the rules don't advertise the PyInfo provider through the provides argument to the rule function (https://bazel.build/rules/lib/globals/bzl#rule.provides), which means that aspects that want to consume PyInfo can't use required_providers to restrict themselves to the Python rules, and instead have to apply to all rules.

Describe the solution you'd like

Add rule(..., provides = [PyInfo]) to the rule definitions, like e.g. https://github.com/bazelbuild/rules_python/blob/1.0.0/python/private/proto/py_proto_library.bzl#L237.

Describe alternatives you've considered

Current workaround is to check the actual presence of the provider in the aspect implementation function (if PyInfo in target). This works but is somewhat inefficient because the aspect implementation function needs to be evaluated for all rules, including non-Python ones.

@aignas
Copy link
Collaborator

aignas commented Dec 16, 2024

If you would like to submit a PR to start advertising them, I would gladly review it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants