dicfg.reader.ConfigReader#

class ConfigReader(name: str, main_config_path: str | Path = './configs/config.yml', presets_folder_name: str = 'presets', default_key: str = 'default', context_keys: tuple = (), search_paths: tuple = ())[source]#

Bases: object

Parameters:
  • name (str) – Name of config. Used as a reference in user configs and cli settings.

  • main_config_path (Union[str, Path], optional) – Path to main config. Defaults to “./configs/config.yml”.

  • presets_folder_name (str, optional) – Presets folder. Defaults to ‘presets’.

  • default_key (str, optional) – Default context key. Defaults to “default”.

  • context_keys (tuple, optional) – Addtional context keys. Defaults to ().

  • search_paths (tuple, optional) – Search paths for config file interpolation. Defaults to ().

__init__(name: str, main_config_path: str | Path = './configs/config.yml', presets_folder_name: str = 'presets', default_key: str = 'default', context_keys: tuple = (), search_paths: tuple = ())[source]#

Methods

__init__(name[, main_config_path, ...])

read([user_config, presets])

Reads Config File

read(user_config: dict | str | Path | list[dict, str, Path] | None = None, presets: tuple = ()) dict[source]#

Reads Config File

Parameters:
  • user_config (Union[dict, str, Path], optional) – user_config Defaults to None.

  • presets (tuple, optional) – presets Defaults to ().

Returns:

read configs

Return type:

dict