Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Advertise PyInfo providerΒ #2506

Closed
Closed
@phst

Description

@phst

πŸš€ 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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions