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 using load_config_kwargs), then merges overwrite_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_directory is used.

  • save_filename (str, optional) – Filename used when save_config is True. Defaults to "merged_config.yaml".

  • load_config_kwargs (dict[str, Any] | None, optional) – Keyword arguments forwarded to load_config(). Use this to override parent_config or any future options when loading the base YAML.

  • print_config_kwargs (dict[str, Any] | None, optional) – Keyword arguments forwarded to print_config() when print_config is True. Allows overriding line_length or print built-in parameters (e.g., file).

Returns:

The fully resolved configuration. Use print_config=True or save_config=True to dump intermediate states.

Return type:

DictConfig | ListConfig