Step¶
- class selene_core.build_utils.types.Step(input_kind: type[ArtifactKind], output_kind: type[ArtifactKind])¶
A Step describes a single step in a build process, i.e. a transformation to an input ArtifactKind to an output ArtifactKind. It has an associated ‘cost’, which may depend on some user-provided build context or the current platform.
The Build Planner (see planner.py) uses the costing of each step to determine the optimal path from an input artifact to a final selene executable. Thus the cost of a step can be customised to prioritize or penalize a particular path in chosen circumstances.
- __eq__(other)¶
Return self==value.
- __hash__ = None¶
- __init__(input_kind: type[ArtifactKind], output_kind: type[ArtifactKind]) None¶
- __repr__()¶
Return repr(self).
- classmethod apply(build_ctx: BuildCtx, input_artifact: Artifact) Artifact[OutputKind]¶
Convert the input artifact to the output artifact.
- classmethod get_cost(build_ctx: BuildCtx) float¶
When planning a build sequence, the path of minimal (cumulative) cost is chosen. This class method returns the ‘cost’ of this step, given the current build context and artifact. Use the context provided to decide whether a step should be prioritised by giving it a low cost, penalised by giving it a high cost, or ruled out entirely by giving it float(‘inf’).
For example, say you have two similar steps that offer a choice, such as compiling an IR to LLVM bitcode or to LLVM IR (text). You can use the build_ctx to accept user input to select between the two, providing a default (unequal) cost to prioritise a default route.
Negative costs are not permitted.
- input_kind: type[ArtifactKind]¶
- output_kind: type[ArtifactKind]¶