Skip to main content

dependency type

Dependency type. In Starlark typing it can be represented with Dependency global.

dependency.get

def dependency.get(index) -> None | provider

Gets a provider by indexing on a ProviderCallable object.

e.g.

FooInfo = provider(fields=["bar"])
....
collection.get(FooInfo) # None if absent, a FooInfo instance if present

dependency.label

dependency.label: label

dependency.providers

dependency.providers: list[typing.Any]

dependency.sub_target

def dependency.sub_target(subtarget: str, /) -> dependency

Obtain the dependency representing a subtarget. In most cases you will want to use x[DefaultInfo].sub_targets["foo"] to get the providers of the subtarget, but if you need a real Dependency type (e.g. for use with ctx.action.anon_target) then use this method.