Classes
ConfigLoadError
Raised when config loading fails.
ConfigLoadError
Raised when config loading fails.
Exception
ConfigDirectoryLoader
Load configuration from directory structure.
Supports:
- Multi-file configs in _default/
- Environ…
ConfigDirectoryLoader
Load configuration from directory structure.
Supports:
- Multi-file configs in _default/
- Environment-specific overrides
- Profile-specific settings
- Origin tracking for introspection
Methods 4
load
Load config from directory with precedence.
Precedence (lowest to highest):
1.…
load
def load(self, config_dir: Path, environment: str | None = None, profile: str | None = None) -> dict[str, Any]
Load config from directory with precedence.
Precedence (lowest to highest):
- config/_default/*.yaml (base)
- config/environments/<env>.yaml (environment overrides)
- config/profiles/<profile>.yaml (profile settings)
Parameters 3
config_dir |
Path |
Path to config directory |
environment |
str | None |
Environment name (auto-detected if None) |
profile |
str | None |
Profile name (optional) |
Returns
Merged configuration dictionarydict[str, Any]
—
get_deprecated_keys
Get list of deprecated keys found (old_key, new_location, note).
get_deprecated_keys
def get_deprecated_keys(self) -> list[tuple[str, str, str]]
Get list of deprecated keys found (old_key, new_location, note).
Returns
list[tuple[str, str, str]]
print_deprecation_warnings
Print deprecation warnings if any deprecated keys were found.
print_deprecation_warnings
def print_deprecation_warnings(self) -> None
Print deprecation warnings if any deprecated keys were found.
get_origin_tracker
Get origin tracker if tracking is enabled.
get_origin_tracker
def get_origin_tracker(self) -> ConfigWithOrigin | None
Get origin tracker if tracking is enabled.
Returns
Origin tracker, or None if tracking disabledConfigWithOrigin | None
—
Internal Methods 6
__init__
Initialize loader.
__init__
def __init__(self, track_origins: bool = False) -> None
Initialize loader.
Parameters 1
track_origins |
bool |
Whether to track config origins for introspection |
_load_directory
Load all YAML files in directory and merge.
_load_directory
def _load_directory(self, directory: Path, origin_prefix: str = '') -> dict[str, Any]
Load all YAML files in directory and merge.
Parameters 2
directory |
Path |
Directory to load from |
origin_prefix |
str |
Prefix for origin tracking |
Returns
Merged configuration from all filesdict[str, Any]
—
_load_environment
Load environment-specific config.
_load_environment
def _load_environment(self, config_dir: Path, environment: str) -> dict[str, Any] | None
Load environment-specific config.
Parameters 2
config_dir |
Path |
Root config directory |
environment |
str |
Environment name |
Returns
Environment config, or None if not founddict[str, Any] | None
—
_load_profile
Load profile-specific config.
_load_profile
def _load_profile(self, config_dir: Path, profile: str) -> dict[str, Any] | None
Load profile-specific config.
Parameters 2
config_dir |
Path |
Root config directory |
profile |
str |
Profile name |
Returns
Profile config, or None if not founddict[str, Any] | None
—
_load_yaml
Load single YAML file with error handling.
_load_yaml
def _load_yaml(self, path: Path) -> dict[str, Any]
Load single YAML file with error handling.
Parameters 1
path |
Path |
Path to YAML file |
Returns
Parsed YAML as dictdict[str, Any]
—
_flatten_config
Flatten nested config for backward compatibility with old ConfigLoader.
Extrac…
_flatten_config
def _flatten_config(self, config: dict[str, Any]) -> dict[str, Any]
Flatten nested config for backward compatibility with old ConfigLoader.
Extracts common sections to top level:
- site.title → title
- build.parallel → parallel
Parameters 1
config |
dict[str, Any] |
Nested configuration dictionary |
Returns
Flattened configuration (sections preserved, values also at top level)dict[str, Any]
—