Skip to main content

lazy_attrs type

The context for getting attrs lazily on a target_node.

lazy_attrs.get

def lazy_attrs.get(attr: str) -> None | configured_attr

Gets a single attribute. Returns an optional [configured_attr].

def _impl_attrs_lazy(ctx): node = ctx.cquery().owner("cell//path/to/TARGETS")[0] attrs = node.attrs_lazy() # cache once ctx.output.print(attrs.get("some_attributes").value()) ctx.output.print(attrs.get("some_attribute").label)