vak.config.config.Config¶
- class vak.config.config.Config(prep=None, train=None, eval=None, predict=None, learncurve=None)[source]¶
Bases:
objectClass that represents the TOML configuration file used with the vak command-line interface.
- prep¶
Represents
[vak.prep]table of config.toml file
- train¶
Represents
[vak.train]table of config.toml file
- eval¶
Represents
[vak.eval]table of config.toml file
- predict¶
Represents
[vak.predict]table of config.toml file.
- learncurve¶
Represents
[vak.learncurve]table of config.toml file
- __init__(prep=None, train=None, eval=None, predict=None, learncurve=None) None¶
Method generated by attrs for class Config.
Methods
__init__([prep, train, eval, predict, ...])Method generated by attrs for class Config.
from_config_dict(config_dict[, ...])Return instance of
Configclass, given adictcontaining the contents of a TOML configuration file.from_toml_path(toml_path[, tables_to_parse])Return instance of
Configclass, given the path to a TOML configuration file.Attributes
- classmethod from_config_dict(config_dict: dict, tables_to_parse: str | list[str] | None = None, toml_path: str | Path | None = None) Config[source]¶
Return instance of
Configclass, given adictcontaining the contents of a TOML configuration file.This
classmethod()expects the output ofvak.config.load._load_from_toml_path(), that converts atomlkit.TOMLDocumentto adict, and returns thedictthat is accessed by the top-level key'vak'.- Parameters:
config_dict (dict) – Python
dictcontaining a .toml configuration file, parsed by thetomllibrary.toml_path (str, pathlib.Path) – path to a configuration file in TOML format. Default is None. Not required, used only to make any error messages clearer.
tables_to_parse (str, list) – Name of top-level table or tables from configuration file that should be parsed. Can be a string (single table) or list of strings (multiple tables). Default is None, in which case all are validated and parsed.
- Returns:
config – instance of
Configclass, whose attributes correspond to the top-level tables in a config.toml file.- Return type:
vak.config.parse.Config
- classmethod from_toml_path(toml_path: str | Path, tables_to_parse: list[str] | None = None) Config[source]¶
Return instance of
Configclass, given the path to a TOML configuration file.- Parameters:
toml_path (str, pathlib.Path) – Path to a configuration file in TOML format. Parsed by
tomllibrary, then converted to an instance ofvak.config.parse.Configby callingvak.parse.from_tomltables_to_parse (str, list) – Name of table or tables from configuration file that should be parsed. Can be a string (single table) or list of strings (multiple tables). Default is None, in which case all are validated and parsed.
- Returns:
config – instance of
Configclass, whose attributes correspond to tables in a config.toml file.- Return type:
vak.config.parse.Config