Skip to main content

PromiseArtifact

PromiseArtifact.as_output​

def PromiseArtifact.as_output(
) -> OutputArtifact

Returns an OutputArtifact instance, or fails if the artifact is either an Artifact, or is a bound Artifact (You cannot bind twice)


PromiseArtifact.basename​

PromiseArtifact.basename: str

The base name of this artifact. e.g. for an artifact at foo/bar, this is bar


PromiseArtifact.extension​

PromiseArtifact.extension: str

The file extension of this artifact. e.g. for an artifact at foo/bar.sh, this is .sh. If no extension is present, "" is returned.


PromiseArtifact.is_source​

PromiseArtifact.is_source: bool

Whether the artifact represents a source file


PromiseArtifact.owner​

PromiseArtifact.owner: Label | None

The Label of the rule that originally created this artifact. May also be None in the case of source files, or if the artifact has not be used in an action, or if the action was not created by a rule.


PromiseArtifact.project​

def PromiseArtifact.project(
path: str,
/,
*,
hide_prefix: bool = False,
) -> Artifact

Create an artifact that lives at path relative from this artifact.

For example, if artifact foo is a directory containing a file bar, then foo.project("bar") yields the file bar. It is possible for projected artifacts to hide the prefix in order to have the short name of the resulting artifact only contain the projected path, by passing hide_prefix = True to project().


PromiseArtifact.short_path​

PromiseArtifact.short_path: str

The interesting part of the path, relative to somewhere in the output directory. For an artifact declared as foo/bar, this is foo/bar.


PromiseArtifact.with_associated_artifacts​

def PromiseArtifact.with_associated_artifacts(
artifacts: list[Artifact],
) -> Artifact

Returns an Artifact instance which is identical to the original artifact, but with potentially additional artifacts. The artifacts must be bound.


PromiseArtifact.without_associated_artifacts​

def PromiseArtifact.without_associated_artifacts(
) -> Artifact

Returns an Artifact instance which is identical to the original artifact, except with no associated artifacts.