cursus.step_catalog.contract_discovery¶
Contract discovery for the unified step catalog system.
Interface-first: every contract is a view onto a validated StepInterface
loaded from the step’s .step.yaml (iface.contract is a ContractSection,
a drop-in for the legacy ScriptContract/StepContract). Discovery is driven by the
registry’s canonical step names — no directory scan, no AST parse, no per-file
import. The former steps/contracts/ folder scan is gone; the registry is the
single source of “which steps exist” and load_interface is the single source of
“what each step’s contract is”.
- class ContractAutoDiscovery(package_root, workspace_dirs)[source]¶
Bases:
objectContract discovery sourced from step interfaces + the step registry.
- discover_contract_classes(project_id=None)[source]¶
Discover all step contracts from the registry + interfaces.
- Parameters:
project_id (str | None) – Optional project ID (accepted for signature stability; the registry + interface loader are the source of truth)
- Returns:
Dictionary mapping PascalCase canonical step name to its ContractSection (a view onto the step’s validated StepInterface). Steps without an interface file are skipped.
- Return type:
- find_contracts_by_entry_point(entry_point)[source]¶
Find contracts that reference a specific script entry point.
Enables script-contract alignment validation by finding the contracts associated with a given script entry point.