compact.compaction_report

compact.compaction_report(spec, today=None)

The sediment of the spec: what could be removed, merged or has to be re-examined.

It collects the warnings of the unit and decision checks: unused depends_on entries, consumers that no longer reference their unit, evaluations no intent item uses, decisions no intent item cites and decisions past their review date.

Parameters

Name Type Description Default
spec RegenSpec The loaded spec. required
today date | None Reference date for review deadlines. Defaults to today. None

Returns

Name Type Description
list[Finding] list[Finding]: Warnings only. An empty list means nothing to compact.

Examples

from pathlib import Path
from tempfile import TemporaryDirectory

from spotregen import compaction_report, load_spec, make_sample_repo

with TemporaryDirectory() as tmp:
    root = make_sample_repo(Path(tmp) / "demo")
    print(compaction_report(load_spec(root)))
    (root / "src/samplepkg/app/main.py").write_text("print(3)\n")
    for finding in compaction_report(load_spec(root)):
        print(finding.format())
[]
WARNING DEL03   samplepkg.core.calc: consumer src/samplepkg/app/main.py no longer references the unit