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
- 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
Config
class, given adict
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 adict
containing the contents of a TOML configuration file.This
classmethod()
expects the output ofvak.config.load._load_from_toml_path()
, that converts atomlkit.TOMLDocument
to adict
, and returns thedict
that is accessed by the top-level key'vak'
.- Parameters:
config_dict (dict) – Python
dict
containing a .toml configuration file, parsed by thetoml
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 ofvak.config.parse.Config
by callingvak.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