Skip to main content

spec.load_spec

spec.load_spec(root)

Read the whole regen/ tree below root.

Parameters

Name Type Description Default
root Path | str Repository root (the directory that holds regen/). required

Returns

Name Type Description
RegenSpec RegenSpec Architecture, units and decisions.

Raises

Name Type Description
SpecError If any file is malformed or holds a key outside the schema.
FileNotFoundError If regen/architecture.toml does not exist.

Examples

from pathlib import Path
from tempfile import TemporaryDirectory

from babregen import load_spec, make_sample_repo

with TemporaryDirectory() as tmp:
    spec = load_spec(make_sample_repo(Path(tmp) / "demo"))
    print(len(spec.units), "unit,", len(spec.decisions), "decision")
1 unit, 1 decision