vak.config.config.Config

class vak.config.config.Config(prep=None, train=None, eval=None, predict=None, learncurve=None)[source]

Bases: object

Class that represents the TOML configuration file used with the vak command-line interface.

prep

Represents [vak.prep] table of config.toml file

Type:

vak.config.prep.PrepConfig

train

Represents [vak.train] table of config.toml file

Type:

vak.config.train.TrainConfig

eval

Represents [vak.eval] table of config.toml file

Type:

vak.config.eval.EvalConfig

predict

Represents [vak.predict] table of config.toml file.

Type:

vak.config.predict.PredictConfig

learncurve

Represents [vak.learncurve] table of config.toml file

Type:

vak.config.learncurve.LearncurveConfig

__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 Config class, given a dict containing the contents of a TOML configuration file.

from_toml_path(toml_path[, tables_to_parse])

Return instance of Config class, 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 Config class, given a dict containing the contents of a TOML configuration file.

This classmethod() expects the output of vak.config.load._load_from_toml_path(), that converts a tomlkit.TOMLDocument to a dict, and returns the dict that is accessed by the top-level key 'vak'.

Parameters:
  • config_dict (dict) – Python dict containing a .toml configuration file, parsed by the toml library.

  • 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 Config class, 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 Config class, given the path to a TOML configuration file.

Parameters:
  • toml_path (str, pathlib.Path) – Path to a configuration file in TOML format. Parsed by toml library, then converted to an instance of vak.config.parse.Config by calling vak.parse.from_toml

  • tables_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 Config class, whose attributes correspond to tables in a config.toml file.

Return type:

vak.config.parse.Config