Skip to content

settings

merge_configs

merge_configs(
    original_configs: APPLConfigs, **kwargs: Any
) -> APPLConfigs

Return a new APPLConfigs with the overridden configs.

Source code in src/appl/settings.py
def merge_configs(original_configs: APPLConfigs, **kwargs: Any) -> APPLConfigs:
    """Return a new APPLConfigs with the overridden configs."""
    configs_dict = ConfigsDict(**original_configs.model_dump())
    configs_dict.update(**kwargs)
    return APPLConfigs(**configs_dict.to_dict())

update_appl_configs

update_appl_configs(
    new_configs: Union[APPLConfigs, Namespace]
) -> None

Update the global configs.

Note: Update in the middle might cause unexpected behavior.

Source code in src/appl/settings.py
def update_appl_configs(new_configs: Union[APPLConfigs, Namespace]) -> None:
    """Update the global configs.

    Note: Update in the middle might cause unexpected behavior.
    """
    if isinstance(new_configs, Namespace):
        new_configs = APPLConfigs(**namespace_to_dict(new_configs))
    elif not isinstance(new_configs, APPLConfigs):
        raise ValueError("new_configs must be an instance of APPLConfigs or Namespace")

    _setup_logging(new_configs.settings.logging)
    _setup_concurrency(new_configs.settings.concurrency)
    _setup_caching(new_configs.settings.caching, global_vars.configs.settings.caching)
    _setup_tracing(new_configs.settings.tracing)
    _setup_misc(new_configs.settings.misc)
    default_servers = global_vars.configs.default_servers
    global_vars.configs = new_configs
    _write_metafile()
    _log_servers_info(default_servers)
    _log_configs()