aiaccel.config.prepare_config¶
- aiaccel.config.prepare_config(config_filename: str | Path, working_directory: str | Path | None = None, overwrite_config: DictConfig | ListConfig | dict[Any, Any] | list[Any] | None = None, *, print_config: bool = False, save_config: bool = False, save_directory: str | Path | None = None, save_filename: str = 'merged_config.yaml', load_config_kwargs: dict[str, Any] | None = None, print_config_kwargs: dict[str, Any] | None = None) DictConfig | ListConfig[source]¶
Assemble a fully resolved configuration built on top of
load_config().This helper first delegates to
load_config()to read the YAML file (optionally usingload_config_kwargs), then mergesoverwrite_config, resolves inheritance, and optionally prints or stores the merged configuration. Use this function when you need a ready-to-use configuration object.- Parameters:
config_filename (str | Path) – Path to the configuration
working_directory (str | Path | None, optional) – Path to the working directory to store in merge_user_config. If None, the parent directory of config_filename is used. Defaults to None.
overwrite_config (DictConfig | ListConfig | dict[Any, Any] | list[Any] | None, optional) – Configuration that overwrites the loaded configuration before resolving. Defaults to None.
print_config (bool, optional) – Print the merged configuration immediately after loading. Defaults to False.
save_config (bool, optional) – Save the resolved configuration immediately after loading. Defaults to False.
save_directory (str | Path | None, optional) – Directory to store the saved configuration. If omitted, the configuration’s
working_directoryis used.save_filename (str, optional) – Filename used when
save_configis True. Defaults to"merged_config.yaml".load_config_kwargs (dict[str, Any] | None, optional) – Keyword arguments forwarded to
load_config(). Use this to overrideparent_configor any future options when loading the base YAML.print_config_kwargs (dict[str, Any] | None, optional) – Keyword arguments forwarded to
print_config()whenprint_configis True. Allows overridingline_lengthorprintbuilt-in parameters (e.g.,file).
- Returns:
The fully resolved configuration. Use
print_config=Trueorsave_config=Trueto dump intermediate states.- Return type:
DictConfig | ListConfig