spec.Unit(
name,
path,
summary,
pace,
risk,
public,
depends_on,
evaluations,
unit_tests,
intent,
consumers,
source,
)
A regenerable unit: one module plus the knowledge needed to rebuild it.
Attributes
| name |
str |
Dotted module name, for example "samplepkg.core.calc". |
| path |
str |
Repository-relative path of the implementation. |
| summary |
str |
One-paragraph purpose of the unit. |
| pace |
str |
fast, medium or slow, see [pace] in architecture.toml. |
| risk |
str |
low, medium or high; decides how much verification a regeneration needs. |
| public |
tuple[str, …] |
Public names the unit must define (its contract). |
| depends_on |
tuple[str, …] |
Modules of the package the unit may import. |
| evaluations |
tuple[str, …] |
Repository-relative paths of the durable evaluation files. |
| unit_tests |
tuple[str, …] |
Repository-relative paths of the implementation-coupled tests (the ephemeral layer, regenerated with the code). |
| intent |
tuple[IntentItem, …] |
The intent items. |
| consumers |
tuple[Consumer, …] |
Known dependents. |
| source |
Path |
Path of the TOML file the unit was read from. |
Examples
from pathlib import Path
from tempfile import TemporaryDirectory
from spotregen import load_spec, make_sample_repo
with TemporaryDirectory() as tmp:
spec = load_spec(make_sample_repo(Path(tmp) / "demo"))
unit = spec.units["samplepkg.core.calc"]
print(unit.name, unit.pace, unit.risk, unit.public)
samplepkg.core.calc fast low ('add',)