You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
The text was updated successfully, but these errors were encountered:
🚀 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 therule
function (https://bazel.build/rules/lib/globals/bzl#rule.provides), which means that aspects that want to consume PyInfo can't userequired_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.The text was updated successfully, but these errors were encountered: