Classes
ConfigWithOrigin
Configuration with origin tracking.
Tracks which file (or source) contributed each configuration k…
ConfigWithOrigin
Configuration with origin tracking.
Tracks which file (or source) contributed each configuration key for introspection and debugging.
Methods 3
merge
Merge config and track origin.
merge
def merge(self, other: dict[str, Any], origin: str) -> None
Merge config and track origin.
Parameters 2
other |
dict[str, Any] |
Config dict to merge in |
origin |
str |
Source identifier (e.g., "_default/site.yaml") |
show_with_origin
Format config with origin annotations.
show_with_origin
def show_with_origin(self, indent: int = 0) -> str
Format config with origin annotations.
Parameters 1
indent |
int |
Starting indentation level |
Returns
Formatted string with origins as commentsstr
—
get_origin
Get origin for a specific key path.
get_origin
def get_origin(self, key_path: str) -> str | None
Get origin for a specific key path.
Parameters 1
key_path |
str |
Dot-separated key path (e.g., "site.title") |
Returns
Origin string, or None if not foundstr | None
—
Internal Methods 3
__init__
Initialize empty config with origin tracking.
__init__
def __init__(self) -> None
Initialize empty config with origin tracking.
_merge_recursive
Recursively merge and track origins.
_merge_recursive
def _merge_recursive(self, base: dict[str, Any], override: dict[str, Any], origin: str, path: list[str]) -> None
Recursively merge and track origins.
Parameters 4
base |
dict[str, Any] |
Base dict (mutated) |
override |
dict[str, Any] |
Override dict |
origin |
str |
Source identifier |
path |
list[str] |
Current key path (for tracking) |
_format_recursive
Recursively format config with origins.
_format_recursive
def _format_recursive(self, config: dict[str, Any], lines: list[str], path: list[str], indent: int) -> None
Recursively format config with origins.
Parameters 4
config |
dict[str, Any] |
Config dict |
lines |
list[str] |
Output lines (appended to) |
path |
list[str] |
Current key path |
indent |
int |
Current indentation level |