Python API¶
The public API is exported by state_mate.
load_statechart(source)¶
load_statechart(source: str | pathlib.Path) -> sismic.model.Statechart
Loads a YAML statechart using sismic.io.import_from_yaml(), validates the State Mate subset, and returns Sismic's original Statechart object.
Raises SismicSubsetError when Sismic cannot be imported, the document cannot be loaded, or the model contains unsupported constructs.
validate_supported_subset(statechart)¶
validate_supported_subset(statechart: sismic.model.Statechart) -> None
Validates that a Sismic statechart can be mapped to the generated python-statemachine representation without intentionally dropping semantics.
Raises SismicSubsetError on failure.
render(statechart)¶
render(statechart: sismic.model.Statechart) -> str
Renders Python source from a Sismic Statechart using the packaged Jinja2 template.
The renderer derives Python names, groups transitions by event, identifies final states, and produces the final module text.
Raises ValueError when distinct Sismic names collide after conversion to valid Python identifiers.
SismicSubsetError¶
class SismicSubsetError(ValueError):
...
Indicates that a statechart cannot be imported for State Mate's purposes or is valid Sismic but outside the supported generation subset.