ext.yaml¶
yaml
¶
YAML config loader — load RegistryConfig from a YAML file.
Install with pip install "remote-store[yaml]".
Accepts either pyyaml or ruamel.yaml as the parser.
from_yaml
¶
from_yaml(
path: str | Path, *, resolve_env_vars: bool = False
) -> RegistryConfig
Load config from a YAML file.
Accepts either pyyaml or ruamel.yaml as the parser.
Parameters:
-
path(str | Path) –Path to the YAML file.
-
resolve_env_vars(bool, default:False) –When
True, resolve${VAR}placeholders viaresolve_envbefore constructing the config.
Returns:
-
RegistryConfig–An immutable
RegistryConfig.
Raises:
-
ModuleNotFoundError–If neither
pyyamlnorruamel.yamlis installed. -
FileNotFoundError–If path does not exist.
-
TypeError–If the top-level YAML value is not a mapping.
-
KeyError–If resolve_env_vars is
Trueand a placeholder references an unset variable with no default.
See also¶
- Extensions — overview of all extension modules
- Config Loaders example — YAML config loader in action