cli.config

cli.config

Configuration loading and processing.

Functions

Name Description
check_remote_config First, determines if the passed config is a valid HTTPS URL. Then, attempts to query
choose_config Helper method for choosing a axolotl config YAML file (considering only files
load_cfg Loads the axolotl configuration stored at config, validates it, and performs
prepare_plugins Registers the plugins for the given configuration.

check_remote_config

cli.config.check_remote_config(config)

First, determines if the passed config is a valid HTTPS URL. Then, attempts to query for it and parse its content, first as JSON, then as YAML (YAML is preferred). Finally, the parsed content is written to a local file and its path is returned.

Parameters

Name Type Description Default
config Union[str, Path] HTTPS URL to a YAML or JSON file. required

Returns

Name Type Description
Union[str, Path] Either the original config if it’s not a valid HTTPS URL, or the path to the
Union[str, Path] downloaded remote config.

Raises

Name Type Description
ValueError If the remote configuration is neither valid JSON or YAML.
RuntimeError If some request-related exception occurs from the file download.
Exception Catch-all for any other exception.

choose_config

cli.config.choose_config(path)

Helper method for choosing a axolotl config YAML file (considering only files ending with .yml or .yaml). If more than one config file exists in the passed path, the user is prompted to choose one.

Parameters

Name Type Description Default
path Path Directory in which config file(s) are stored. required

Returns

Name Type Description
str Path to either (1) the sole YAML file, or (2) if more than one YAML files exist,
str the user-selected YAML file.

Raises

Name Type Description
ValueError If no YAML files are found in the given path.

load_cfg

cli.config.load_cfg(config=Path('examples/'), **kwargs)

Loads the axolotl configuration stored at config, validates it, and performs various setup.

Parameters

Name Type Description Default
config Union[str, Path] Path (local or remote) to axolotl config YAML file. Path('examples/')
kwargs Additional keyword arguments to override config file values. {}

Returns

Name Type Description
DictDefault DictDefault mapping configuration keys to values.

prepare_plugins

cli.config.prepare_plugins(cfg)

Registers the plugins for the given configuration.

Parameters

Name Type Description Default
cfg DictDefault Dictionary mapping axolotl config keys to values. required