cursus.steps.interfaces

Step Interface Loader

Loads unified .step.yaml files and emits a single validated StepInterface object. This is the single entry point for all step interface data. The former per-step steps/specs/ and steps/contracts/ folders are gone — the .step.yaml here is the sole source, and its contract/spec sections are views onto one aligned object.

For backward compatibility, load_step_interface still returns a 2-tuple that destructures as (contract, spec):

  • contract is the StepInterface’s ContractSection — a drop-in for the legacy ScriptContract/StepContract (exposes expected_input_paths etc.).

  • spec is the StepInterface itself — a drop-in for the legacy StepSpecification (exposes dependencies/outputs/get_output_by_name_or_alias/ script_contract/…).

Both elements are views onto the same validated StepInterface. Use load_interface(...) to get the StepInterface directly.

Usage:

from cursus.steps.interfaces import load_step_interface, load_interface

contract, spec = load_step_interface(“TabularPreprocessing”) iface = load_interface(“CradleDataLoading”, job_type=”calibration”)

register_pack_interface_dir(interfaces_dir)[source]

Register an external step-pack interfaces/ dir for interface resolution (add-only).

Searched AFTER the package dir, so package interfaces are never shadowed unless a pack deliberately ships the same name. Registering a NEW dir invalidates the interface cache so a pack step’s interface is picked up. Idempotent; None/missing dirs are ignored.

load_interface(step_name, job_type=None)[source]

Load a step’s unified interface from YAML as a single StepInterface.

Parameters:
  • step_name (str) – PascalCase step name (e.g., “TabularPreprocessing”, “CradleDataLoading”)

  • job_type (str | None) – Optional job_type variant (e.g., “training”, “calibration”)

Returns:

Validated StepInterface (variant-resolved when job_type is given).

Return type:

StepInterface

load_step_interface(step_name, job_type=None)[source]

Backward-compatible loader returning a (contract, spec) tuple.

Both elements are views onto one validated StepInterface: - [0] = the ContractSection (ScriptContract/StepContract drop-in) - [1] = the StepInterface (StepSpecification drop-in)

New code should prefer load_interface().

list_available_interfaces()[source]

List all available step interface names (package + registered packs).

clear_interface_cache()[source]

Clear the in-process interface cache.

Interfaces are cached by step_name:job_type for the life of the process. This helper lets tests and dev hot-reload pick up edited .step.yaml files without a restart (long-running processes otherwise serve stale interface data).

Modules

io_view

Per-step connection / I-O view (FZ 31e1d3d / 31e1d3b1 follow-up).