API Reference
The API reference is rendered from Python source.
Package
se_theory_reference_kit
se_theory_reference_kit package.
base
base/init.py - Shared base utilities for theory-reference tooling.
ArtifactLoadError
Bases: ReferenceKitError
Raised when a reference artifact cannot be loaded.
Source code in src/se_theory_reference_kit/base/errors.py
16 17 | |
CheckResult
dataclass
One validation finding emitted by one check.
Attributes:
| Name | Type | Description |
|---|---|---|
check_id |
str
|
Stable id of the check that emitted the finding. |
status |
CheckStatus
|
Check status. |
severity |
CheckSeverity
|
Finding severity. |
message |
str
|
Human-readable finding message. |
artifact_id |
str | None
|
Optional artifact id associated with the finding. |
path |
Path | None
|
Optional path associated with the finding. |
detail |
JsonDetail
|
Optional structured detail for reports or downstream tooling. |
Source code in src/se_theory_reference_kit/base/results.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | |
CheckSeverity
Bases: StrEnum
Severity vocabulary for one validation finding.
Source code in src/se_theory_reference_kit/base/results.py
38 39 40 41 42 43 | |
CheckStatus
Bases: StrEnum
Status vocabulary for one validation finding.
Source code in src/se_theory_reference_kit/base/results.py
29 30 31 32 33 34 35 | |
ConfigurationError
Bases: ReferenceKitError
Raised when repo-provided reference configuration is invalid.
Source code in src/se_theory_reference_kit/base/errors.py
12 13 | |
ReferenceKitError
Bases: Exception
Base exception for theory-reference-kit failures.
Source code in src/se_theory_reference_kit/base/errors.py
4 5 | |
RepositoryRootError
Bases: ReferenceKitError
Raised when a repository root cannot be resolved.
Source code in src/se_theory_reference_kit/base/errors.py
8 9 | |
cannot_verify
cannot_verify(
check_id: str,
message: str,
*,
artifact_id: str | None = None,
path: Path | None = None,
detail: JsonDetail | None = None,
) -> CheckResult
Create a cannot-verify result.
Source code in src/se_theory_reference_kit/base/results.py
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | |
failure
failure(
check_id: str,
message: str,
*,
artifact_id: str | None = None,
path: Path | None = None,
detail: JsonDetail | None = None,
) -> CheckResult
Create an error failure result.
Source code in src/se_theory_reference_kit/base/results.py
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | |
find_repository_root
find_repository_root(start: Path | None = None) -> Path
Find the nearest repository root from a starting path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
start
|
Path | None
|
Starting path. Defaults to the current working directory. |
None
|
Returns:
| Type | Description |
|---|---|
Path
|
Resolved repository root path. |
Raises:
| Type | Description |
|---|---|
RepositoryRootError
|
If no repository root marker is found. |
Source code in src/se_theory_reference_kit/base/paths.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | |
lean_module_to_path
lean_module_to_path(
module: str,
*,
root: Path | None = None,
lean_public_root: str,
) -> Path
Resolve a Lean module name to its repository source path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
module
|
str
|
Lean module name. |
required |
root
|
Path | None
|
Repository root. |
None
|
lean_public_root
|
str
|
Expected public Lean root for the owning repository. |
required |
Returns:
| Type | Description |
|---|---|
Path
|
Repository-contained Lean source path. |
Raises:
| Type | Description |
|---|---|
PathResolutionError
|
If the module name is empty, path-like, malformed, or outside the declared public Lean root. |
Source code in src/se_theory_reference_kit/base/paths.py
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | |
ok
ok(
check_id: str,
message: str,
*,
artifact_id: str | None = None,
path: Path | None = None,
detail: JsonDetail | None = None,
) -> CheckResult
Create an ok result.
Source code in src/se_theory_reference_kit/base/results.py
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | |
partial
partial(
check_id: str,
message: str,
*,
artifact_id: str | None = None,
path: Path | None = None,
detail: JsonDetail | None = None,
) -> CheckResult
Create a partial result.
Source code in src/se_theory_reference_kit/base/results.py
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | |
reference_artifact_path
reference_artifact_path(
path: str | Path,
*,
root: Path | None = None,
reference_dir_name: str = "reference",
) -> Path
Resolve a declared reference artifact path.
The declared path must be repository-relative and under the reference directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | Path
|
Declared repository-relative artifact path. |
required |
root
|
Path | None
|
Repository root. |
None
|
reference_dir_name
|
str
|
Name of the reference artifact directory. |
'reference'
|
Returns:
| Type | Description |
|---|---|
Path
|
Resolved reference artifact path. |
Raises:
| Type | Description |
|---|---|
PathResolutionError
|
If the path is outside the reference directory. |
Source code in src/se_theory_reference_kit/base/paths.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | |
reference_dir
reference_dir(
*,
root: Path | None = None,
reference_dir_name: str = "reference",
) -> Path
Return the repository reference directory.
Source code in src/se_theory_reference_kit/base/paths.py
63 64 65 66 67 68 69 | |
resolve_repo_path
resolve_repo_path(
path: str | Path, *, root: Path | None = None
) -> Path
Resolve a path as repository-relative and contained within the repository.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | Path
|
Repository-relative path. |
required |
root
|
Path | None
|
Repository root. Defaults to nearest detected repository root. |
None
|
Returns:
| Type | Description |
|---|---|
Path
|
Resolved absolute path. |
Raises:
| Type | Description |
|---|---|
PathResolutionError
|
If the path escapes the repository root. |
Source code in src/se_theory_reference_kit/base/paths.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | |
warning
warning(
check_id: str,
message: str,
*,
artifact_id: str | None = None,
path: Path | None = None,
detail: JsonDetail | None = None,
) -> CheckResult
Create a warning failure result.
Source code in src/se_theory_reference_kit/base/results.py
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | |
worst_status
worst_status(results: Iterable[CheckResult]) -> CheckStatus
Return the worst status across validation results.
Source code in src/se_theory_reference_kit/base/results.py
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | |
errors
base/errors.py - Exception types for theory-reference tooling.
ArtifactLoadError
Bases: ReferenceKitError
Raised when a reference artifact cannot be loaded.
Source code in src/se_theory_reference_kit/base/errors.py
16 17 | |
ArtifactWriteError
Bases: ReferenceKitError
Raised when a reference artifact cannot be written.
Source code in src/se_theory_reference_kit/base/errors.py
20 21 | |
ConfigurationError
Bases: ReferenceKitError
Raised when repo-provided reference configuration is invalid.
Source code in src/se_theory_reference_kit/base/errors.py
12 13 | |
PathResolutionError
Bases: ReferenceKitError
Raised when a repository-relative path is invalid.
Source code in src/se_theory_reference_kit/base/errors.py
24 25 | |
ReferenceKitError
Bases: Exception
Base exception for theory-reference-kit failures.
Source code in src/se_theory_reference_kit/base/errors.py
4 5 | |
RepositoryRootError
Bases: ReferenceKitError
Raised when a repository root cannot be resolved.
Source code in src/se_theory_reference_kit/base/errors.py
8 9 | |
io
base/io.py - UTF-8 text and TOML loading helpers.
load_toml
load_toml(path: Path) -> TomlDocument
Load a TOML file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path
|
TOML file path. |
required |
Returns:
| Type | Description |
|---|---|
TomlDocument
|
Parsed TOML document. |
Raises:
| Type | Description |
|---|---|
ArtifactLoadError
|
If the file cannot be read or parsed. |
Source code in src/se_theory_reference_kit/base/io.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | |
read_text
read_text(path: Path) -> str
Read a UTF-8 text file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path
|
File path. |
required |
Returns:
| Type | Description |
|---|---|
str
|
File contents. |
Raises:
| Type | Description |
|---|---|
ArtifactLoadError
|
If the file cannot be read. |
Source code in src/se_theory_reference_kit/base/io.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | |
write_text
write_text(path: Path, content: str) -> None
Write a UTF-8 text file, creating parent directories if needed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path
|
Output path. |
required |
content
|
str
|
Text content. |
required |
Raises:
| Type | Description |
|---|---|
ArtifactWriteError
|
If the file cannot be written. |
Source code in src/se_theory_reference_kit/base/io.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | |
json_utils
base/json_utils.py - Deterministic JSON helpers.
encode_json
encode_json(payload: JsonObject) -> str
Encode a JSON payload deterministically.
The payload builder owns ordering. This encoder preserves insertion order rather than sorting keys.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
payload
|
JsonObject
|
JSON-compatible object. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Encoded JSON text ending with a newline. |
Source code in src/se_theory_reference_kit/base/json_utils.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | |
write_or_check_json
write_or_check_json(
path: Path, payload: JsonObject, *, check: bool
) -> bool
Write a JSON payload or check whether the file is current.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path
|
Output path. |
required |
payload
|
JsonObject
|
JSON payload. |
required |
check
|
bool
|
If true, check freshness without writing. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True when current or written, otherwise false. |
Source code in src/se_theory_reference_kit/base/json_utils.py
67 68 69 70 71 72 73 74 75 76 77 78 | |
write_or_check_text
write_or_check_text(
path: Path, content: str, *, check: bool
) -> bool
Write a file or check whether it is current.
Returns true when the file is current or was written. Returns false when check mode finds stale content.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path
|
Output path. |
required |
content
|
str
|
Expected file content. |
required |
check
|
bool
|
If true, check freshness without writing. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True when current or written, otherwise false. |
Source code in src/se_theory_reference_kit/base/json_utils.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | |
paths
base/paths.py - Repository-relative path helpers.
find_repository_root
find_repository_root(start: Path | None = None) -> Path
Find the nearest repository root from a starting path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
start
|
Path | None
|
Starting path. Defaults to the current working directory. |
None
|
Returns:
| Type | Description |
|---|---|
Path
|
Resolved repository root path. |
Raises:
| Type | Description |
|---|---|
RepositoryRootError
|
If no repository root marker is found. |
Source code in src/se_theory_reference_kit/base/paths.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | |
lean_module_to_path
lean_module_to_path(
module: str,
*,
root: Path | None = None,
lean_public_root: str,
) -> Path
Resolve a Lean module name to its repository source path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
module
|
str
|
Lean module name. |
required |
root
|
Path | None
|
Repository root. |
None
|
lean_public_root
|
str
|
Expected public Lean root for the owning repository. |
required |
Returns:
| Type | Description |
|---|---|
Path
|
Repository-contained Lean source path. |
Raises:
| Type | Description |
|---|---|
PathResolutionError
|
If the module name is empty, path-like, malformed, or outside the declared public Lean root. |
Source code in src/se_theory_reference_kit/base/paths.py
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | |
reference_artifact_path
reference_artifact_path(
path: str | Path,
*,
root: Path | None = None,
reference_dir_name: str = "reference",
) -> Path
Resolve a declared reference artifact path.
The declared path must be repository-relative and under the reference directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | Path
|
Declared repository-relative artifact path. |
required |
root
|
Path | None
|
Repository root. |
None
|
reference_dir_name
|
str
|
Name of the reference artifact directory. |
'reference'
|
Returns:
| Type | Description |
|---|---|
Path
|
Resolved reference artifact path. |
Raises:
| Type | Description |
|---|---|
PathResolutionError
|
If the path is outside the reference directory. |
Source code in src/se_theory_reference_kit/base/paths.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | |
reference_dir
reference_dir(
*,
root: Path | None = None,
reference_dir_name: str = "reference",
) -> Path
Return the repository reference directory.
Source code in src/se_theory_reference_kit/base/paths.py
63 64 65 66 67 68 69 | |
repo_relative_path
repo_relative_path(path: Path, repo_root: Path) -> str
Return a repository-relative POSIX path.
Source code in src/se_theory_reference_kit/base/paths.py
155 156 157 | |
resolve_repo_path
resolve_repo_path(
path: str | Path, *, root: Path | None = None
) -> Path
Resolve a path as repository-relative and contained within the repository.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | Path
|
Repository-relative path. |
required |
root
|
Path | None
|
Repository root. Defaults to nearest detected repository root. |
None
|
Returns:
| Type | Description |
|---|---|
Path
|
Resolved absolute path. |
Raises:
| Type | Description |
|---|---|
PathResolutionError
|
If the path escapes the repository root. |
Source code in src/se_theory_reference_kit/base/paths.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | |
results
validation/results.py - Result vocabulary for theory-reference checks.
CheckResult
dataclass
One validation finding emitted by one check.
Attributes:
| Name | Type | Description |
|---|---|---|
check_id |
str
|
Stable id of the check that emitted the finding. |
status |
CheckStatus
|
Check status. |
severity |
CheckSeverity
|
Finding severity. |
message |
str
|
Human-readable finding message. |
artifact_id |
str | None
|
Optional artifact id associated with the finding. |
path |
Path | None
|
Optional path associated with the finding. |
detail |
JsonDetail
|
Optional structured detail for reports or downstream tooling. |
Source code in src/se_theory_reference_kit/base/results.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | |
CheckSeverity
Bases: StrEnum
Severity vocabulary for one validation finding.
Source code in src/se_theory_reference_kit/base/results.py
38 39 40 41 42 43 | |
CheckStatus
Bases: StrEnum
Status vocabulary for one validation finding.
Source code in src/se_theory_reference_kit/base/results.py
29 30 31 32 33 34 35 | |
cannot_verify
cannot_verify(
check_id: str,
message: str,
*,
artifact_id: str | None = None,
path: Path | None = None,
detail: JsonDetail | None = None,
) -> CheckResult
Create a cannot-verify result.
Source code in src/se_theory_reference_kit/base/results.py
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | |
empty_detail
empty_detail() -> JsonDetail
Return an empty result detail dictionary.
Source code in src/se_theory_reference_kit/base/results.py
24 25 26 | |
failure
failure(
check_id: str,
message: str,
*,
artifact_id: str | None = None,
path: Path | None = None,
detail: JsonDetail | None = None,
) -> CheckResult
Create an error failure result.
Source code in src/se_theory_reference_kit/base/results.py
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | |
ok
ok(
check_id: str,
message: str,
*,
artifact_id: str | None = None,
path: Path | None = None,
detail: JsonDetail | None = None,
) -> CheckResult
Create an ok result.
Source code in src/se_theory_reference_kit/base/results.py
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | |
partial
partial(
check_id: str,
message: str,
*,
artifact_id: str | None = None,
path: Path | None = None,
detail: JsonDetail | None = None,
) -> CheckResult
Create a partial result.
Source code in src/se_theory_reference_kit/base/results.py
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | |
warning
warning(
check_id: str,
message: str,
*,
artifact_id: str | None = None,
path: Path | None = None,
detail: JsonDetail | None = None,
) -> CheckResult
Create a warning failure result.
Source code in src/se_theory_reference_kit/base/results.py
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | |
worst_status
worst_status(results: Iterable[CheckResult]) -> CheckStatus
Return the worst status across validation results.
Source code in src/se_theory_reference_kit/base/results.py
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | |
cli
cli.py - Console entry point for se-theory-reference.
main
main(argv: Sequence[str] | None = None) -> int
Run the combined command-line interface.
Source code in src/se_theory_reference_kit/commands/root.py
38 39 40 41 42 43 44 45 46 47 48 | |
commands
Command implementations for cli.
catalog
commands/catalog.py - Reference catalog command.
configure_catalog_parser
configure_catalog_parser(
subparsers: _SubParsersAction[Any],
) -> None
Configure the catalog subcommand.
Source code in src/se_theory_reference_kit/commands/catalog.py
13 14 15 16 17 18 19 20 21 22 23 24 | |
run_catalog_command
run_catalog_command(args: Namespace) -> int
Run generated catalog export or freshness check.
Source code in src/se_theory_reference_kit/commands/catalog.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | |
export
commands/export.py - Generated export command.
configure_export_parser
configure_export_parser(
subparsers: _SubParsersAction[Any],
) -> None
Configure the export subcommand.
Source code in src/se_theory_reference_kit/commands/export.py
12 13 14 15 16 17 18 19 20 21 22 23 | |
run_export_command
run_export_command(args: Namespace) -> int
Run generated export or export freshness check.
Source code in src/se_theory_reference_kit/commands/export.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | |
inspect
commands/inspect.py - Inspect resolved theory-reference declarations.
configure_inspect_parser
configure_inspect_parser(
subparsers: _SubParsersAction[Any],
) -> None
Configure the inspect subcommand.
Source code in src/se_theory_reference_kit/commands/inspect.py
11 12 13 14 15 16 17 | |
run_inspect_command
run_inspect_command(args: Namespace) -> int
Inspect the resolved command context.
Source code in src/se_theory_reference_kit/commands/inspect.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | |
root
commands/root.py - Root command dispatcher for se-theory-reference.
build_parser
build_parser() -> ArgumentParser
Build the root argument parser.
Source code in src/se_theory_reference_kit/commands/root.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | |
main
main(argv: Sequence[str] | None = None) -> int
Run the combined command-line interface.
Source code in src/se_theory_reference_kit/commands/root.py
38 39 40 41 42 43 44 45 46 47 48 | |
scaffold
commands/scaffold.py - Reference scaffold command.
configure_scaffold_parser
configure_scaffold_parser(
subparsers: _SubParsersAction[Any],
) -> None
Configure the scaffold subcommand.
Source code in src/se_theory_reference_kit/commands/scaffold.py
10 11 12 13 14 15 16 17 18 | |
run_scaffold_command
run_scaffold_command(args: Namespace) -> int
Run reference scaffolding.
Source code in src/se_theory_reference_kit/commands/scaffold.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | |
validate
commands/validate.py - Validation command.
configure_validate_parser
configure_validate_parser(
subparsers: _SubParsersAction[Any],
) -> None
Configure the validate subcommand.
Source code in src/se_theory_reference_kit/commands/validate.py
13 14 15 16 17 18 19 20 21 22 23 24 | |
run_validate_command
run_validate_command(args: Namespace) -> int
Run validation checks.
Source code in src/se_theory_reference_kit/commands/validate.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | |
declarations
declarations/init.py - Typed declarations consumed by the generic engine.
ExportSpec
dataclass
A generated JSON artifact export specification.
Source code in src/se_theory_reference_kit/declarations/export_spec.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | |
specs_from_toml
classmethod
specs_from_toml(
data: Mapping[str, object],
) -> tuple[Self, ...]
Build export specs by joining [surface_kinds] and [export_map].
Kit-owned convention for each non-catalog kind present in both maps
source_table = kind payload_key = kind schema = f"se-theory-{artifact_slug}-{kind}-registry"
Source code in src/se_theory_reference_kit/declarations/export_spec.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | |
SurfaceSymbols
dataclass
Kinded public Lean surface symbols for one theory repository.
Source code in src/se_theory_reference_kit/declarations/surface.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | |
all_symbols
property
all_symbols: frozenset[str]
Return all declared public surface symbols.
from_optional_kinds
classmethod
from_optional_kinds(
*,
types: frozenset[str] = EMPTY_STRING_SET,
predicates: frozenset[str] = EMPTY_STRING_SET,
axioms: frozenset[str] = EMPTY_STRING_SET,
theorems: frozenset[str] = EMPTY_STRING_SET,
requirements: frozenset[str] = EMPTY_STRING_SET,
vocabulary: frozenset[str] = EMPTY_STRING_SET,
witnesses: frozenset[str] = EMPTY_STRING_SET,
) -> Self
Build a surface declaration from common optional surface kinds.
Source code in src/se_theory_reference_kit/declarations/surface.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | |
symbols_for_kind
symbols_for_kind(kind: str) -> frozenset[str]
Return public symbols for one surface kind.
Source code in src/se_theory_reference_kit/declarations/surface.py
19 20 21 | |
TheoryReferenceConfig
dataclass
Repository-specific configuration consumed by the generic engine.
Source code in src/se_theory_reference_kit/declarations/config.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | |
from_toml
classmethod
from_toml(data: Mapping[str, object]) -> Self
Build configuration from a parsed theory-reference.toml mapping.
Source code in src/se_theory_reference_kit/declarations/config.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | |
config
declarations/config.py - Repository-specific configuration model.
TheoryReferenceConfig
dataclass
Repository-specific configuration consumed by the generic engine.
Source code in src/se_theory_reference_kit/declarations/config.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | |
from_toml
classmethod
from_toml(data: Mapping[str, object]) -> Self
Build configuration from a parsed theory-reference.toml mapping.
Source code in src/se_theory_reference_kit/declarations/config.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | |
export_spec
declarations/export_spec.py - Repo-owned generated export specification shape.
ExportSpec
dataclass
A generated JSON artifact export specification.
Source code in src/se_theory_reference_kit/declarations/export_spec.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | |
specs_from_toml
classmethod
specs_from_toml(
data: Mapping[str, object],
) -> tuple[Self, ...]
Build export specs by joining [surface_kinds] and [export_map].
Kit-owned convention for each non-catalog kind present in both maps
source_table = kind payload_key = kind schema = f"se-theory-{artifact_slug}-{kind}-registry"
Source code in src/se_theory_reference_kit/declarations/export_spec.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | |
surface
declarations/surface.py - Repo-owned Lean public surface declaration shape.
SurfaceSymbols
dataclass
Kinded public Lean surface symbols for one theory repository.
Source code in src/se_theory_reference_kit/declarations/surface.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | |
all_symbols
property
all_symbols: frozenset[str]
Return all declared public surface symbols.
from_optional_kinds
classmethod
from_optional_kinds(
*,
types: frozenset[str] = EMPTY_STRING_SET,
predicates: frozenset[str] = EMPTY_STRING_SET,
axioms: frozenset[str] = EMPTY_STRING_SET,
theorems: frozenset[str] = EMPTY_STRING_SET,
requirements: frozenset[str] = EMPTY_STRING_SET,
vocabulary: frozenset[str] = EMPTY_STRING_SET,
witnesses: frozenset[str] = EMPTY_STRING_SET,
) -> Self
Build a surface declaration from common optional surface kinds.
Source code in src/se_theory_reference_kit/declarations/surface.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | |
symbols_for_kind
symbols_for_kind(kind: str) -> frozenset[str]
Return public symbols for one surface kind.
Source code in src/se_theory_reference_kit/declarations/surface.py
19 20 21 | |
export
export/init.py - Generic generated export helpers.
CatalogEntry
dataclass
Generic catalog entry for one loaded reference artifact.
Source code in src/se_theory_reference_kit/export/catalog.py
13 14 15 16 17 18 19 | |
ExportResult
dataclass
Result of one generated export operation.
Attributes:
| Name | Type | Description |
|---|---|---|
output_path |
Path
|
Generated output path. |
current |
bool
|
True when output is current or was written. |
wrote |
bool
|
True when output was written. |
checked |
bool
|
True when the operation ran in check mode. |
Source code in src/se_theory_reference_kit/export/engine.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | |
build_reference_catalog
build_reference_catalog(
*,
registry: ReferenceRegistry,
repo_root: Path,
schema: str,
source: str,
namespace: str,
artifact: str,
) -> JsonObject
Build a generic reference catalog from loaded reference artifacts.
This function builds the common catalog envelope and reference path list. Repo-specific catalog payload sections remain owned by the theory repo.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
registry
|
ReferenceRegistry
|
Loaded reference registry. |
required |
repo_root
|
Path
|
Repository root used to produce portable relative paths. |
required |
schema
|
str
|
Catalog schema id. |
required |
source
|
str
|
Owning repository slug. |
required |
namespace
|
str
|
Reference namespace. |
required |
artifact
|
str
|
Catalog artifact name. |
required |
Returns:
| Type | Description |
|---|---|
JsonObject
|
JSON-compatible catalog payload. |
Source code in src/se_theory_reference_kit/export/catalog.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | |
build_registry_payload
build_registry_payload(
*,
spec: ExportSpec,
document: ReferenceDocument,
source_path: Path,
repo_root: Path,
repo_slug: str,
reference_namespace: str,
) -> JsonObject
Build one generated registry payload from one reference artifact.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spec
|
ExportSpec
|
Repo-owned export specification. |
required |
document
|
ReferenceDocument
|
Parsed reference artifact. |
required |
source_path
|
Path
|
Source reference artifact path. |
required |
repo_root
|
Path
|
Repository root used to produce portable relative paths. |
required |
repo_slug
|
str
|
Owning repository slug. |
required |
reference_namespace
|
str
|
Reference namespace for generated payloads. |
required |
Returns:
| Type | Description |
|---|---|
JsonObject
|
JSON-compatible generated registry payload. |
Source code in src/se_theory_reference_kit/export/engine.py
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | |
export_registries
export_registries(
*,
specs: tuple[ExportSpec, ...],
registry: ReferenceRegistry,
repo_root: Path,
reference_root: Path,
output_root: Path,
repo_slug: str,
reference_namespace: str,
check: bool,
) -> tuple[ExportResult, ...]
Export generated registry JSON artifacts.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
specs
|
tuple[ExportSpec, ...]
|
Repo-owned export specifications. |
required |
registry
|
ReferenceRegistry
|
Loaded reference registry. |
required |
repo_root
|
Path
|
Repository root used to produce portable relative paths. |
required |
reference_root
|
Path
|
Reference artifact root. |
required |
output_root
|
Path
|
Generated output root. |
required |
repo_slug
|
str
|
Owning repository slug. |
required |
reference_namespace
|
str
|
Reference namespace. |
required |
check
|
bool
|
If true, check freshness without writing. |
required |
Returns:
| Type | Description |
|---|---|
tuple[ExportResult, ...]
|
Export results. |
Source code in src/se_theory_reference_kit/export/engine.py
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 | |
export_registry
export_registry(
*,
spec: ExportSpec,
registry: ReferenceRegistry,
repo_root: Path,
reference_root: Path,
output_root: Path,
repo_slug: str,
reference_namespace: str,
check: bool,
) -> ExportResult
Export one registry JSON artifact.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spec
|
ExportSpec
|
Repo-owned export specification. |
required |
registry
|
ReferenceRegistry
|
Loaded reference registry. |
required |
repo_root
|
Path
|
Repository root used to produce portable relative paths. |
required |
reference_root
|
Path
|
Reference artifact root used to locate source artifacts. |
required |
output_root
|
Path
|
Generated output root. |
required |
repo_slug
|
str
|
Owning repository slug. |
required |
reference_namespace
|
str
|
Reference namespace. |
required |
check
|
bool
|
If true, check freshness without writing. |
required |
Returns:
| Type | Description |
|---|---|
ExportResult
|
Export result. |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If the source artifact is not loaded in the registry. |
Source code in src/se_theory_reference_kit/export/engine.py
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | |
catalog
export/catalog.py - Generic reference catalog construction.
CatalogEntry
dataclass
Generic catalog entry for one loaded reference artifact.
Source code in src/se_theory_reference_kit/export/catalog.py
13 14 15 16 17 18 19 | |
build_reference_catalog
build_reference_catalog(
*,
registry: ReferenceRegistry,
repo_root: Path,
schema: str,
source: str,
namespace: str,
artifact: str,
) -> JsonObject
Build a generic reference catalog from loaded reference artifacts.
This function builds the common catalog envelope and reference path list. Repo-specific catalog payload sections remain owned by the theory repo.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
registry
|
ReferenceRegistry
|
Loaded reference registry. |
required |
repo_root
|
Path
|
Repository root used to produce portable relative paths. |
required |
schema
|
str
|
Catalog schema id. |
required |
source
|
str
|
Owning repository slug. |
required |
namespace
|
str
|
Reference namespace. |
required |
artifact
|
str
|
Catalog artifact name. |
required |
Returns:
| Type | Description |
|---|---|
JsonObject
|
JSON-compatible catalog payload. |
Source code in src/se_theory_reference_kit/export/catalog.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | |
engine
export/engine.py - Generic generated JSON export engine.
ExportResult
dataclass
Result of one generated export operation.
Attributes:
| Name | Type | Description |
|---|---|---|
output_path |
Path
|
Generated output path. |
current |
bool
|
True when output is current or was written. |
wrote |
bool
|
True when output was written. |
checked |
bool
|
True when the operation ran in check mode. |
Source code in src/se_theory_reference_kit/export/engine.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | |
build_registry_payload
build_registry_payload(
*,
spec: ExportSpec,
document: ReferenceDocument,
source_path: Path,
repo_root: Path,
repo_slug: str,
reference_namespace: str,
) -> JsonObject
Build one generated registry payload from one reference artifact.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spec
|
ExportSpec
|
Repo-owned export specification. |
required |
document
|
ReferenceDocument
|
Parsed reference artifact. |
required |
source_path
|
Path
|
Source reference artifact path. |
required |
repo_root
|
Path
|
Repository root used to produce portable relative paths. |
required |
repo_slug
|
str
|
Owning repository slug. |
required |
reference_namespace
|
str
|
Reference namespace for generated payloads. |
required |
Returns:
| Type | Description |
|---|---|
JsonObject
|
JSON-compatible generated registry payload. |
Source code in src/se_theory_reference_kit/export/engine.py
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | |
export_registries
export_registries(
*,
specs: tuple[ExportSpec, ...],
registry: ReferenceRegistry,
repo_root: Path,
reference_root: Path,
output_root: Path,
repo_slug: str,
reference_namespace: str,
check: bool,
) -> tuple[ExportResult, ...]
Export generated registry JSON artifacts.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
specs
|
tuple[ExportSpec, ...]
|
Repo-owned export specifications. |
required |
registry
|
ReferenceRegistry
|
Loaded reference registry. |
required |
repo_root
|
Path
|
Repository root used to produce portable relative paths. |
required |
reference_root
|
Path
|
Reference artifact root. |
required |
output_root
|
Path
|
Generated output root. |
required |
repo_slug
|
str
|
Owning repository slug. |
required |
reference_namespace
|
str
|
Reference namespace. |
required |
check
|
bool
|
If true, check freshness without writing. |
required |
Returns:
| Type | Description |
|---|---|
tuple[ExportResult, ...]
|
Export results. |
Source code in src/se_theory_reference_kit/export/engine.py
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 | |
export_registry
export_registry(
*,
spec: ExportSpec,
registry: ReferenceRegistry,
repo_root: Path,
reference_root: Path,
output_root: Path,
repo_slug: str,
reference_namespace: str,
check: bool,
) -> ExportResult
Export one registry JSON artifact.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spec
|
ExportSpec
|
Repo-owned export specification. |
required |
registry
|
ReferenceRegistry
|
Loaded reference registry. |
required |
repo_root
|
Path
|
Repository root used to produce portable relative paths. |
required |
reference_root
|
Path
|
Reference artifact root used to locate source artifacts. |
required |
output_root
|
Path
|
Generated output root. |
required |
repo_slug
|
str
|
Owning repository slug. |
required |
reference_namespace
|
str
|
Reference namespace. |
required |
check
|
bool
|
If true, check freshness without writing. |
required |
Returns:
| Type | Description |
|---|---|
ExportResult
|
Export result. |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If the source artifact is not loaded in the registry. |
Source code in src/se_theory_reference_kit/export/engine.py
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | |
lean
lean/init.py - Generic Lean source inspection helpers.
LeanDecl
dataclass
Lean declaration with name, kind, and reference section.
Source code in src/se_theory_reference_kit/lean/declarations.py
53 54 55 56 57 58 59 | |
expected_symbols_for_kind
expected_symbols_for_kind(
surface: SurfaceSymbols, kind: str
) -> frozenset[str]
Return expected public Lean symbols for a surface kind.
Missing kinds return an empty set. The owning theory repository supplies the surface symbols; the kit only reads the generic shape.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
surface
|
SurfaceSymbols
|
Repo-owned public surface declaration. |
required |
kind
|
str
|
Surface kind. |
required |
Returns:
| Type | Description |
|---|---|
frozenset[str]
|
Expected symbols for that kind. |
Source code in src/se_theory_reference_kit/lean/surface.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | |
extract_decls
extract_decls(lean_file: Path) -> list[LeanDecl]
Extract top-level Lean declarations from a Lean file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lean_file
|
Path
|
Lean source file. |
required |
Returns:
| Type | Description |
|---|---|
list[LeanDecl]
|
Extracted declarations. Missing files return an empty list. |
Source code in src/se_theory_reference_kit/lean/declarations.py
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | |
extract_for_section
extract_for_section(
lean_file: Path, target_section: str
) -> list[LeanDecl]
Extract Lean declarations matching a reference section.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lean_file
|
Path
|
Lean source file. |
required |
target_section
|
str
|
Reference section name. |
required |
Returns:
| Type | Description |
|---|---|
list[LeanDecl]
|
Declarations whose Lean kind belongs to the requested section. |
Source code in src/se_theory_reference_kit/lean/declarations.py
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | |
extract_spec_ids
extract_spec_ids(spec_file: Path) -> set[str]
Extract stable citation ids from a Lean Spec file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spec_file
|
Path
|
Lean Spec source file. |
required |
Returns:
| Type | Description |
|---|---|
set[str]
|
Citation id string values. Missing files return an empty set. |
Source code in src/se_theory_reference_kit/lean/spec.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 | |
infer_core_modules
infer_core_modules(
surface_module: str, lean_root: Path
) -> list[str]
Infer Core modules under a public Surface module namespace.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
surface_module
|
str
|
Public surface module, typically ending in ".Surface". |
required |
lean_root
|
Path
|
Lean source root. |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
Inferred Core module names. Returns an empty list when the surface module |
list[str]
|
does not follow the expected Surface naming pattern or no Core files are |
list[str]
|
found. |
Source code in src/se_theory_reference_kit/lean/modules.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | |
infer_spec_module
infer_spec_module(surface_module: str) -> str
Infer the Spec module from the public surface module.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
surface_module
|
str
|
Public surface module. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Inferred Spec module name. |
Source code in src/se_theory_reference_kit/lean/spec.py
40 41 42 43 44 45 46 47 48 49 50 51 52 | |
lean_module_to_relative_path
lean_module_to_relative_path(module: str) -> Path
Convert a Lean module name to a relative Lean source path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
module
|
str
|
Lean module name. |
required |
Returns:
| Type | Description |
|---|---|
Path
|
Relative Lean source path. |
Raises:
| Type | Description |
|---|---|
PathResolutionError
|
If the module name is empty, malformed, or path-like. |
Source code in src/se_theory_reference_kit/lean/modules.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | |
missing_expected_surface_symbols
missing_expected_surface_symbols(
*, surface: SurfaceSymbols, registered: set[str]
) -> set[str]
Return expected public-surface symbols missing from reference registries.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
surface
|
SurfaceSymbols
|
Repo-owned public surface declaration. |
required |
registered
|
set[str]
|
Lean symbols already registered in reference artifacts. |
required |
Returns:
| Type | Description |
|---|---|
set[str]
|
Expected symbols not present in registered symbols. |
Source code in src/se_theory_reference_kit/lean/surface.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | |
path_to_module
path_to_module(path: Path, lean_root: Path) -> str
Convert a Lean file path to a Lean module name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path
|
Lean source file. |
required |
lean_root
|
Path
|
Root directory used for module-relative path conversion. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Dotted Lean module name. |
Source code in src/se_theory_reference_kit/lean/modules.py
46 47 48 49 50 51 52 53 54 55 56 57 | |
declarations
lean/declarations.py - Extract generic Lean declarations from source files.
LeanDecl
dataclass
Lean declaration with name, kind, and reference section.
Source code in src/se_theory_reference_kit/lean/declarations.py
53 54 55 56 57 58 59 | |
extract_decls
extract_decls(lean_file: Path) -> list[LeanDecl]
Extract top-level Lean declarations from a Lean file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lean_file
|
Path
|
Lean source file. |
required |
Returns:
| Type | Description |
|---|---|
list[LeanDecl]
|
Extracted declarations. Missing files return an empty list. |
Source code in src/se_theory_reference_kit/lean/declarations.py
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | |
extract_for_section
extract_for_section(
lean_file: Path, target_section: str
) -> list[LeanDecl]
Extract Lean declarations matching a reference section.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lean_file
|
Path
|
Lean source file. |
required |
target_section
|
str
|
Reference section name. |
required |
Returns:
| Type | Description |
|---|---|
list[LeanDecl]
|
Declarations whose Lean kind belongs to the requested section. |
Source code in src/se_theory_reference_kit/lean/declarations.py
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | |
modules
lean/modules.py - Convert between Lean module names and source paths.
infer_core_modules
infer_core_modules(
surface_module: str, lean_root: Path
) -> list[str]
Infer Core modules under a public Surface module namespace.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
surface_module
|
str
|
Public surface module, typically ending in ".Surface". |
required |
lean_root
|
Path
|
Lean source root. |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
Inferred Core module names. Returns an empty list when the surface module |
list[str]
|
does not follow the expected Surface naming pattern or no Core files are |
list[str]
|
found. |
Source code in src/se_theory_reference_kit/lean/modules.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | |
lean_module_to_relative_path
lean_module_to_relative_path(module: str) -> Path
Convert a Lean module name to a relative Lean source path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
module
|
str
|
Lean module name. |
required |
Returns:
| Type | Description |
|---|---|
Path
|
Relative Lean source path. |
Raises:
| Type | Description |
|---|---|
PathResolutionError
|
If the module name is empty, malformed, or path-like. |
Source code in src/se_theory_reference_kit/lean/modules.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | |
path_to_module
path_to_module(path: Path, lean_root: Path) -> str
Convert a Lean file path to a Lean module name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path
|
Lean source file. |
required |
lean_root
|
Path
|
Root directory used for module-relative path conversion. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Dotted Lean module name. |
Source code in src/se_theory_reference_kit/lean/modules.py
46 47 48 49 50 51 52 53 54 55 56 57 | |
spec
lean/spec.py - Extract stable citation identifiers from Lean spec files.
extract_spec_ids
extract_spec_ids(spec_file: Path) -> set[str]
Extract stable citation ids from a Lean Spec file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spec_file
|
Path
|
Lean Spec source file. |
required |
Returns:
| Type | Description |
|---|---|
set[str]
|
Citation id string values. Missing files return an empty set. |
Source code in src/se_theory_reference_kit/lean/spec.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 | |
infer_spec_module
infer_spec_module(surface_module: str) -> str
Infer the Spec module from the public surface module.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
surface_module
|
str
|
Public surface module. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Inferred Spec module name. |
Source code in src/se_theory_reference_kit/lean/spec.py
40 41 42 43 44 45 46 47 48 49 50 51 52 | |
surface
lean/surface.py - Compare repo-owned public surface declarations.
expected_symbols_for_kind
expected_symbols_for_kind(
surface: SurfaceSymbols, kind: str
) -> frozenset[str]
Return expected public Lean symbols for a surface kind.
Missing kinds return an empty set. The owning theory repository supplies the surface symbols; the kit only reads the generic shape.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
surface
|
SurfaceSymbols
|
Repo-owned public surface declaration. |
required |
kind
|
str
|
Surface kind. |
required |
Returns:
| Type | Description |
|---|---|
frozenset[str]
|
Expected symbols for that kind. |
Source code in src/se_theory_reference_kit/lean/surface.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | |
missing_expected_surface_symbols
missing_expected_surface_symbols(
*, surface: SurfaceSymbols, registered: set[str]
) -> set[str]
Return expected public-surface symbols missing from reference registries.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
surface
|
SurfaceSymbols
|
Repo-owned public surface declaration. |
required |
registered
|
set[str]
|
Lean symbols already registered in reference artifacts. |
required |
Returns:
| Type | Description |
|---|---|
set[str]
|
Expected symbols not present in registered symbols. |
Source code in src/se_theory_reference_kit/lean/surface.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | |
reference
reference/init.py - Generic reference artifact tooling.
LoadedReferenceArtifact
dataclass
Loaded reference artifact.
Attributes:
| Name | Type | Description |
|---|---|---|
artifact_id |
str
|
Stable artifact id from the reference index. |
path |
Path
|
Resolved artifact path. |
kind |
str
|
Artifact kind declared by the owning repository. |
data |
ReferenceDocument
|
Parsed TOML data. |
Source code in src/se_theory_reference_kit/reference/artifacts.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | |
ReferenceRegistry
dataclass
Loaded reference artifact registry.
Attributes:
| Name | Type | Description |
|---|---|---|
artifacts |
tuple[LoadedReferenceArtifact, ...]
|
Loaded reference artifacts in index order. |
Source code in src/se_theory_reference_kit/reference/registry.py
25 26 27 28 29 30 31 32 33 34 35 36 37 | |
by_id
by_id() -> dict[str, LoadedReferenceArtifact]
Return loaded artifacts keyed by artifact id.
Source code in src/se_theory_reference_kit/reference/registry.py
35 36 37 | |
build_reference_registry
build_reference_registry(
artifact_declarations: list[ArtifactDeclaration],
*,
root: Path,
reference_dir_name: str = "reference",
) -> ReferenceRegistry
Build a registry from artifact declarations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
artifact_declarations
|
list[ArtifactDeclaration]
|
Artifact declarations from reference/index.toml. |
required |
root
|
Path
|
Repository root. |
required |
reference_dir_name
|
str
|
Reference directory name. |
'reference'
|
Returns:
| Type | Description |
|---|---|
ReferenceRegistry
|
Loaded reference registry. |
Source code in src/se_theory_reference_kit/reference/registry.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | |
discover_reference_artifacts
discover_reference_artifacts(
*,
root: Path | None = None,
reference_dir_name: str = "reference",
) -> tuple[Path, ...]
Discover TOML reference artifacts under the reference directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root
|
Path | None
|
Repository root. |
None
|
reference_dir_name
|
str
|
Reference directory name. |
'reference'
|
Returns:
| Type | Description |
|---|---|
tuple[Path, ...]
|
Sorted reference TOML paths. |
Source code in src/se_theory_reference_kit/reference/artifacts.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | |
load_reference_artifact
load_reference_artifact(
artifact: ArtifactDeclaration,
*,
root: Path,
reference_dir_name: str = "reference",
) -> LoadedReferenceArtifact
Load one reference artifact declared in the reference index.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
artifact
|
ArtifactDeclaration
|
Artifact declaration from reference/index.toml. |
required |
root
|
Path
|
Repository root. |
required |
reference_dir_name
|
str
|
Reference directory name. |
'reference'
|
Returns:
| Type | Description |
|---|---|
LoadedReferenceArtifact
|
Loaded reference artifact. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the declaration lacks a valid path. |
Source code in src/se_theory_reference_kit/reference/artifacts.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | |
make_stub
make_stub(
declaration: LeanDecl, source_module: str
) -> ReferenceEntry
Create a generic reference entry stub for a Lean declaration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
declaration
|
LeanDecl
|
Lean declaration. |
required |
source_module
|
str
|
Source module for the declaration. |
required |
Returns:
| Type | Description |
|---|---|
ReferenceEntry
|
Reference entry stub. |
Source code in src/se_theory_reference_kit/reference/stubs.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | |
merge_entry
merge_entry(
existing: ReferenceEntry,
generated: ReferenceEntry,
*,
overwrite: bool,
) -> ReferenceEntry
Merge an existing hand-authored entry with generated fields.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
existing
|
ReferenceEntry
|
Existing entry. |
required |
generated
|
ReferenceEntry
|
Generated stub fields. |
required |
overwrite
|
bool
|
If true, generated values replace existing values. |
required |
Returns:
| Type | Description |
|---|---|
ReferenceEntry
|
Merged entry. |
Source code in src/se_theory_reference_kit/reference/stubs.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | |
ordered_table_values
ordered_table_values(
document: ReferenceDocument, table_name: str
) -> list[dict[str, object]]
Return nested table values sorted by order, then id/key.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
document
|
ReferenceDocument
|
Parsed reference artifact. |
required |
table_name
|
str
|
Top-level table name. |
required |
Returns:
| Type | Description |
|---|---|
list[dict[str, object]]
|
Ordered table entries. Each entry receives an id if missing. |
Raises:
| Type | Description |
|---|---|
TypeError
|
If the table or entries are not tables. |
Source code in src/se_theory_reference_kit/reference/artifacts.py
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | |
reference_artifact_meta
reference_artifact_meta(
document: ReferenceDocument,
) -> dict[str, object]
Return normalized metadata from a reference artifact.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
document
|
ReferenceDocument
|
Parsed reference artifact. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, object]
|
Copy of the [meta] table, or an empty dictionary when absent. |
Raises:
| Type | Description |
|---|---|
TypeError
|
If [meta] is present but not a table. |
Source code in src/se_theory_reference_kit/reference/artifacts.py
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | |
reference_stub_key
reference_stub_key(declaration: LeanDecl) -> str
Return the default reference stub key for a Lean declaration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
declaration
|
LeanDecl
|
Lean declaration. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Stub key. |
Source code in src/se_theory_reference_kit/reference/stubs.py
10 11 12 13 14 15 16 17 18 19 | |
registered_lean_symbols
registered_lean_symbols(
registry: ReferenceRegistry,
*,
sections: frozenset[str] | None = None,
) -> set[str]
Return Lean symbols registered in reference artifacts.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
registry
|
ReferenceRegistry
|
Loaded reference registry. |
required |
sections
|
frozenset[str] | None
|
Optional section filter. |
None
|
Returns:
| Type | Description |
|---|---|
set[str]
|
Registered Lean symbol names. |
Source code in src/se_theory_reference_kit/reference/registry.py
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | |
section_entries
section_entries(
data: ReferenceDocument, section: str
) -> SectionEntries
Return table entries for a reference section.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
ReferenceDocument
|
Parsed reference artifact. |
required |
section
|
str
|
Section name. |
required |
Returns:
| Type | Description |
|---|---|
SectionEntries
|
Section entries keyed by entry id. |
Source code in src/se_theory_reference_kit/reference/registry.py
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | |
source_modules_in_registry
source_modules_in_registry(
data: ReferenceDocument,
) -> list[str]
Return source modules declared inside a reference artifact.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
ReferenceDocument
|
Parsed reference artifact. |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
Source module names in first-seen order. |
Source code in src/se_theory_reference_kit/reference/registry.py
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 | |
validate_reference_artifact_shape
validate_reference_artifact_shape(
*, check_id: str, artifact: LoadedReferenceArtifact
) -> tuple[CheckResult, ...]
Validate generic reference artifact shape.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
check_id
|
str
|
Validation check id. |
required |
artifact
|
LoadedReferenceArtifact
|
Loaded reference artifact. |
required |
Returns:
| Type | Description |
|---|---|
tuple[CheckResult, ...]
|
Validation findings. |
Source code in src/se_theory_reference_kit/reference/validation.py
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | |
validate_required_fields
validate_required_fields(
*,
check_id: str,
artifact: LoadedReferenceArtifact,
section: str,
required_fields: Iterable[str] = REQUIRED_ENTRY_FIELDS,
) -> tuple[CheckResult, ...]
Validate required fields for all entries in one reference section.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
check_id
|
str
|
Validation check id. |
required |
artifact
|
LoadedReferenceArtifact
|
Loaded reference artifact. |
required |
section
|
str
|
Section name. |
required |
required_fields
|
Iterable[str]
|
Required field names. |
REQUIRED_ENTRY_FIELDS
|
Returns:
| Type | Description |
|---|---|
tuple[CheckResult, ...]
|
Validation findings. |
Source code in src/se_theory_reference_kit/reference/validation.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | |
artifacts
reference/artifacts.py - Reference artifact discovery and loading.
LoadedReferenceArtifact
dataclass
Loaded reference artifact.
Attributes:
| Name | Type | Description |
|---|---|---|
artifact_id |
str
|
Stable artifact id from the reference index. |
path |
Path
|
Resolved artifact path. |
kind |
str
|
Artifact kind declared by the owning repository. |
data |
ReferenceDocument
|
Parsed TOML data. |
Source code in src/se_theory_reference_kit/reference/artifacts.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | |
discover_reference_artifacts
discover_reference_artifacts(
*,
root: Path | None = None,
reference_dir_name: str = "reference",
) -> tuple[Path, ...]
Discover TOML reference artifacts under the reference directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root
|
Path | None
|
Repository root. |
None
|
reference_dir_name
|
str
|
Reference directory name. |
'reference'
|
Returns:
| Type | Description |
|---|---|
tuple[Path, ...]
|
Sorted reference TOML paths. |
Source code in src/se_theory_reference_kit/reference/artifacts.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | |
load_reference_artifact
load_reference_artifact(
artifact: ArtifactDeclaration,
*,
root: Path,
reference_dir_name: str = "reference",
) -> LoadedReferenceArtifact
Load one reference artifact declared in the reference index.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
artifact
|
ArtifactDeclaration
|
Artifact declaration from reference/index.toml. |
required |
root
|
Path
|
Repository root. |
required |
reference_dir_name
|
str
|
Reference directory name. |
'reference'
|
Returns:
| Type | Description |
|---|---|
LoadedReferenceArtifact
|
Loaded reference artifact. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the declaration lacks a valid path. |
Source code in src/se_theory_reference_kit/reference/artifacts.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | |
ordered_table_values
ordered_table_values(
document: ReferenceDocument, table_name: str
) -> list[dict[str, object]]
Return nested table values sorted by order, then id/key.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
document
|
ReferenceDocument
|
Parsed reference artifact. |
required |
table_name
|
str
|
Top-level table name. |
required |
Returns:
| Type | Description |
|---|---|
list[dict[str, object]]
|
Ordered table entries. Each entry receives an id if missing. |
Raises:
| Type | Description |
|---|---|
TypeError
|
If the table or entries are not tables. |
Source code in src/se_theory_reference_kit/reference/artifacts.py
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | |
reference_artifact_meta
reference_artifact_meta(
document: ReferenceDocument,
) -> dict[str, object]
Return normalized metadata from a reference artifact.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
document
|
ReferenceDocument
|
Parsed reference artifact. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, object]
|
Copy of the [meta] table, or an empty dictionary when absent. |
Raises:
| Type | Description |
|---|---|
TypeError
|
If [meta] is present but not a table. |
Source code in src/se_theory_reference_kit/reference/artifacts.py
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | |
registry
reference/registry.py - Reference artifact registry helpers.
ReferenceRegistry
dataclass
Loaded reference artifact registry.
Attributes:
| Name | Type | Description |
|---|---|---|
artifacts |
tuple[LoadedReferenceArtifact, ...]
|
Loaded reference artifacts in index order. |
Source code in src/se_theory_reference_kit/reference/registry.py
25 26 27 28 29 30 31 32 33 34 35 36 37 | |
by_id
by_id() -> dict[str, LoadedReferenceArtifact]
Return loaded artifacts keyed by artifact id.
Source code in src/se_theory_reference_kit/reference/registry.py
35 36 37 | |
build_reference_registry
build_reference_registry(
artifact_declarations: list[ArtifactDeclaration],
*,
root: Path,
reference_dir_name: str = "reference",
) -> ReferenceRegistry
Build a registry from artifact declarations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
artifact_declarations
|
list[ArtifactDeclaration]
|
Artifact declarations from reference/index.toml. |
required |
root
|
Path
|
Repository root. |
required |
reference_dir_name
|
str
|
Reference directory name. |
'reference'
|
Returns:
| Type | Description |
|---|---|
ReferenceRegistry
|
Loaded reference registry. |
Source code in src/se_theory_reference_kit/reference/registry.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | |
build_registry_from_config
build_registry_from_config(
repo_root: Path, config: TheoryReferenceConfig
) -> ReferenceRegistry
Build the full reference registry from the config artifact sources.
Source code in src/se_theory_reference_kit/reference/registry.py
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | |
build_surface_symbols
build_surface_symbols(
repo_root: Path, config: TheoryReferenceConfig
) -> SurfaceSymbols
Derive the public surface from the mapped reference artifacts.
Source code in src/se_theory_reference_kit/reference/registry.py
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | |
extract_unique_source_modules
extract_unique_source_modules(
modules: list[str],
seen: set[str],
section_map: dict[str, object],
) -> None
Extract unique source modules from a section map.
Source code in src/se_theory_reference_kit/reference/registry.py
197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | |
registered_lean_symbols
registered_lean_symbols(
registry: ReferenceRegistry,
*,
sections: frozenset[str] | None = None,
) -> set[str]
Return Lean symbols registered in reference artifacts.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
registry
|
ReferenceRegistry
|
Loaded reference registry. |
required |
sections
|
frozenset[str] | None
|
Optional section filter. |
None
|
Returns:
| Type | Description |
|---|---|
set[str]
|
Registered Lean symbol names. |
Source code in src/se_theory_reference_kit/reference/registry.py
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | |
section_entries
section_entries(
data: ReferenceDocument, section: str
) -> SectionEntries
Return table entries for a reference section.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
ReferenceDocument
|
Parsed reference artifact. |
required |
section
|
str
|
Section name. |
required |
Returns:
| Type | Description |
|---|---|
SectionEntries
|
Section entries keyed by entry id. |
Source code in src/se_theory_reference_kit/reference/registry.py
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | |
source_modules_in_registry
source_modules_in_registry(
data: ReferenceDocument,
) -> list[str]
Return source modules declared inside a reference artifact.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
ReferenceDocument
|
Parsed reference artifact. |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
Source module names in first-seen order. |
Source code in src/se_theory_reference_kit/reference/registry.py
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 | |
stubs
reference/stubs.py - Generic reference stub construction.
make_stub
make_stub(
declaration: LeanDecl, source_module: str
) -> ReferenceEntry
Create a generic reference entry stub for a Lean declaration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
declaration
|
LeanDecl
|
Lean declaration. |
required |
source_module
|
str
|
Source module for the declaration. |
required |
Returns:
| Type | Description |
|---|---|
ReferenceEntry
|
Reference entry stub. |
Source code in src/se_theory_reference_kit/reference/stubs.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | |
merge_entry
merge_entry(
existing: ReferenceEntry,
generated: ReferenceEntry,
*,
overwrite: bool,
) -> ReferenceEntry
Merge an existing hand-authored entry with generated fields.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
existing
|
ReferenceEntry
|
Existing entry. |
required |
generated
|
ReferenceEntry
|
Generated stub fields. |
required |
overwrite
|
bool
|
If true, generated values replace existing values. |
required |
Returns:
| Type | Description |
|---|---|
ReferenceEntry
|
Merged entry. |
Source code in src/se_theory_reference_kit/reference/stubs.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | |
reference_stub_key
reference_stub_key(declaration: LeanDecl) -> str
Return the default reference stub key for a Lean declaration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
declaration
|
LeanDecl
|
Lean declaration. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Stub key. |
Source code in src/se_theory_reference_kit/reference/stubs.py
10 11 12 13 14 15 16 17 18 19 | |
validation
reference/validation.py - Generic reference artifact shape validation.
validate_reference_artifact_shape
validate_reference_artifact_shape(
*, check_id: str, artifact: LoadedReferenceArtifact
) -> tuple[CheckResult, ...]
Validate generic reference artifact shape.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
check_id
|
str
|
Validation check id. |
required |
artifact
|
LoadedReferenceArtifact
|
Loaded reference artifact. |
required |
Returns:
| Type | Description |
|---|---|
tuple[CheckResult, ...]
|
Validation findings. |
Source code in src/se_theory_reference_kit/reference/validation.py
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | |
validate_required_fields
validate_required_fields(
*,
check_id: str,
artifact: LoadedReferenceArtifact,
section: str,
required_fields: Iterable[str] = REQUIRED_ENTRY_FIELDS,
) -> tuple[CheckResult, ...]
Validate required fields for all entries in one reference section.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
check_id
|
str
|
Validation check id. |
required |
artifact
|
LoadedReferenceArtifact
|
Loaded reference artifact. |
required |
section
|
str
|
Section name. |
required |
required_fields
|
Iterable[str]
|
Required field names. |
REQUIRED_ENTRY_FIELDS
|
Returns:
| Type | Description |
|---|---|
tuple[CheckResult, ...]
|
Validation findings. |
Source code in src/se_theory_reference_kit/reference/validation.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | |
validation
validation/init.py - Checks, registry, runner, and default check set.
Public surface
- Check, CheckRegistry the check contract and its catalogue
- CheckResult, CheckStatus, ... the result vocabulary
- RunReport, run_checks execution with crash isolation
- default_registry, DEFAULT_CHECKS the kit's fixed generic check set
Check
dataclass
A registered check: a function plus its catalogue metadata.
Attributes:
| Name | Type | Description |
|---|---|---|
check_id |
str
|
Stable, unique id. |
title |
str
|
Short human-readable description for logs and reports. |
run |
CheckFunc
|
The check function. |
strict_only |
bool
|
When true, the check runs only in strict mode. |
Source code in src/se_theory_reference_kit/validation/registry.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | |
CheckRegistry
dataclass
An immutable, ordered collection of checks.
Order is preserved so runs are deterministic and the default generic checks always precede consumer-appended checks. Ids must be unique across the registry.
Source code in src/se_theory_reference_kit/validation/registry.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | |
__post_init__
__post_init__() -> None
Reject duplicate check ids at construction time.
Source code in src/se_theory_reference_kit/validation/registry.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 | |
extend
extend(*checks: Check) -> Self
Return a new registry with the given checks appended.
The kit's defaults are never mutated; a consumer extends them. The returned registry preserves order and re-validates id uniqueness, so a consumer cannot shadow a default id.
Source code in src/se_theory_reference_kit/validation/registry.py
75 76 77 78 79 80 81 82 | |
extended_with
extended_with(checks: Iterable[Check]) -> Self
Return a new registry appending an iterable of checks.
Source code in src/se_theory_reference_kit/validation/registry.py
84 85 86 | |
ids
ids() -> tuple[str, ...]
Return the check ids in order.
Source code in src/se_theory_reference_kit/validation/registry.py
88 89 90 | |
select
select(*, strict: bool) -> Sequence[Check]
Return the checks that should run for the given mode.
In non-strict mode, strict-only checks are skipped. In strict mode, all checks run.
Source code in src/se_theory_reference_kit/validation/registry.py
92 93 94 95 96 97 98 99 100 101 | |
CheckResult
dataclass
One validation finding emitted by one check.
Attributes:
| Name | Type | Description |
|---|---|---|
check_id |
str
|
Stable id of the check that emitted the finding. |
status |
CheckStatus
|
Check status. |
severity |
CheckSeverity
|
Finding severity. |
message |
str
|
Human-readable finding message. |
artifact_id |
str | None
|
Optional artifact id associated with the finding. |
path |
Path | None
|
Optional path associated with the finding. |
detail |
JsonDetail
|
Optional structured detail for reports or downstream tooling. |
Source code in src/se_theory_reference_kit/base/results.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | |
CheckSeverity
Bases: StrEnum
Severity vocabulary for one validation finding.
Source code in src/se_theory_reference_kit/base/results.py
38 39 40 41 42 43 | |
CheckStatus
Bases: StrEnum
Status vocabulary for one validation finding.
Source code in src/se_theory_reference_kit/base/results.py
29 30 31 32 33 34 35 | |
ReferenceRunContext
dataclass
Resolved read-only context for theory-reference validation.
Source code in src/se_theory_reference_kit/validation/context.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | |
generated_root
property
generated_root: Path
Return the generated data directory.
reference_root
property
reference_root: Path
Return the reference artifact directory.
RunReport
dataclass
The outcome of running a registry against a context.
Attributes:
| Name | Type | Description |
|---|---|---|
results |
tuple[CheckResult, ...]
|
Every finding from every check, in check order. |
strict |
bool
|
Whether the run was executed in strict mode. |
overall_status |
CheckStatus
|
Worst status across all results. |
Source code in src/se_theory_reference_kit/validation/runner.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | |
exit_code
property
exit_code: int
Return the process exit code: 0 when passed, 1 otherwise.
failures
property
failures: tuple[CheckResult, ...]
Return results that count as failures for this run's mode.
Error-severity findings always count. Warning-severity findings count only under strict mode. Cannot-verify always counts.
passed
property
passed: bool
Return true when no findings count as failures for this mode.
default_registry
default_registry() -> CheckRegistry
Return the kit's default registry of generic checks.
Returns a fresh CheckRegistry each call. Consumers extend it to add repo-specific checks; the kit's defaults are never mutated.
Source code in src/se_theory_reference_kit/validation/defaults.py
54 55 56 57 58 59 60 | |
run_checks
run_checks(
*,
registry: CheckRegistry,
context: ReferenceRunContext,
strict: bool = False,
) -> RunReport
Run selected checks against the context with crash isolation.
Each check is executed independently. If a check raises ReferenceKitError, it is recorded as a cannot-verify result and the run continues. One broken check never hides the results of the others.
Source code in src/se_theory_reference_kit/validation/runner.py
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | |
checks
validation/checks/init.py - Generic theory-reference validation checks.
export
validation/checks/export.py - Validate generated export freshness.
check_exports_current
check_exports_current(
context: ReferenceRunContext,
) -> Iterable[CheckResult]
Verify generated export artifacts are current.
Source code in src/se_theory_reference_kit/validation/checks/export.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | |
lean_surface
validation/checks/lean_surface.py - Validate reference coverage of Lean surface.
check_lean_surface
check_lean_surface(
context: ReferenceRunContext,
) -> Iterable[CheckResult]
Verify expected public Lean symbols appear in reference artifacts.
Source code in src/se_theory_reference_kit/validation/checks/lean_surface.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | |
reference_artifacts
validation/checks/reference_artifacts.py - Validate declared reference artifacts.
check_reference_artifacts
check_reference_artifacts(
context: ReferenceRunContext,
) -> Iterable[CheckResult]
Verify declared reference artifacts exist, parse, and have generic shape.
Source code in src/se_theory_reference_kit/validation/checks/reference_artifacts.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | |
strict
validation/checks/strict.py - Strict-only unfinished-work marker check.
check_strict_no_todo
check_strict_no_todo(
context: ReferenceRunContext,
) -> Iterable[CheckResult]
Verify reference artifacts contain no unfinished-work markers.
Source code in src/se_theory_reference_kit/validation/checks/strict.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | |
context
validation/context.py - Context object for theory-reference validation checks.
ReferenceRunContext
dataclass
Resolved read-only context for theory-reference validation.
Source code in src/se_theory_reference_kit/validation/context.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | |
generated_root
property
generated_root: Path
Return the generated data directory.
reference_root
property
reference_root: Path
Return the reference artifact directory.
defaults
validation/defaults.py - The kit's fixed set of generic checks.
This is the single place that knows which checks the kit ships. registry.py is pure machinery and imports nothing from checks; individual checks import Check from registry. defaults.py sits above both, importing the machinery and checks to assemble the default registry. The dependency arrow is one-way:
registry <- checks <- defaults
so there is no cycle, and registry/checks can be reasoned about without knowing the default set.
Consuming repos build their own registry by extending this one:
from se_theory_reference_kit.validation.defaults import default_registry
registry = default_registry().extend(repo_specific_check)
The defaults are never edited by a consumer; extend() returns a new registry.
Default order
- reference.index reference/index.toml exists and parses
- reference.artifacts declared reference artifacts exist and parse
- lean.surface declared public surface is covered
- exports.current generated exports are current
- structural.strict.no-todo no unfinished-work markers (strict-only)
default_registry
default_registry() -> CheckRegistry
Return the kit's default registry of generic checks.
Returns a fresh CheckRegistry each call. Consumers extend it to add repo-specific checks; the kit's defaults are never mutated.
Source code in src/se_theory_reference_kit/validation/defaults.py
54 55 56 57 58 59 60 | |
registry
validation/registry.py - Check registry and consumer extension hook.
The kit provides a fixed set of default generic checks. Consuming theory repositories append repo-specific checks to that set without modifying the kit. The kit's defaults are never edited by a consumer; they are extended.
This is the seam that lets one shared engine serve every theory repository without forking. Immutability enforces it: extend() returns a new registry with the added checks appended, so a consumer cannot mutate the kit's defaults in place.
Check
dataclass
A registered check: a function plus its catalogue metadata.
Attributes:
| Name | Type | Description |
|---|---|---|
check_id |
str
|
Stable, unique id. |
title |
str
|
Short human-readable description for logs and reports. |
run |
CheckFunc
|
The check function. |
strict_only |
bool
|
When true, the check runs only in strict mode. |
Source code in src/se_theory_reference_kit/validation/registry.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | |
CheckRegistry
dataclass
An immutable, ordered collection of checks.
Order is preserved so runs are deterministic and the default generic checks always precede consumer-appended checks. Ids must be unique across the registry.
Source code in src/se_theory_reference_kit/validation/registry.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | |
__post_init__
__post_init__() -> None
Reject duplicate check ids at construction time.
Source code in src/se_theory_reference_kit/validation/registry.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 | |
extend
extend(*checks: Check) -> Self
Return a new registry with the given checks appended.
The kit's defaults are never mutated; a consumer extends them. The returned registry preserves order and re-validates id uniqueness, so a consumer cannot shadow a default id.
Source code in src/se_theory_reference_kit/validation/registry.py
75 76 77 78 79 80 81 82 | |
extended_with
extended_with(checks: Iterable[Check]) -> Self
Return a new registry appending an iterable of checks.
Source code in src/se_theory_reference_kit/validation/registry.py
84 85 86 | |
ids
ids() -> tuple[str, ...]
Return the check ids in order.
Source code in src/se_theory_reference_kit/validation/registry.py
88 89 90 | |
select
select(*, strict: bool) -> Sequence[Check]
Return the checks that should run for the given mode.
In non-strict mode, strict-only checks are skipped. In strict mode, all checks run.
Source code in src/se_theory_reference_kit/validation/registry.py
92 93 94 95 96 97 98 99 100 101 | |
runner
validation/runner.py - Execute a registry with crash isolation.
The runner is the only place that knows about strict mode and overall outcome. It runs each selected check, isolates crashes, collects all results, and computes an exit code.
Strict mode is applied here, not in checks: checks report severity, and the runner decides whether warning-severity findings fail the run.
RunReport
dataclass
The outcome of running a registry against a context.
Attributes:
| Name | Type | Description |
|---|---|---|
results |
tuple[CheckResult, ...]
|
Every finding from every check, in check order. |
strict |
bool
|
Whether the run was executed in strict mode. |
overall_status |
CheckStatus
|
Worst status across all results. |
Source code in src/se_theory_reference_kit/validation/runner.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | |
exit_code
property
exit_code: int
Return the process exit code: 0 when passed, 1 otherwise.
failures
property
failures: tuple[CheckResult, ...]
Return results that count as failures for this run's mode.
Error-severity findings always count. Warning-severity findings count only under strict mode. Cannot-verify always counts.
passed
property
passed: bool
Return true when no findings count as failures for this mode.
run_checks
run_checks(
*,
registry: CheckRegistry,
context: ReferenceRunContext,
strict: bool = False,
) -> RunReport
Run selected checks against the context with crash isolation.
Each check is executed independently. If a check raises ReferenceKitError, it is recorded as a cannot-verify result and the run continues. One broken check never hides the results of the others.
Source code in src/se_theory_reference_kit/validation/runner.py
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | |
Base
se_theory_reference_kit.base
base/init.py - Shared base utilities for theory-reference tooling.
ArtifactLoadError
Bases: ReferenceKitError
Raised when a reference artifact cannot be loaded.
Source code in src/se_theory_reference_kit/base/errors.py
16 17 | |
CheckResult
dataclass
One validation finding emitted by one check.
Attributes:
| Name | Type | Description |
|---|---|---|
check_id |
str
|
Stable id of the check that emitted the finding. |
status |
CheckStatus
|
Check status. |
severity |
CheckSeverity
|
Finding severity. |
message |
str
|
Human-readable finding message. |
artifact_id |
str | None
|
Optional artifact id associated with the finding. |
path |
Path | None
|
Optional path associated with the finding. |
detail |
JsonDetail
|
Optional structured detail for reports or downstream tooling. |
Source code in src/se_theory_reference_kit/base/results.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | |
CheckSeverity
Bases: StrEnum
Severity vocabulary for one validation finding.
Source code in src/se_theory_reference_kit/base/results.py
38 39 40 41 42 43 | |
CheckStatus
Bases: StrEnum
Status vocabulary for one validation finding.
Source code in src/se_theory_reference_kit/base/results.py
29 30 31 32 33 34 35 | |
ConfigurationError
Bases: ReferenceKitError
Raised when repo-provided reference configuration is invalid.
Source code in src/se_theory_reference_kit/base/errors.py
12 13 | |
ReferenceKitError
Bases: Exception
Base exception for theory-reference-kit failures.
Source code in src/se_theory_reference_kit/base/errors.py
4 5 | |
RepositoryRootError
Bases: ReferenceKitError
Raised when a repository root cannot be resolved.
Source code in src/se_theory_reference_kit/base/errors.py
8 9 | |
cannot_verify
cannot_verify(
check_id: str,
message: str,
*,
artifact_id: str | None = None,
path: Path | None = None,
detail: JsonDetail | None = None,
) -> CheckResult
Create a cannot-verify result.
Source code in src/se_theory_reference_kit/base/results.py
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | |
failure
failure(
check_id: str,
message: str,
*,
artifact_id: str | None = None,
path: Path | None = None,
detail: JsonDetail | None = None,
) -> CheckResult
Create an error failure result.
Source code in src/se_theory_reference_kit/base/results.py
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | |
find_repository_root
find_repository_root(start: Path | None = None) -> Path
Find the nearest repository root from a starting path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
start
|
Path | None
|
Starting path. Defaults to the current working directory. |
None
|
Returns:
| Type | Description |
|---|---|
Path
|
Resolved repository root path. |
Raises:
| Type | Description |
|---|---|
RepositoryRootError
|
If no repository root marker is found. |
Source code in src/se_theory_reference_kit/base/paths.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | |
lean_module_to_path
lean_module_to_path(
module: str,
*,
root: Path | None = None,
lean_public_root: str,
) -> Path
Resolve a Lean module name to its repository source path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
module
|
str
|
Lean module name. |
required |
root
|
Path | None
|
Repository root. |
None
|
lean_public_root
|
str
|
Expected public Lean root for the owning repository. |
required |
Returns:
| Type | Description |
|---|---|
Path
|
Repository-contained Lean source path. |
Raises:
| Type | Description |
|---|---|
PathResolutionError
|
If the module name is empty, path-like, malformed, or outside the declared public Lean root. |
Source code in src/se_theory_reference_kit/base/paths.py
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | |
ok
ok(
check_id: str,
message: str,
*,
artifact_id: str | None = None,
path: Path | None = None,
detail: JsonDetail | None = None,
) -> CheckResult
Create an ok result.
Source code in src/se_theory_reference_kit/base/results.py
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | |
partial
partial(
check_id: str,
message: str,
*,
artifact_id: str | None = None,
path: Path | None = None,
detail: JsonDetail | None = None,
) -> CheckResult
Create a partial result.
Source code in src/se_theory_reference_kit/base/results.py
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | |
reference_artifact_path
reference_artifact_path(
path: str | Path,
*,
root: Path | None = None,
reference_dir_name: str = "reference",
) -> Path
Resolve a declared reference artifact path.
The declared path must be repository-relative and under the reference directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | Path
|
Declared repository-relative artifact path. |
required |
root
|
Path | None
|
Repository root. |
None
|
reference_dir_name
|
str
|
Name of the reference artifact directory. |
'reference'
|
Returns:
| Type | Description |
|---|---|
Path
|
Resolved reference artifact path. |
Raises:
| Type | Description |
|---|---|
PathResolutionError
|
If the path is outside the reference directory. |
Source code in src/se_theory_reference_kit/base/paths.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | |
reference_dir
reference_dir(
*,
root: Path | None = None,
reference_dir_name: str = "reference",
) -> Path
Return the repository reference directory.
Source code in src/se_theory_reference_kit/base/paths.py
63 64 65 66 67 68 69 | |
resolve_repo_path
resolve_repo_path(
path: str | Path, *, root: Path | None = None
) -> Path
Resolve a path as repository-relative and contained within the repository.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | Path
|
Repository-relative path. |
required |
root
|
Path | None
|
Repository root. Defaults to nearest detected repository root. |
None
|
Returns:
| Type | Description |
|---|---|
Path
|
Resolved absolute path. |
Raises:
| Type | Description |
|---|---|
PathResolutionError
|
If the path escapes the repository root. |
Source code in src/se_theory_reference_kit/base/paths.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | |
warning
warning(
check_id: str,
message: str,
*,
artifact_id: str | None = None,
path: Path | None = None,
detail: JsonDetail | None = None,
) -> CheckResult
Create a warning failure result.
Source code in src/se_theory_reference_kit/base/results.py
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | |
worst_status
worst_status(results: Iterable[CheckResult]) -> CheckStatus
Return the worst status across validation results.
Source code in src/se_theory_reference_kit/base/results.py
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | |
errors
base/errors.py - Exception types for theory-reference tooling.
ArtifactLoadError
Bases: ReferenceKitError
Raised when a reference artifact cannot be loaded.
Source code in src/se_theory_reference_kit/base/errors.py
16 17 | |
ArtifactWriteError
Bases: ReferenceKitError
Raised when a reference artifact cannot be written.
Source code in src/se_theory_reference_kit/base/errors.py
20 21 | |
ConfigurationError
Bases: ReferenceKitError
Raised when repo-provided reference configuration is invalid.
Source code in src/se_theory_reference_kit/base/errors.py
12 13 | |
PathResolutionError
Bases: ReferenceKitError
Raised when a repository-relative path is invalid.
Source code in src/se_theory_reference_kit/base/errors.py
24 25 | |
ReferenceKitError
Bases: Exception
Base exception for theory-reference-kit failures.
Source code in src/se_theory_reference_kit/base/errors.py
4 5 | |
RepositoryRootError
Bases: ReferenceKitError
Raised when a repository root cannot be resolved.
Source code in src/se_theory_reference_kit/base/errors.py
8 9 | |
io
base/io.py - UTF-8 text and TOML loading helpers.
load_toml
load_toml(path: Path) -> TomlDocument
Load a TOML file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path
|
TOML file path. |
required |
Returns:
| Type | Description |
|---|---|
TomlDocument
|
Parsed TOML document. |
Raises:
| Type | Description |
|---|---|
ArtifactLoadError
|
If the file cannot be read or parsed. |
Source code in src/se_theory_reference_kit/base/io.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | |
read_text
read_text(path: Path) -> str
Read a UTF-8 text file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path
|
File path. |
required |
Returns:
| Type | Description |
|---|---|
str
|
File contents. |
Raises:
| Type | Description |
|---|---|
ArtifactLoadError
|
If the file cannot be read. |
Source code in src/se_theory_reference_kit/base/io.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | |
write_text
write_text(path: Path, content: str) -> None
Write a UTF-8 text file, creating parent directories if needed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path
|
Output path. |
required |
content
|
str
|
Text content. |
required |
Raises:
| Type | Description |
|---|---|
ArtifactWriteError
|
If the file cannot be written. |
Source code in src/se_theory_reference_kit/base/io.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | |
json_utils
base/json_utils.py - Deterministic JSON helpers.
encode_json
encode_json(payload: JsonObject) -> str
Encode a JSON payload deterministically.
The payload builder owns ordering. This encoder preserves insertion order rather than sorting keys.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
payload
|
JsonObject
|
JSON-compatible object. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Encoded JSON text ending with a newline. |
Source code in src/se_theory_reference_kit/base/json_utils.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | |
write_or_check_json
write_or_check_json(
path: Path, payload: JsonObject, *, check: bool
) -> bool
Write a JSON payload or check whether the file is current.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path
|
Output path. |
required |
payload
|
JsonObject
|
JSON payload. |
required |
check
|
bool
|
If true, check freshness without writing. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True when current or written, otherwise false. |
Source code in src/se_theory_reference_kit/base/json_utils.py
67 68 69 70 71 72 73 74 75 76 77 78 | |
write_or_check_text
write_or_check_text(
path: Path, content: str, *, check: bool
) -> bool
Write a file or check whether it is current.
Returns true when the file is current or was written. Returns false when check mode finds stale content.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path
|
Output path. |
required |
content
|
str
|
Expected file content. |
required |
check
|
bool
|
If true, check freshness without writing. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True when current or written, otherwise false. |
Source code in src/se_theory_reference_kit/base/json_utils.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | |
paths
base/paths.py - Repository-relative path helpers.
find_repository_root
find_repository_root(start: Path | None = None) -> Path
Find the nearest repository root from a starting path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
start
|
Path | None
|
Starting path. Defaults to the current working directory. |
None
|
Returns:
| Type | Description |
|---|---|
Path
|
Resolved repository root path. |
Raises:
| Type | Description |
|---|---|
RepositoryRootError
|
If no repository root marker is found. |
Source code in src/se_theory_reference_kit/base/paths.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | |
lean_module_to_path
lean_module_to_path(
module: str,
*,
root: Path | None = None,
lean_public_root: str,
) -> Path
Resolve a Lean module name to its repository source path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
module
|
str
|
Lean module name. |
required |
root
|
Path | None
|
Repository root. |
None
|
lean_public_root
|
str
|
Expected public Lean root for the owning repository. |
required |
Returns:
| Type | Description |
|---|---|
Path
|
Repository-contained Lean source path. |
Raises:
| Type | Description |
|---|---|
PathResolutionError
|
If the module name is empty, path-like, malformed, or outside the declared public Lean root. |
Source code in src/se_theory_reference_kit/base/paths.py
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | |
reference_artifact_path
reference_artifact_path(
path: str | Path,
*,
root: Path | None = None,
reference_dir_name: str = "reference",
) -> Path
Resolve a declared reference artifact path.
The declared path must be repository-relative and under the reference directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | Path
|
Declared repository-relative artifact path. |
required |
root
|
Path | None
|
Repository root. |
None
|
reference_dir_name
|
str
|
Name of the reference artifact directory. |
'reference'
|
Returns:
| Type | Description |
|---|---|
Path
|
Resolved reference artifact path. |
Raises:
| Type | Description |
|---|---|
PathResolutionError
|
If the path is outside the reference directory. |
Source code in src/se_theory_reference_kit/base/paths.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | |
reference_dir
reference_dir(
*,
root: Path | None = None,
reference_dir_name: str = "reference",
) -> Path
Return the repository reference directory.
Source code in src/se_theory_reference_kit/base/paths.py
63 64 65 66 67 68 69 | |
repo_relative_path
repo_relative_path(path: Path, repo_root: Path) -> str
Return a repository-relative POSIX path.
Source code in src/se_theory_reference_kit/base/paths.py
155 156 157 | |
resolve_repo_path
resolve_repo_path(
path: str | Path, *, root: Path | None = None
) -> Path
Resolve a path as repository-relative and contained within the repository.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | Path
|
Repository-relative path. |
required |
root
|
Path | None
|
Repository root. Defaults to nearest detected repository root. |
None
|
Returns:
| Type | Description |
|---|---|
Path
|
Resolved absolute path. |
Raises:
| Type | Description |
|---|---|
PathResolutionError
|
If the path escapes the repository root. |
Source code in src/se_theory_reference_kit/base/paths.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | |
results
validation/results.py - Result vocabulary for theory-reference checks.
CheckResult
dataclass
One validation finding emitted by one check.
Attributes:
| Name | Type | Description |
|---|---|---|
check_id |
str
|
Stable id of the check that emitted the finding. |
status |
CheckStatus
|
Check status. |
severity |
CheckSeverity
|
Finding severity. |
message |
str
|
Human-readable finding message. |
artifact_id |
str | None
|
Optional artifact id associated with the finding. |
path |
Path | None
|
Optional path associated with the finding. |
detail |
JsonDetail
|
Optional structured detail for reports or downstream tooling. |
Source code in src/se_theory_reference_kit/base/results.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | |
CheckSeverity
Bases: StrEnum
Severity vocabulary for one validation finding.
Source code in src/se_theory_reference_kit/base/results.py
38 39 40 41 42 43 | |
CheckStatus
Bases: StrEnum
Status vocabulary for one validation finding.
Source code in src/se_theory_reference_kit/base/results.py
29 30 31 32 33 34 35 | |
cannot_verify
cannot_verify(
check_id: str,
message: str,
*,
artifact_id: str | None = None,
path: Path | None = None,
detail: JsonDetail | None = None,
) -> CheckResult
Create a cannot-verify result.
Source code in src/se_theory_reference_kit/base/results.py
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | |
empty_detail
empty_detail() -> JsonDetail
Return an empty result detail dictionary.
Source code in src/se_theory_reference_kit/base/results.py
24 25 26 | |
failure
failure(
check_id: str,
message: str,
*,
artifact_id: str | None = None,
path: Path | None = None,
detail: JsonDetail | None = None,
) -> CheckResult
Create an error failure result.
Source code in src/se_theory_reference_kit/base/results.py
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | |
ok
ok(
check_id: str,
message: str,
*,
artifact_id: str | None = None,
path: Path | None = None,
detail: JsonDetail | None = None,
) -> CheckResult
Create an ok result.
Source code in src/se_theory_reference_kit/base/results.py
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | |
partial
partial(
check_id: str,
message: str,
*,
artifact_id: str | None = None,
path: Path | None = None,
detail: JsonDetail | None = None,
) -> CheckResult
Create a partial result.
Source code in src/se_theory_reference_kit/base/results.py
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | |
warning
warning(
check_id: str,
message: str,
*,
artifact_id: str | None = None,
path: Path | None = None,
detail: JsonDetail | None = None,
) -> CheckResult
Create a warning failure result.
Source code in src/se_theory_reference_kit/base/results.py
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | |
worst_status
worst_status(results: Iterable[CheckResult]) -> CheckStatus
Return the worst status across validation results.
Source code in src/se_theory_reference_kit/base/results.py
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | |
Declarations
se_theory_reference_kit.declarations
declarations/init.py - Typed declarations consumed by the generic engine.
ExportSpec
dataclass
A generated JSON artifact export specification.
Source code in src/se_theory_reference_kit/declarations/export_spec.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | |
specs_from_toml
classmethod
specs_from_toml(
data: Mapping[str, object],
) -> tuple[Self, ...]
Build export specs by joining [surface_kinds] and [export_map].
Kit-owned convention for each non-catalog kind present in both maps
source_table = kind payload_key = kind schema = f"se-theory-{artifact_slug}-{kind}-registry"
Source code in src/se_theory_reference_kit/declarations/export_spec.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | |
SurfaceSymbols
dataclass
Kinded public Lean surface symbols for one theory repository.
Source code in src/se_theory_reference_kit/declarations/surface.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | |
all_symbols
property
all_symbols: frozenset[str]
Return all declared public surface symbols.
from_optional_kinds
classmethod
from_optional_kinds(
*,
types: frozenset[str] = EMPTY_STRING_SET,
predicates: frozenset[str] = EMPTY_STRING_SET,
axioms: frozenset[str] = EMPTY_STRING_SET,
theorems: frozenset[str] = EMPTY_STRING_SET,
requirements: frozenset[str] = EMPTY_STRING_SET,
vocabulary: frozenset[str] = EMPTY_STRING_SET,
witnesses: frozenset[str] = EMPTY_STRING_SET,
) -> Self
Build a surface declaration from common optional surface kinds.
Source code in src/se_theory_reference_kit/declarations/surface.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | |
symbols_for_kind
symbols_for_kind(kind: str) -> frozenset[str]
Return public symbols for one surface kind.
Source code in src/se_theory_reference_kit/declarations/surface.py
19 20 21 | |
TheoryReferenceConfig
dataclass
Repository-specific configuration consumed by the generic engine.
Source code in src/se_theory_reference_kit/declarations/config.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | |
from_toml
classmethod
from_toml(data: Mapping[str, object]) -> Self
Build configuration from a parsed theory-reference.toml mapping.
Source code in src/se_theory_reference_kit/declarations/config.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | |
config
declarations/config.py - Repository-specific configuration model.
TheoryReferenceConfig
dataclass
Repository-specific configuration consumed by the generic engine.
Source code in src/se_theory_reference_kit/declarations/config.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | |
from_toml
classmethod
from_toml(data: Mapping[str, object]) -> Self
Build configuration from a parsed theory-reference.toml mapping.
Source code in src/se_theory_reference_kit/declarations/config.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | |
export_spec
declarations/export_spec.py - Repo-owned generated export specification shape.
ExportSpec
dataclass
A generated JSON artifact export specification.
Source code in src/se_theory_reference_kit/declarations/export_spec.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | |
specs_from_toml
classmethod
specs_from_toml(
data: Mapping[str, object],
) -> tuple[Self, ...]
Build export specs by joining [surface_kinds] and [export_map].
Kit-owned convention for each non-catalog kind present in both maps
source_table = kind payload_key = kind schema = f"se-theory-{artifact_slug}-{kind}-registry"
Source code in src/se_theory_reference_kit/declarations/export_spec.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | |
surface
declarations/surface.py - Repo-owned Lean public surface declaration shape.
SurfaceSymbols
dataclass
Kinded public Lean surface symbols for one theory repository.
Source code in src/se_theory_reference_kit/declarations/surface.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | |
all_symbols
property
all_symbols: frozenset[str]
Return all declared public surface symbols.
from_optional_kinds
classmethod
from_optional_kinds(
*,
types: frozenset[str] = EMPTY_STRING_SET,
predicates: frozenset[str] = EMPTY_STRING_SET,
axioms: frozenset[str] = EMPTY_STRING_SET,
theorems: frozenset[str] = EMPTY_STRING_SET,
requirements: frozenset[str] = EMPTY_STRING_SET,
vocabulary: frozenset[str] = EMPTY_STRING_SET,
witnesses: frozenset[str] = EMPTY_STRING_SET,
) -> Self
Build a surface declaration from common optional surface kinds.
Source code in src/se_theory_reference_kit/declarations/surface.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | |
symbols_for_kind
symbols_for_kind(kind: str) -> frozenset[str]
Return public symbols for one surface kind.
Source code in src/se_theory_reference_kit/declarations/surface.py
19 20 21 | |
Lean
se_theory_reference_kit.lean
lean/init.py - Generic Lean source inspection helpers.
LeanDecl
dataclass
Lean declaration with name, kind, and reference section.
Source code in src/se_theory_reference_kit/lean/declarations.py
53 54 55 56 57 58 59 | |
expected_symbols_for_kind
expected_symbols_for_kind(
surface: SurfaceSymbols, kind: str
) -> frozenset[str]
Return expected public Lean symbols for a surface kind.
Missing kinds return an empty set. The owning theory repository supplies the surface symbols; the kit only reads the generic shape.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
surface
|
SurfaceSymbols
|
Repo-owned public surface declaration. |
required |
kind
|
str
|
Surface kind. |
required |
Returns:
| Type | Description |
|---|---|
frozenset[str]
|
Expected symbols for that kind. |
Source code in src/se_theory_reference_kit/lean/surface.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | |
extract_decls
extract_decls(lean_file: Path) -> list[LeanDecl]
Extract top-level Lean declarations from a Lean file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lean_file
|
Path
|
Lean source file. |
required |
Returns:
| Type | Description |
|---|---|
list[LeanDecl]
|
Extracted declarations. Missing files return an empty list. |
Source code in src/se_theory_reference_kit/lean/declarations.py
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | |
extract_for_section
extract_for_section(
lean_file: Path, target_section: str
) -> list[LeanDecl]
Extract Lean declarations matching a reference section.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lean_file
|
Path
|
Lean source file. |
required |
target_section
|
str
|
Reference section name. |
required |
Returns:
| Type | Description |
|---|---|
list[LeanDecl]
|
Declarations whose Lean kind belongs to the requested section. |
Source code in src/se_theory_reference_kit/lean/declarations.py
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | |
extract_spec_ids
extract_spec_ids(spec_file: Path) -> set[str]
Extract stable citation ids from a Lean Spec file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spec_file
|
Path
|
Lean Spec source file. |
required |
Returns:
| Type | Description |
|---|---|
set[str]
|
Citation id string values. Missing files return an empty set. |
Source code in src/se_theory_reference_kit/lean/spec.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 | |
infer_core_modules
infer_core_modules(
surface_module: str, lean_root: Path
) -> list[str]
Infer Core modules under a public Surface module namespace.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
surface_module
|
str
|
Public surface module, typically ending in ".Surface". |
required |
lean_root
|
Path
|
Lean source root. |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
Inferred Core module names. Returns an empty list when the surface module |
list[str]
|
does not follow the expected Surface naming pattern or no Core files are |
list[str]
|
found. |
Source code in src/se_theory_reference_kit/lean/modules.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | |
infer_spec_module
infer_spec_module(surface_module: str) -> str
Infer the Spec module from the public surface module.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
surface_module
|
str
|
Public surface module. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Inferred Spec module name. |
Source code in src/se_theory_reference_kit/lean/spec.py
40 41 42 43 44 45 46 47 48 49 50 51 52 | |
lean_module_to_relative_path
lean_module_to_relative_path(module: str) -> Path
Convert a Lean module name to a relative Lean source path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
module
|
str
|
Lean module name. |
required |
Returns:
| Type | Description |
|---|---|
Path
|
Relative Lean source path. |
Raises:
| Type | Description |
|---|---|
PathResolutionError
|
If the module name is empty, malformed, or path-like. |
Source code in src/se_theory_reference_kit/lean/modules.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | |
missing_expected_surface_symbols
missing_expected_surface_symbols(
*, surface: SurfaceSymbols, registered: set[str]
) -> set[str]
Return expected public-surface symbols missing from reference registries.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
surface
|
SurfaceSymbols
|
Repo-owned public surface declaration. |
required |
registered
|
set[str]
|
Lean symbols already registered in reference artifacts. |
required |
Returns:
| Type | Description |
|---|---|
set[str]
|
Expected symbols not present in registered symbols. |
Source code in src/se_theory_reference_kit/lean/surface.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | |
path_to_module
path_to_module(path: Path, lean_root: Path) -> str
Convert a Lean file path to a Lean module name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path
|
Lean source file. |
required |
lean_root
|
Path
|
Root directory used for module-relative path conversion. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Dotted Lean module name. |
Source code in src/se_theory_reference_kit/lean/modules.py
46 47 48 49 50 51 52 53 54 55 56 57 | |
declarations
lean/declarations.py - Extract generic Lean declarations from source files.
LeanDecl
dataclass
Lean declaration with name, kind, and reference section.
Source code in src/se_theory_reference_kit/lean/declarations.py
53 54 55 56 57 58 59 | |
extract_decls
extract_decls(lean_file: Path) -> list[LeanDecl]
Extract top-level Lean declarations from a Lean file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lean_file
|
Path
|
Lean source file. |
required |
Returns:
| Type | Description |
|---|---|
list[LeanDecl]
|
Extracted declarations. Missing files return an empty list. |
Source code in src/se_theory_reference_kit/lean/declarations.py
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | |
extract_for_section
extract_for_section(
lean_file: Path, target_section: str
) -> list[LeanDecl]
Extract Lean declarations matching a reference section.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lean_file
|
Path
|
Lean source file. |
required |
target_section
|
str
|
Reference section name. |
required |
Returns:
| Type | Description |
|---|---|
list[LeanDecl]
|
Declarations whose Lean kind belongs to the requested section. |
Source code in src/se_theory_reference_kit/lean/declarations.py
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | |
modules
lean/modules.py - Convert between Lean module names and source paths.
infer_core_modules
infer_core_modules(
surface_module: str, lean_root: Path
) -> list[str]
Infer Core modules under a public Surface module namespace.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
surface_module
|
str
|
Public surface module, typically ending in ".Surface". |
required |
lean_root
|
Path
|
Lean source root. |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
Inferred Core module names. Returns an empty list when the surface module |
list[str]
|
does not follow the expected Surface naming pattern or no Core files are |
list[str]
|
found. |
Source code in src/se_theory_reference_kit/lean/modules.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | |
lean_module_to_relative_path
lean_module_to_relative_path(module: str) -> Path
Convert a Lean module name to a relative Lean source path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
module
|
str
|
Lean module name. |
required |
Returns:
| Type | Description |
|---|---|
Path
|
Relative Lean source path. |
Raises:
| Type | Description |
|---|---|
PathResolutionError
|
If the module name is empty, malformed, or path-like. |
Source code in src/se_theory_reference_kit/lean/modules.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | |
path_to_module
path_to_module(path: Path, lean_root: Path) -> str
Convert a Lean file path to a Lean module name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path
|
Lean source file. |
required |
lean_root
|
Path
|
Root directory used for module-relative path conversion. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Dotted Lean module name. |
Source code in src/se_theory_reference_kit/lean/modules.py
46 47 48 49 50 51 52 53 54 55 56 57 | |
spec
lean/spec.py - Extract stable citation identifiers from Lean spec files.
extract_spec_ids
extract_spec_ids(spec_file: Path) -> set[str]
Extract stable citation ids from a Lean Spec file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spec_file
|
Path
|
Lean Spec source file. |
required |
Returns:
| Type | Description |
|---|---|
set[str]
|
Citation id string values. Missing files return an empty set. |
Source code in src/se_theory_reference_kit/lean/spec.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 | |
infer_spec_module
infer_spec_module(surface_module: str) -> str
Infer the Spec module from the public surface module.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
surface_module
|
str
|
Public surface module. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Inferred Spec module name. |
Source code in src/se_theory_reference_kit/lean/spec.py
40 41 42 43 44 45 46 47 48 49 50 51 52 | |
surface
lean/surface.py - Compare repo-owned public surface declarations.
expected_symbols_for_kind
expected_symbols_for_kind(
surface: SurfaceSymbols, kind: str
) -> frozenset[str]
Return expected public Lean symbols for a surface kind.
Missing kinds return an empty set. The owning theory repository supplies the surface symbols; the kit only reads the generic shape.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
surface
|
SurfaceSymbols
|
Repo-owned public surface declaration. |
required |
kind
|
str
|
Surface kind. |
required |
Returns:
| Type | Description |
|---|---|
frozenset[str]
|
Expected symbols for that kind. |
Source code in src/se_theory_reference_kit/lean/surface.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | |
missing_expected_surface_symbols
missing_expected_surface_symbols(
*, surface: SurfaceSymbols, registered: set[str]
) -> set[str]
Return expected public-surface symbols missing from reference registries.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
surface
|
SurfaceSymbols
|
Repo-owned public surface declaration. |
required |
registered
|
set[str]
|
Lean symbols already registered in reference artifacts. |
required |
Returns:
| Type | Description |
|---|---|
set[str]
|
Expected symbols not present in registered symbols. |
Source code in src/se_theory_reference_kit/lean/surface.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | |
Reference
se_theory_reference_kit.reference
reference/init.py - Generic reference artifact tooling.
LoadedReferenceArtifact
dataclass
Loaded reference artifact.
Attributes:
| Name | Type | Description |
|---|---|---|
artifact_id |
str
|
Stable artifact id from the reference index. |
path |
Path
|
Resolved artifact path. |
kind |
str
|
Artifact kind declared by the owning repository. |
data |
ReferenceDocument
|
Parsed TOML data. |
Source code in src/se_theory_reference_kit/reference/artifacts.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | |
ReferenceRegistry
dataclass
Loaded reference artifact registry.
Attributes:
| Name | Type | Description |
|---|---|---|
artifacts |
tuple[LoadedReferenceArtifact, ...]
|
Loaded reference artifacts in index order. |
Source code in src/se_theory_reference_kit/reference/registry.py
25 26 27 28 29 30 31 32 33 34 35 36 37 | |
by_id
by_id() -> dict[str, LoadedReferenceArtifact]
Return loaded artifacts keyed by artifact id.
Source code in src/se_theory_reference_kit/reference/registry.py
35 36 37 | |
build_reference_registry
build_reference_registry(
artifact_declarations: list[ArtifactDeclaration],
*,
root: Path,
reference_dir_name: str = "reference",
) -> ReferenceRegistry
Build a registry from artifact declarations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
artifact_declarations
|
list[ArtifactDeclaration]
|
Artifact declarations from reference/index.toml. |
required |
root
|
Path
|
Repository root. |
required |
reference_dir_name
|
str
|
Reference directory name. |
'reference'
|
Returns:
| Type | Description |
|---|---|
ReferenceRegistry
|
Loaded reference registry. |
Source code in src/se_theory_reference_kit/reference/registry.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | |
discover_reference_artifacts
discover_reference_artifacts(
*,
root: Path | None = None,
reference_dir_name: str = "reference",
) -> tuple[Path, ...]
Discover TOML reference artifacts under the reference directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root
|
Path | None
|
Repository root. |
None
|
reference_dir_name
|
str
|
Reference directory name. |
'reference'
|
Returns:
| Type | Description |
|---|---|
tuple[Path, ...]
|
Sorted reference TOML paths. |
Source code in src/se_theory_reference_kit/reference/artifacts.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | |
load_reference_artifact
load_reference_artifact(
artifact: ArtifactDeclaration,
*,
root: Path,
reference_dir_name: str = "reference",
) -> LoadedReferenceArtifact
Load one reference artifact declared in the reference index.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
artifact
|
ArtifactDeclaration
|
Artifact declaration from reference/index.toml. |
required |
root
|
Path
|
Repository root. |
required |
reference_dir_name
|
str
|
Reference directory name. |
'reference'
|
Returns:
| Type | Description |
|---|---|
LoadedReferenceArtifact
|
Loaded reference artifact. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the declaration lacks a valid path. |
Source code in src/se_theory_reference_kit/reference/artifacts.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | |
make_stub
make_stub(
declaration: LeanDecl, source_module: str
) -> ReferenceEntry
Create a generic reference entry stub for a Lean declaration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
declaration
|
LeanDecl
|
Lean declaration. |
required |
source_module
|
str
|
Source module for the declaration. |
required |
Returns:
| Type | Description |
|---|---|
ReferenceEntry
|
Reference entry stub. |
Source code in src/se_theory_reference_kit/reference/stubs.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | |
merge_entry
merge_entry(
existing: ReferenceEntry,
generated: ReferenceEntry,
*,
overwrite: bool,
) -> ReferenceEntry
Merge an existing hand-authored entry with generated fields.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
existing
|
ReferenceEntry
|
Existing entry. |
required |
generated
|
ReferenceEntry
|
Generated stub fields. |
required |
overwrite
|
bool
|
If true, generated values replace existing values. |
required |
Returns:
| Type | Description |
|---|---|
ReferenceEntry
|
Merged entry. |
Source code in src/se_theory_reference_kit/reference/stubs.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | |
ordered_table_values
ordered_table_values(
document: ReferenceDocument, table_name: str
) -> list[dict[str, object]]
Return nested table values sorted by order, then id/key.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
document
|
ReferenceDocument
|
Parsed reference artifact. |
required |
table_name
|
str
|
Top-level table name. |
required |
Returns:
| Type | Description |
|---|---|
list[dict[str, object]]
|
Ordered table entries. Each entry receives an id if missing. |
Raises:
| Type | Description |
|---|---|
TypeError
|
If the table or entries are not tables. |
Source code in src/se_theory_reference_kit/reference/artifacts.py
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | |
reference_artifact_meta
reference_artifact_meta(
document: ReferenceDocument,
) -> dict[str, object]
Return normalized metadata from a reference artifact.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
document
|
ReferenceDocument
|
Parsed reference artifact. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, object]
|
Copy of the [meta] table, or an empty dictionary when absent. |
Raises:
| Type | Description |
|---|---|
TypeError
|
If [meta] is present but not a table. |
Source code in src/se_theory_reference_kit/reference/artifacts.py
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | |
reference_stub_key
reference_stub_key(declaration: LeanDecl) -> str
Return the default reference stub key for a Lean declaration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
declaration
|
LeanDecl
|
Lean declaration. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Stub key. |
Source code in src/se_theory_reference_kit/reference/stubs.py
10 11 12 13 14 15 16 17 18 19 | |
registered_lean_symbols
registered_lean_symbols(
registry: ReferenceRegistry,
*,
sections: frozenset[str] | None = None,
) -> set[str]
Return Lean symbols registered in reference artifacts.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
registry
|
ReferenceRegistry
|
Loaded reference registry. |
required |
sections
|
frozenset[str] | None
|
Optional section filter. |
None
|
Returns:
| Type | Description |
|---|---|
set[str]
|
Registered Lean symbol names. |
Source code in src/se_theory_reference_kit/reference/registry.py
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | |
section_entries
section_entries(
data: ReferenceDocument, section: str
) -> SectionEntries
Return table entries for a reference section.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
ReferenceDocument
|
Parsed reference artifact. |
required |
section
|
str
|
Section name. |
required |
Returns:
| Type | Description |
|---|---|
SectionEntries
|
Section entries keyed by entry id. |
Source code in src/se_theory_reference_kit/reference/registry.py
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | |
source_modules_in_registry
source_modules_in_registry(
data: ReferenceDocument,
) -> list[str]
Return source modules declared inside a reference artifact.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
ReferenceDocument
|
Parsed reference artifact. |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
Source module names in first-seen order. |
Source code in src/se_theory_reference_kit/reference/registry.py
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 | |
validate_reference_artifact_shape
validate_reference_artifact_shape(
*, check_id: str, artifact: LoadedReferenceArtifact
) -> tuple[CheckResult, ...]
Validate generic reference artifact shape.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
check_id
|
str
|
Validation check id. |
required |
artifact
|
LoadedReferenceArtifact
|
Loaded reference artifact. |
required |
Returns:
| Type | Description |
|---|---|
tuple[CheckResult, ...]
|
Validation findings. |
Source code in src/se_theory_reference_kit/reference/validation.py
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | |
validate_required_fields
validate_required_fields(
*,
check_id: str,
artifact: LoadedReferenceArtifact,
section: str,
required_fields: Iterable[str] = REQUIRED_ENTRY_FIELDS,
) -> tuple[CheckResult, ...]
Validate required fields for all entries in one reference section.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
check_id
|
str
|
Validation check id. |
required |
artifact
|
LoadedReferenceArtifact
|
Loaded reference artifact. |
required |
section
|
str
|
Section name. |
required |
required_fields
|
Iterable[str]
|
Required field names. |
REQUIRED_ENTRY_FIELDS
|
Returns:
| Type | Description |
|---|---|
tuple[CheckResult, ...]
|
Validation findings. |
Source code in src/se_theory_reference_kit/reference/validation.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | |
artifacts
reference/artifacts.py - Reference artifact discovery and loading.
LoadedReferenceArtifact
dataclass
Loaded reference artifact.
Attributes:
| Name | Type | Description |
|---|---|---|
artifact_id |
str
|
Stable artifact id from the reference index. |
path |
Path
|
Resolved artifact path. |
kind |
str
|
Artifact kind declared by the owning repository. |
data |
ReferenceDocument
|
Parsed TOML data. |
Source code in src/se_theory_reference_kit/reference/artifacts.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | |
discover_reference_artifacts
discover_reference_artifacts(
*,
root: Path | None = None,
reference_dir_name: str = "reference",
) -> tuple[Path, ...]
Discover TOML reference artifacts under the reference directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root
|
Path | None
|
Repository root. |
None
|
reference_dir_name
|
str
|
Reference directory name. |
'reference'
|
Returns:
| Type | Description |
|---|---|
tuple[Path, ...]
|
Sorted reference TOML paths. |
Source code in src/se_theory_reference_kit/reference/artifacts.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | |
load_reference_artifact
load_reference_artifact(
artifact: ArtifactDeclaration,
*,
root: Path,
reference_dir_name: str = "reference",
) -> LoadedReferenceArtifact
Load one reference artifact declared in the reference index.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
artifact
|
ArtifactDeclaration
|
Artifact declaration from reference/index.toml. |
required |
root
|
Path
|
Repository root. |
required |
reference_dir_name
|
str
|
Reference directory name. |
'reference'
|
Returns:
| Type | Description |
|---|---|
LoadedReferenceArtifact
|
Loaded reference artifact. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the declaration lacks a valid path. |
Source code in src/se_theory_reference_kit/reference/artifacts.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | |
ordered_table_values
ordered_table_values(
document: ReferenceDocument, table_name: str
) -> list[dict[str, object]]
Return nested table values sorted by order, then id/key.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
document
|
ReferenceDocument
|
Parsed reference artifact. |
required |
table_name
|
str
|
Top-level table name. |
required |
Returns:
| Type | Description |
|---|---|
list[dict[str, object]]
|
Ordered table entries. Each entry receives an id if missing. |
Raises:
| Type | Description |
|---|---|
TypeError
|
If the table or entries are not tables. |
Source code in src/se_theory_reference_kit/reference/artifacts.py
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | |
reference_artifact_meta
reference_artifact_meta(
document: ReferenceDocument,
) -> dict[str, object]
Return normalized metadata from a reference artifact.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
document
|
ReferenceDocument
|
Parsed reference artifact. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, object]
|
Copy of the [meta] table, or an empty dictionary when absent. |
Raises:
| Type | Description |
|---|---|
TypeError
|
If [meta] is present but not a table. |
Source code in src/se_theory_reference_kit/reference/artifacts.py
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | |
registry
reference/registry.py - Reference artifact registry helpers.
ReferenceRegistry
dataclass
Loaded reference artifact registry.
Attributes:
| Name | Type | Description |
|---|---|---|
artifacts |
tuple[LoadedReferenceArtifact, ...]
|
Loaded reference artifacts in index order. |
Source code in src/se_theory_reference_kit/reference/registry.py
25 26 27 28 29 30 31 32 33 34 35 36 37 | |
by_id
by_id() -> dict[str, LoadedReferenceArtifact]
Return loaded artifacts keyed by artifact id.
Source code in src/se_theory_reference_kit/reference/registry.py
35 36 37 | |
build_reference_registry
build_reference_registry(
artifact_declarations: list[ArtifactDeclaration],
*,
root: Path,
reference_dir_name: str = "reference",
) -> ReferenceRegistry
Build a registry from artifact declarations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
artifact_declarations
|
list[ArtifactDeclaration]
|
Artifact declarations from reference/index.toml. |
required |
root
|
Path
|
Repository root. |
required |
reference_dir_name
|
str
|
Reference directory name. |
'reference'
|
Returns:
| Type | Description |
|---|---|
ReferenceRegistry
|
Loaded reference registry. |
Source code in src/se_theory_reference_kit/reference/registry.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | |
build_registry_from_config
build_registry_from_config(
repo_root: Path, config: TheoryReferenceConfig
) -> ReferenceRegistry
Build the full reference registry from the config artifact sources.
Source code in src/se_theory_reference_kit/reference/registry.py
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | |
build_surface_symbols
build_surface_symbols(
repo_root: Path, config: TheoryReferenceConfig
) -> SurfaceSymbols
Derive the public surface from the mapped reference artifacts.
Source code in src/se_theory_reference_kit/reference/registry.py
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | |
extract_unique_source_modules
extract_unique_source_modules(
modules: list[str],
seen: set[str],
section_map: dict[str, object],
) -> None
Extract unique source modules from a section map.
Source code in src/se_theory_reference_kit/reference/registry.py
197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | |
registered_lean_symbols
registered_lean_symbols(
registry: ReferenceRegistry,
*,
sections: frozenset[str] | None = None,
) -> set[str]
Return Lean symbols registered in reference artifacts.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
registry
|
ReferenceRegistry
|
Loaded reference registry. |
required |
sections
|
frozenset[str] | None
|
Optional section filter. |
None
|
Returns:
| Type | Description |
|---|---|
set[str]
|
Registered Lean symbol names. |
Source code in src/se_theory_reference_kit/reference/registry.py
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | |
section_entries
section_entries(
data: ReferenceDocument, section: str
) -> SectionEntries
Return table entries for a reference section.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
ReferenceDocument
|
Parsed reference artifact. |
required |
section
|
str
|
Section name. |
required |
Returns:
| Type | Description |
|---|---|
SectionEntries
|
Section entries keyed by entry id. |
Source code in src/se_theory_reference_kit/reference/registry.py
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | |
source_modules_in_registry
source_modules_in_registry(
data: ReferenceDocument,
) -> list[str]
Return source modules declared inside a reference artifact.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
ReferenceDocument
|
Parsed reference artifact. |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
Source module names in first-seen order. |
Source code in src/se_theory_reference_kit/reference/registry.py
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 | |
stubs
reference/stubs.py - Generic reference stub construction.
make_stub
make_stub(
declaration: LeanDecl, source_module: str
) -> ReferenceEntry
Create a generic reference entry stub for a Lean declaration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
declaration
|
LeanDecl
|
Lean declaration. |
required |
source_module
|
str
|
Source module for the declaration. |
required |
Returns:
| Type | Description |
|---|---|
ReferenceEntry
|
Reference entry stub. |
Source code in src/se_theory_reference_kit/reference/stubs.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | |
merge_entry
merge_entry(
existing: ReferenceEntry,
generated: ReferenceEntry,
*,
overwrite: bool,
) -> ReferenceEntry
Merge an existing hand-authored entry with generated fields.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
existing
|
ReferenceEntry
|
Existing entry. |
required |
generated
|
ReferenceEntry
|
Generated stub fields. |
required |
overwrite
|
bool
|
If true, generated values replace existing values. |
required |
Returns:
| Type | Description |
|---|---|
ReferenceEntry
|
Merged entry. |
Source code in src/se_theory_reference_kit/reference/stubs.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | |
reference_stub_key
reference_stub_key(declaration: LeanDecl) -> str
Return the default reference stub key for a Lean declaration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
declaration
|
LeanDecl
|
Lean declaration. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Stub key. |
Source code in src/se_theory_reference_kit/reference/stubs.py
10 11 12 13 14 15 16 17 18 19 | |
validation
reference/validation.py - Generic reference artifact shape validation.
validate_reference_artifact_shape
validate_reference_artifact_shape(
*, check_id: str, artifact: LoadedReferenceArtifact
) -> tuple[CheckResult, ...]
Validate generic reference artifact shape.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
check_id
|
str
|
Validation check id. |
required |
artifact
|
LoadedReferenceArtifact
|
Loaded reference artifact. |
required |
Returns:
| Type | Description |
|---|---|
tuple[CheckResult, ...]
|
Validation findings. |
Source code in src/se_theory_reference_kit/reference/validation.py
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | |
validate_required_fields
validate_required_fields(
*,
check_id: str,
artifact: LoadedReferenceArtifact,
section: str,
required_fields: Iterable[str] = REQUIRED_ENTRY_FIELDS,
) -> tuple[CheckResult, ...]
Validate required fields for all entries in one reference section.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
check_id
|
str
|
Validation check id. |
required |
artifact
|
LoadedReferenceArtifact
|
Loaded reference artifact. |
required |
section
|
str
|
Section name. |
required |
required_fields
|
Iterable[str]
|
Required field names. |
REQUIRED_ENTRY_FIELDS
|
Returns:
| Type | Description |
|---|---|
tuple[CheckResult, ...]
|
Validation findings. |
Source code in src/se_theory_reference_kit/reference/validation.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | |
Export
se_theory_reference_kit.export
export/init.py - Generic generated export helpers.
CatalogEntry
dataclass
Generic catalog entry for one loaded reference artifact.
Source code in src/se_theory_reference_kit/export/catalog.py
13 14 15 16 17 18 19 | |
ExportResult
dataclass
Result of one generated export operation.
Attributes:
| Name | Type | Description |
|---|---|---|
output_path |
Path
|
Generated output path. |
current |
bool
|
True when output is current or was written. |
wrote |
bool
|
True when output was written. |
checked |
bool
|
True when the operation ran in check mode. |
Source code in src/se_theory_reference_kit/export/engine.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | |
build_reference_catalog
build_reference_catalog(
*,
registry: ReferenceRegistry,
repo_root: Path,
schema: str,
source: str,
namespace: str,
artifact: str,
) -> JsonObject
Build a generic reference catalog from loaded reference artifacts.
This function builds the common catalog envelope and reference path list. Repo-specific catalog payload sections remain owned by the theory repo.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
registry
|
ReferenceRegistry
|
Loaded reference registry. |
required |
repo_root
|
Path
|
Repository root used to produce portable relative paths. |
required |
schema
|
str
|
Catalog schema id. |
required |
source
|
str
|
Owning repository slug. |
required |
namespace
|
str
|
Reference namespace. |
required |
artifact
|
str
|
Catalog artifact name. |
required |
Returns:
| Type | Description |
|---|---|
JsonObject
|
JSON-compatible catalog payload. |
Source code in src/se_theory_reference_kit/export/catalog.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | |
build_registry_payload
build_registry_payload(
*,
spec: ExportSpec,
document: ReferenceDocument,
source_path: Path,
repo_root: Path,
repo_slug: str,
reference_namespace: str,
) -> JsonObject
Build one generated registry payload from one reference artifact.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spec
|
ExportSpec
|
Repo-owned export specification. |
required |
document
|
ReferenceDocument
|
Parsed reference artifact. |
required |
source_path
|
Path
|
Source reference artifact path. |
required |
repo_root
|
Path
|
Repository root used to produce portable relative paths. |
required |
repo_slug
|
str
|
Owning repository slug. |
required |
reference_namespace
|
str
|
Reference namespace for generated payloads. |
required |
Returns:
| Type | Description |
|---|---|
JsonObject
|
JSON-compatible generated registry payload. |
Source code in src/se_theory_reference_kit/export/engine.py
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | |
export_registries
export_registries(
*,
specs: tuple[ExportSpec, ...],
registry: ReferenceRegistry,
repo_root: Path,
reference_root: Path,
output_root: Path,
repo_slug: str,
reference_namespace: str,
check: bool,
) -> tuple[ExportResult, ...]
Export generated registry JSON artifacts.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
specs
|
tuple[ExportSpec, ...]
|
Repo-owned export specifications. |
required |
registry
|
ReferenceRegistry
|
Loaded reference registry. |
required |
repo_root
|
Path
|
Repository root used to produce portable relative paths. |
required |
reference_root
|
Path
|
Reference artifact root. |
required |
output_root
|
Path
|
Generated output root. |
required |
repo_slug
|
str
|
Owning repository slug. |
required |
reference_namespace
|
str
|
Reference namespace. |
required |
check
|
bool
|
If true, check freshness without writing. |
required |
Returns:
| Type | Description |
|---|---|
tuple[ExportResult, ...]
|
Export results. |
Source code in src/se_theory_reference_kit/export/engine.py
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 | |
export_registry
export_registry(
*,
spec: ExportSpec,
registry: ReferenceRegistry,
repo_root: Path,
reference_root: Path,
output_root: Path,
repo_slug: str,
reference_namespace: str,
check: bool,
) -> ExportResult
Export one registry JSON artifact.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spec
|
ExportSpec
|
Repo-owned export specification. |
required |
registry
|
ReferenceRegistry
|
Loaded reference registry. |
required |
repo_root
|
Path
|
Repository root used to produce portable relative paths. |
required |
reference_root
|
Path
|
Reference artifact root used to locate source artifacts. |
required |
output_root
|
Path
|
Generated output root. |
required |
repo_slug
|
str
|
Owning repository slug. |
required |
reference_namespace
|
str
|
Reference namespace. |
required |
check
|
bool
|
If true, check freshness without writing. |
required |
Returns:
| Type | Description |
|---|---|
ExportResult
|
Export result. |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If the source artifact is not loaded in the registry. |
Source code in src/se_theory_reference_kit/export/engine.py
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | |
catalog
export/catalog.py - Generic reference catalog construction.
CatalogEntry
dataclass
Generic catalog entry for one loaded reference artifact.
Source code in src/se_theory_reference_kit/export/catalog.py
13 14 15 16 17 18 19 | |
build_reference_catalog
build_reference_catalog(
*,
registry: ReferenceRegistry,
repo_root: Path,
schema: str,
source: str,
namespace: str,
artifact: str,
) -> JsonObject
Build a generic reference catalog from loaded reference artifacts.
This function builds the common catalog envelope and reference path list. Repo-specific catalog payload sections remain owned by the theory repo.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
registry
|
ReferenceRegistry
|
Loaded reference registry. |
required |
repo_root
|
Path
|
Repository root used to produce portable relative paths. |
required |
schema
|
str
|
Catalog schema id. |
required |
source
|
str
|
Owning repository slug. |
required |
namespace
|
str
|
Reference namespace. |
required |
artifact
|
str
|
Catalog artifact name. |
required |
Returns:
| Type | Description |
|---|---|
JsonObject
|
JSON-compatible catalog payload. |
Source code in src/se_theory_reference_kit/export/catalog.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | |
engine
export/engine.py - Generic generated JSON export engine.
ExportResult
dataclass
Result of one generated export operation.
Attributes:
| Name | Type | Description |
|---|---|---|
output_path |
Path
|
Generated output path. |
current |
bool
|
True when output is current or was written. |
wrote |
bool
|
True when output was written. |
checked |
bool
|
True when the operation ran in check mode. |
Source code in src/se_theory_reference_kit/export/engine.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | |
build_registry_payload
build_registry_payload(
*,
spec: ExportSpec,
document: ReferenceDocument,
source_path: Path,
repo_root: Path,
repo_slug: str,
reference_namespace: str,
) -> JsonObject
Build one generated registry payload from one reference artifact.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spec
|
ExportSpec
|
Repo-owned export specification. |
required |
document
|
ReferenceDocument
|
Parsed reference artifact. |
required |
source_path
|
Path
|
Source reference artifact path. |
required |
repo_root
|
Path
|
Repository root used to produce portable relative paths. |
required |
repo_slug
|
str
|
Owning repository slug. |
required |
reference_namespace
|
str
|
Reference namespace for generated payloads. |
required |
Returns:
| Type | Description |
|---|---|
JsonObject
|
JSON-compatible generated registry payload. |
Source code in src/se_theory_reference_kit/export/engine.py
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | |
export_registries
export_registries(
*,
specs: tuple[ExportSpec, ...],
registry: ReferenceRegistry,
repo_root: Path,
reference_root: Path,
output_root: Path,
repo_slug: str,
reference_namespace: str,
check: bool,
) -> tuple[ExportResult, ...]
Export generated registry JSON artifacts.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
specs
|
tuple[ExportSpec, ...]
|
Repo-owned export specifications. |
required |
registry
|
ReferenceRegistry
|
Loaded reference registry. |
required |
repo_root
|
Path
|
Repository root used to produce portable relative paths. |
required |
reference_root
|
Path
|
Reference artifact root. |
required |
output_root
|
Path
|
Generated output root. |
required |
repo_slug
|
str
|
Owning repository slug. |
required |
reference_namespace
|
str
|
Reference namespace. |
required |
check
|
bool
|
If true, check freshness without writing. |
required |
Returns:
| Type | Description |
|---|---|
tuple[ExportResult, ...]
|
Export results. |
Source code in src/se_theory_reference_kit/export/engine.py
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 | |
export_registry
export_registry(
*,
spec: ExportSpec,
registry: ReferenceRegistry,
repo_root: Path,
reference_root: Path,
output_root: Path,
repo_slug: str,
reference_namespace: str,
check: bool,
) -> ExportResult
Export one registry JSON artifact.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spec
|
ExportSpec
|
Repo-owned export specification. |
required |
registry
|
ReferenceRegistry
|
Loaded reference registry. |
required |
repo_root
|
Path
|
Repository root used to produce portable relative paths. |
required |
reference_root
|
Path
|
Reference artifact root used to locate source artifacts. |
required |
output_root
|
Path
|
Generated output root. |
required |
repo_slug
|
str
|
Owning repository slug. |
required |
reference_namespace
|
str
|
Reference namespace. |
required |
check
|
bool
|
If true, check freshness without writing. |
required |
Returns:
| Type | Description |
|---|---|
ExportResult
|
Export result. |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If the source artifact is not loaded in the registry. |
Source code in src/se_theory_reference_kit/export/engine.py
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | |
Validation
se_theory_reference_kit.validation
validation/init.py - Checks, registry, runner, and default check set.
Public surface
- Check, CheckRegistry the check contract and its catalogue
- CheckResult, CheckStatus, ... the result vocabulary
- RunReport, run_checks execution with crash isolation
- default_registry, DEFAULT_CHECKS the kit's fixed generic check set
Check
dataclass
A registered check: a function plus its catalogue metadata.
Attributes:
| Name | Type | Description |
|---|---|---|
check_id |
str
|
Stable, unique id. |
title |
str
|
Short human-readable description for logs and reports. |
run |
CheckFunc
|
The check function. |
strict_only |
bool
|
When true, the check runs only in strict mode. |
Source code in src/se_theory_reference_kit/validation/registry.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | |
CheckRegistry
dataclass
An immutable, ordered collection of checks.
Order is preserved so runs are deterministic and the default generic checks always precede consumer-appended checks. Ids must be unique across the registry.
Source code in src/se_theory_reference_kit/validation/registry.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | |
__post_init__
__post_init__() -> None
Reject duplicate check ids at construction time.
Source code in src/se_theory_reference_kit/validation/registry.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 | |
extend
extend(*checks: Check) -> Self
Return a new registry with the given checks appended.
The kit's defaults are never mutated; a consumer extends them. The returned registry preserves order and re-validates id uniqueness, so a consumer cannot shadow a default id.
Source code in src/se_theory_reference_kit/validation/registry.py
75 76 77 78 79 80 81 82 | |
extended_with
extended_with(checks: Iterable[Check]) -> Self
Return a new registry appending an iterable of checks.
Source code in src/se_theory_reference_kit/validation/registry.py
84 85 86 | |
ids
ids() -> tuple[str, ...]
Return the check ids in order.
Source code in src/se_theory_reference_kit/validation/registry.py
88 89 90 | |
select
select(*, strict: bool) -> Sequence[Check]
Return the checks that should run for the given mode.
In non-strict mode, strict-only checks are skipped. In strict mode, all checks run.
Source code in src/se_theory_reference_kit/validation/registry.py
92 93 94 95 96 97 98 99 100 101 | |
CheckResult
dataclass
One validation finding emitted by one check.
Attributes:
| Name | Type | Description |
|---|---|---|
check_id |
str
|
Stable id of the check that emitted the finding. |
status |
CheckStatus
|
Check status. |
severity |
CheckSeverity
|
Finding severity. |
message |
str
|
Human-readable finding message. |
artifact_id |
str | None
|
Optional artifact id associated with the finding. |
path |
Path | None
|
Optional path associated with the finding. |
detail |
JsonDetail
|
Optional structured detail for reports or downstream tooling. |
Source code in src/se_theory_reference_kit/base/results.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | |
CheckSeverity
Bases: StrEnum
Severity vocabulary for one validation finding.
Source code in src/se_theory_reference_kit/base/results.py
38 39 40 41 42 43 | |
CheckStatus
Bases: StrEnum
Status vocabulary for one validation finding.
Source code in src/se_theory_reference_kit/base/results.py
29 30 31 32 33 34 35 | |
ReferenceRunContext
dataclass
Resolved read-only context for theory-reference validation.
Source code in src/se_theory_reference_kit/validation/context.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | |
generated_root
property
generated_root: Path
Return the generated data directory.
reference_root
property
reference_root: Path
Return the reference artifact directory.
RunReport
dataclass
The outcome of running a registry against a context.
Attributes:
| Name | Type | Description |
|---|---|---|
results |
tuple[CheckResult, ...]
|
Every finding from every check, in check order. |
strict |
bool
|
Whether the run was executed in strict mode. |
overall_status |
CheckStatus
|
Worst status across all results. |
Source code in src/se_theory_reference_kit/validation/runner.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | |
exit_code
property
exit_code: int
Return the process exit code: 0 when passed, 1 otherwise.
failures
property
failures: tuple[CheckResult, ...]
Return results that count as failures for this run's mode.
Error-severity findings always count. Warning-severity findings count only under strict mode. Cannot-verify always counts.
passed
property
passed: bool
Return true when no findings count as failures for this mode.
default_registry
default_registry() -> CheckRegistry
Return the kit's default registry of generic checks.
Returns a fresh CheckRegistry each call. Consumers extend it to add repo-specific checks; the kit's defaults are never mutated.
Source code in src/se_theory_reference_kit/validation/defaults.py
54 55 56 57 58 59 60 | |
run_checks
run_checks(
*,
registry: CheckRegistry,
context: ReferenceRunContext,
strict: bool = False,
) -> RunReport
Run selected checks against the context with crash isolation.
Each check is executed independently. If a check raises ReferenceKitError, it is recorded as a cannot-verify result and the run continues. One broken check never hides the results of the others.
Source code in src/se_theory_reference_kit/validation/runner.py
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | |
checks
validation/checks/init.py - Generic theory-reference validation checks.
export
validation/checks/export.py - Validate generated export freshness.
check_exports_current
check_exports_current(
context: ReferenceRunContext,
) -> Iterable[CheckResult]
Verify generated export artifacts are current.
Source code in src/se_theory_reference_kit/validation/checks/export.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | |
lean_surface
validation/checks/lean_surface.py - Validate reference coverage of Lean surface.
check_lean_surface
check_lean_surface(
context: ReferenceRunContext,
) -> Iterable[CheckResult]
Verify expected public Lean symbols appear in reference artifacts.
Source code in src/se_theory_reference_kit/validation/checks/lean_surface.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | |
reference_artifacts
validation/checks/reference_artifacts.py - Validate declared reference artifacts.
check_reference_artifacts
check_reference_artifacts(
context: ReferenceRunContext,
) -> Iterable[CheckResult]
Verify declared reference artifacts exist, parse, and have generic shape.
Source code in src/se_theory_reference_kit/validation/checks/reference_artifacts.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | |
strict
validation/checks/strict.py - Strict-only unfinished-work marker check.
check_strict_no_todo
check_strict_no_todo(
context: ReferenceRunContext,
) -> Iterable[CheckResult]
Verify reference artifacts contain no unfinished-work markers.
Source code in src/se_theory_reference_kit/validation/checks/strict.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | |
context
validation/context.py - Context object for theory-reference validation checks.
ReferenceRunContext
dataclass
Resolved read-only context for theory-reference validation.
Source code in src/se_theory_reference_kit/validation/context.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | |
generated_root
property
generated_root: Path
Return the generated data directory.
reference_root
property
reference_root: Path
Return the reference artifact directory.
defaults
validation/defaults.py - The kit's fixed set of generic checks.
This is the single place that knows which checks the kit ships. registry.py is pure machinery and imports nothing from checks; individual checks import Check from registry. defaults.py sits above both, importing the machinery and checks to assemble the default registry. The dependency arrow is one-way:
registry <- checks <- defaults
so there is no cycle, and registry/checks can be reasoned about without knowing the default set.
Consuming repos build their own registry by extending this one:
from se_theory_reference_kit.validation.defaults import default_registry
registry = default_registry().extend(repo_specific_check)
The defaults are never edited by a consumer; extend() returns a new registry.
Default order
- reference.index reference/index.toml exists and parses
- reference.artifacts declared reference artifacts exist and parse
- lean.surface declared public surface is covered
- exports.current generated exports are current
- structural.strict.no-todo no unfinished-work markers (strict-only)
default_registry
default_registry() -> CheckRegistry
Return the kit's default registry of generic checks.
Returns a fresh CheckRegistry each call. Consumers extend it to add repo-specific checks; the kit's defaults are never mutated.
Source code in src/se_theory_reference_kit/validation/defaults.py
54 55 56 57 58 59 60 | |
registry
validation/registry.py - Check registry and consumer extension hook.
The kit provides a fixed set of default generic checks. Consuming theory repositories append repo-specific checks to that set without modifying the kit. The kit's defaults are never edited by a consumer; they are extended.
This is the seam that lets one shared engine serve every theory repository without forking. Immutability enforces it: extend() returns a new registry with the added checks appended, so a consumer cannot mutate the kit's defaults in place.
Check
dataclass
A registered check: a function plus its catalogue metadata.
Attributes:
| Name | Type | Description |
|---|---|---|
check_id |
str
|
Stable, unique id. |
title |
str
|
Short human-readable description for logs and reports. |
run |
CheckFunc
|
The check function. |
strict_only |
bool
|
When true, the check runs only in strict mode. |
Source code in src/se_theory_reference_kit/validation/registry.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | |
CheckRegistry
dataclass
An immutable, ordered collection of checks.
Order is preserved so runs are deterministic and the default generic checks always precede consumer-appended checks. Ids must be unique across the registry.
Source code in src/se_theory_reference_kit/validation/registry.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | |
__post_init__
__post_init__() -> None
Reject duplicate check ids at construction time.
Source code in src/se_theory_reference_kit/validation/registry.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 | |
extend
extend(*checks: Check) -> Self
Return a new registry with the given checks appended.
The kit's defaults are never mutated; a consumer extends them. The returned registry preserves order and re-validates id uniqueness, so a consumer cannot shadow a default id.
Source code in src/se_theory_reference_kit/validation/registry.py
75 76 77 78 79 80 81 82 | |
extended_with
extended_with(checks: Iterable[Check]) -> Self
Return a new registry appending an iterable of checks.
Source code in src/se_theory_reference_kit/validation/registry.py
84 85 86 | |
ids
ids() -> tuple[str, ...]
Return the check ids in order.
Source code in src/se_theory_reference_kit/validation/registry.py
88 89 90 | |
select
select(*, strict: bool) -> Sequence[Check]
Return the checks that should run for the given mode.
In non-strict mode, strict-only checks are skipped. In strict mode, all checks run.
Source code in src/se_theory_reference_kit/validation/registry.py
92 93 94 95 96 97 98 99 100 101 | |
runner
validation/runner.py - Execute a registry with crash isolation.
The runner is the only place that knows about strict mode and overall outcome. It runs each selected check, isolates crashes, collects all results, and computes an exit code.
Strict mode is applied here, not in checks: checks report severity, and the runner decides whether warning-severity findings fail the run.
RunReport
dataclass
The outcome of running a registry against a context.
Attributes:
| Name | Type | Description |
|---|---|---|
results |
tuple[CheckResult, ...]
|
Every finding from every check, in check order. |
strict |
bool
|
Whether the run was executed in strict mode. |
overall_status |
CheckStatus
|
Worst status across all results. |
Source code in src/se_theory_reference_kit/validation/runner.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | |
exit_code
property
exit_code: int
Return the process exit code: 0 when passed, 1 otherwise.
failures
property
failures: tuple[CheckResult, ...]
Return results that count as failures for this run's mode.
Error-severity findings always count. Warning-severity findings count only under strict mode. Cannot-verify always counts.
passed
property
passed: bool
Return true when no findings count as failures for this mode.
run_checks
run_checks(
*,
registry: CheckRegistry,
context: ReferenceRunContext,
strict: bool = False,
) -> RunReport
Run selected checks against the context with crash isolation.
Each check is executed independently. If a check raises ReferenceKitError, it is recorded as a cannot-verify result and the run continues. One broken check never hides the results of the others.
Source code in src/se_theory_reference_kit/validation/runner.py
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | |
Commands
se_theory_reference_kit.commands
Command implementations for cli.
catalog
commands/catalog.py - Reference catalog command.
configure_catalog_parser
configure_catalog_parser(
subparsers: _SubParsersAction[Any],
) -> None
Configure the catalog subcommand.
Source code in src/se_theory_reference_kit/commands/catalog.py
13 14 15 16 17 18 19 20 21 22 23 24 | |
run_catalog_command
run_catalog_command(args: Namespace) -> int
Run generated catalog export or freshness check.
Source code in src/se_theory_reference_kit/commands/catalog.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | |
export
commands/export.py - Generated export command.
configure_export_parser
configure_export_parser(
subparsers: _SubParsersAction[Any],
) -> None
Configure the export subcommand.
Source code in src/se_theory_reference_kit/commands/export.py
12 13 14 15 16 17 18 19 20 21 22 23 | |
run_export_command
run_export_command(args: Namespace) -> int
Run generated export or export freshness check.
Source code in src/se_theory_reference_kit/commands/export.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | |
inspect
commands/inspect.py - Inspect resolved theory-reference declarations.
configure_inspect_parser
configure_inspect_parser(
subparsers: _SubParsersAction[Any],
) -> None
Configure the inspect subcommand.
Source code in src/se_theory_reference_kit/commands/inspect.py
11 12 13 14 15 16 17 | |
run_inspect_command
run_inspect_command(args: Namespace) -> int
Inspect the resolved command context.
Source code in src/se_theory_reference_kit/commands/inspect.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | |
root
commands/root.py - Root command dispatcher for se-theory-reference.
build_parser
build_parser() -> ArgumentParser
Build the root argument parser.
Source code in src/se_theory_reference_kit/commands/root.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | |
main
main(argv: Sequence[str] | None = None) -> int
Run the combined command-line interface.
Source code in src/se_theory_reference_kit/commands/root.py
38 39 40 41 42 43 44 45 46 47 48 | |
scaffold
commands/scaffold.py - Reference scaffold command.
configure_scaffold_parser
configure_scaffold_parser(
subparsers: _SubParsersAction[Any],
) -> None
Configure the scaffold subcommand.
Source code in src/se_theory_reference_kit/commands/scaffold.py
10 11 12 13 14 15 16 17 18 | |
run_scaffold_command
run_scaffold_command(args: Namespace) -> int
Run reference scaffolding.
Source code in src/se_theory_reference_kit/commands/scaffold.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | |
validate
commands/validate.py - Validation command.
configure_validate_parser
configure_validate_parser(
subparsers: _SubParsersAction[Any],
) -> None
Configure the validate subcommand.
Source code in src/se_theory_reference_kit/commands/validate.py
13 14 15 16 17 18 19 20 21 22 23 24 | |
run_validate_command
run_validate_command(args: Namespace) -> int
Run validation checks.
Source code in src/se_theory_reference_kit/commands/validate.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | |