//python/api:api.bzl

Public, analysis phase APIs for Python rules.

To use the analyis-time API, add the attributes to your rule, thenusepy_common.get() to get the api object:

load("@rules_python//python/api:api.bzl","py_common")def_impl(ctx):py_api=py_common.get(ctx)myrule=rule(implementation=_impl,attrs={...}|py_common.API_ATTRS)

Added in version 0.37.0.

typedefpy_common

Typedef for py_common.

py_common.API_ATTRS:dict[str,Attribute]

The attributes that rules must have forpy_common.get() to work.

py_common.get(ctx)

Get the py_common API instance.

NOTE: to use this function, the rule must have addedpy_common.API_ATTRSto its attributes.

Args:
Returns:

PyCommonApi