Skip to main content

Dependency

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

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.