Python · 1377 bytes Raw Blame History
1 """`.dlm` document parsing, schema, and serialization.
2
3 The public surface is:
4
5 - `parse_file(path)` / `parse_text(text, path=None)` → `ParsedDlm`
6 - `serialize(parsed)` → canonical text form
7 - `DlmFrontmatter`, `TrainingConfig`, `ExportConfig` — Pydantic schema
8 - `Section`, `SectionType` — body section model
9 - `DlmParseError` and its subclasses — typed errors with file:line:col
10
11 The schema migration framework lives under `dlm.doc.migrations`; this
12 module's parser raises `DlmVersionError` when a document can't be
13 promoted to the current schema.
14 """
15
16 from __future__ import annotations
17
18 from dlm.doc.errors import (
19 DlmParseError,
20 DlmVersionError,
21 FenceError,
22 FrontmatterError,
23 InstructionGrammarError,
24 PreferenceGrammarError,
25 SchemaValidationError,
26 )
27 from dlm.doc.parser import ParsedDlm, parse_file, parse_text
28 from dlm.doc.schema import DlmFrontmatter, ExportConfig, TrainingConfig
29 from dlm.doc.sections import Section, SectionType
30 from dlm.doc.serializer import serialize
31
32 __all__ = [
33 "DlmFrontmatter",
34 "DlmParseError",
35 "DlmVersionError",
36 "ExportConfig",
37 "FenceError",
38 "FrontmatterError",
39 "InstructionGrammarError",
40 "ParsedDlm",
41 "PreferenceGrammarError",
42 "SchemaValidationError",
43 "Section",
44 "SectionType",
45 "TrainingConfig",
46 "parse_file",
47 "parse_text",
48 "serialize",
49 ]