compass.utilities.io.load_config#
- load_config(config_filepath, resolve_paths=True, file_name='Configuration', excluded_keys=None)[source]#
Load a config file, recursively applying inherited configuration
- Parameters:
config_filepath (path-like) – Path to config file.
resolve_paths (
bool, defaultTrue) – Option to (recursively) resolve file-paths in the dictionary w.r.t the config file directory. By default,True.file_name (
str, default"Configuration") – Name of the config file for error messages. By default, “Configuration”.excluded_keys (
Iterableofstr, optional) – Dictionary keys whose values should not be resolved as paths. By default,None.
- Returns:
dict– Dictionary containing configuration parameters.- Raises:
COMPASSValueError – If the file extension is missing or unsupported, or inheritance is invalid or circular.
COMPASSFileNotFoundError – If a config file does not exist.
Notes
A config may use
inherit_fromto name another config file. Parent configs are loaded recursively and dictionaries are deep-merged, with child values taking precedence. Lists are replaced, not combined. An exact child value of"DELETE"removes that key from the merged result. Parent references are relative to the file where they are defined. When path resolution is enabled, other relative paths are also resolved from their defining file.