Stage

Note

This page is a reference documentation. It only explains the class signature, and not how to use it. Please refer to the Habitat Guide and Python API guide (v2.0) for usage.

class Stage(name: str, component: Spec, role: str | None = None)[source]

Bases: object

One named step in a habitat dataflow.

name

Custom label unique within the enclosing HabitatSpec. Defaults to the component registry name when built via of().

Type:

str

component

The pluggable component specification.

Type:

habit.spec.specs.Spec

role

Optional override for scientific role. Leave None for user-authored stages – domain code infers the role from position + registry domain. Sugar expansion and dual-domain disambiguation may set this explicitly; it is not required API.

Type:

str | None

__post_init__() → None[source]

Validate name / component types.

classmethod of(component: Spec | Mapping[str, Any], name: str | None = None, role: str | None = None) → Stage[source]

Build a stage, defaulting name to the component registry name.

Parameters:
  • component – Component spec or mapping.

  • name – Optional custom label.

  • role – Optional role override (escape hatch). Prefer omitting this and letting resolve_habitat_stages infer the role.

Returns:

The stage.

to_dict() → Dict[str, Any][source]

Serialise for YAML / fingerprint payloads.

classmethod from_dict(payload: Mapping[str, Any]) → Stage[source]

Rebuild a stage from its dict form.

Parameters:

payload – Mapping with name + component, or a bare Spec mapping with optional stage_name.

Returns:

The reconstructed stage.

__init__(name: str, component: Spec, role: str | None = None) → None

Examples using habit.spec.Stage

Quickstart: Python API

Quickstart: Python API