Python · 868 bytes Raw Blame History
1 """Training-time source directives — expand frontmatter
2 `training.sources` into synthesized `Section` values.
3
4 Flow:
5
6 parsed = parse_file(dlm_path)
7 result = expand_sources(parsed, base_path=dlm_path.parent)
8 all_sections = tuple(parsed.sections) + result.sections
9 # result.provenance feeds TrainingRunSummary.source_directives
10
11 Lazy package surface — no torch / transformers import footprint, so
12 `dlm show` and tests that don't train stay fast.
13 """
14
15 from __future__ import annotations
16
17 from dlm.directives.errors import (
18 DirectiveError,
19 DirectivePathError,
20 DirectivePolicyError,
21 )
22 from dlm.directives.expand import (
23 ExpandResult,
24 SourceProvenance,
25 expand_sources,
26 )
27
28 __all__ = [
29 "DirectiveError",
30 "DirectivePathError",
31 "DirectivePolicyError",
32 "ExpandResult",
33 "SourceProvenance",
34 "expand_sources",
35 ]