config
— Configuration object
Config
objects encapsulate a set of configuration options for a
valjean
run. Here is how you create one:
>>> from valjean.config import Config
>>> config = Config()
By default, Config
objects come with a 'path'
configuration
section, which may be used to set default values for any configuration option.
A few options are set from the beginning:
>>> for opt, val in sorted(config['path'].items()):
... print(f'{opt} = {val}')
log-root = /.../log
output-root = /.../output
report-root = /.../report
The Config
class behaves like a simple dictionary:
>>> print(config.query('path', 'report-root'))
/.../report
Module API
- class valjean.config.Config(dictionary=None)[source]
The base configuration class for
valjean
.- classmethod from_file(path)[source]
Construct a configuration object from a TOML file.
- Parameters:
path (pathlib.Path or str) – A path for the configuration file.
- __init__(dictionary=None)[source]
Construct a configuration object from a dictionary.
The configuration will be initialized to contain a few default options.
- Parameters:
dictionary (dict) – The configuration object.
- Returns:
The constructed Config object.
- __hash__ = None