spec.Architecture(
package,
source_dir,
allowed,
pace_policy,
conventions,
open_choices,
decisions,
known_cycles,
scan_dirs,
doc_globs,
kb_dir,
source,
)
The compilation target every regenerated module must fit into.
Attributes
| package |
str |
Top-level package name ("samplepkg"). |
| source_dir |
str |
Repository-relative directory that holds the package. |
| allowed |
dict[str, tuple[str, …]] |
For every subpackage (or top-level module) of the package, the subpackages it may import. |
| pace_policy |
dict[str, str] |
For every pace, the verification a change at that pace needs. |
| conventions |
tuple[str, …] |
Rules every implementation follows (formatting, docstrings, …). |
| open_choices |
tuple[str, …] |
Implementation choices deliberately left to the generator. |
| decisions |
tuple[str, …] |
Ids of provenance records behind the architecture itself. |
| known_cycles |
tuple[tuple[str, str], …] |
Accepted import cycles between subpackages, each a sorted pair. A cycle that is not listed fails the check (ARCH04). |
| scan_dirs |
tuple[str, …] |
Directories whose Python files count as consumers. |
| doc_globs |
tuple[str, …] |
Glob patterns (relative to the root) of documents whose text counts as a consumer, for example "docs/**/*.qmd". |
| kb_dir |
str |
Directory of the project’s knowledge-base entries (KB: evidence). REGEN_KB_DIR overrides it. Evidence is checked only if it exists. |
| source |
Path |
Path of architecture.toml. |
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"))
arch = spec.architecture
print(arch.package, arch.source_dir, arch.allowed["app"])