exlab_wizard.config.loader#
config.yaml round-trip loader. Backend Spec §9.
Uses ruamel.yaml in round-trip mode so saving back to disk preserves operator-readable comments and key order. The Settings UI’s Save action goes through this module so config.yaml stays human-friendly across edit cycles.
Functions
|
Serialize config to a YAML string. |
|
Load a config.yaml from disk and validate against the Pydantic model. |
|
Load a config from YAML text. |
|
Atomically write config back to path. |
- exlab_wizard.config.loader.dump_config(config)[source]#
Serialize config to a YAML string. No comment preservation; tests use this.
- exlab_wizard.config.loader.load_config(path)[source]#
Load a config.yaml from disk and validate against the Pydantic model.
Raises ConfigError on filesystem error, YAML parse error, or model validation failure. The original ValidationError is chained as the cause so the caller can introspect per-field errors.
- exlab_wizard.config.loader.load_config_from_text(text)[source]#
Load a config from YAML text. Same semantics as load_config but for in-memory input.
- exlab_wizard.config.loader.save_config(path, config, *, original_text=None)[source]#
Atomically write config back to path.
If original_text is supplied, ruamel.yaml round-trips it so existing comments and key order are preserved; only the modified values change. If original_text is None, write a fresh document with no preserved formatting.
Atomicity: write to
<path>.tmp, fsync, thenPath.replaceto<path>.