resolve_config_sources#
- tollan.config.sources.resolve_config_sources(arg: ConfigSourceList | Path | dict | list | None, order_max: int | None = None, order_min: int | None = None) ConfigSourceList[source]#
Create a ConfigSourceList from various input formats.
This is a thin wrapper around ConfigSourceList.model_validate() that: - Handles flexible input types (Path, dict, list, None) - Passes order constraints via validation context - Validates order_min/order_max constraints
Input patterns supported: - ConfigSourceList: Return as-is (with order validation) - None or dict: Single dict source with order=0 - Path to file: Single YAML source with order=0 - Path to directory: Load numbered YAML files (e.g., 00_base.yaml, 01_dev.yaml) - List: Multiple sources (order auto-assigned if not specified)
- Parameters:
arg (ConfigSourceList | Path | dict | list | None) – Configuration source specification
order_max (int | None, optional) – Maximum allowed order value for sources, by default None
order_min (int | None, optional) – Minimum allowed order value for sources, by default None
- Returns:
Validated configuration source list
- Return type:
- Raises:
ValueError – If any source order violates order_min or order_max constraints
Examples
>>> # From file path >>> csl = resolve_config_sources(Path("config.yaml"))
>>> # From dict >>> csl = resolve_config_sources({"key": "value"})
>>> # From list with order constraints >>> csl = resolve_config_sources( ... [{"source": "base.yaml", "order": 0}], ... order_max=100, ... )
>>> # From directory (loads numbered YAML files) >>> csl = resolve_config_sources(Path("config_dir"))