nabu.pipeline.config module

class nabu.pipeline.config.NabuConfigParser(**kwargs)[source]

Bases: object

get_dict()[source]
nabu.pipeline.config.parse_nabu_config_file(fname, allow_no_value=False)[source]

Parse a configuration file and returns a dictionary.

Parameters:

fname (str) – File name of the configuration file

Returns:

conf_dict – Dictionary with the configuration

Return type:

dict

nabu.pipeline.config.generate_nabu_configfile(fname, default_config, config=None, sections=None, sections_comments=None, comments=True, options_level=None, prefilled_values=None)[source]

Generate a nabu configuration file.

Parameters:
  • fname (str) – Output file path.

  • config (dict) – Configuration to save. If section and / or key missing will store the default value

  • sections (list of str, optional) – Sections which should be included in the configuration file

  • comments (bool, optional) – Whether to include comments in the configuration file

  • options_level (str, optional) – Which “level” of options to embed in the file. Can be “required”, “optional”, “advanced”. Default is “optional”.

nabu.pipeline.config.get_default_nabu_config(default_config)[source]

Return a dictionary with the default nabu configuration.

nabu.pipeline.config.validate_config(config, default_config, renamed_keys, errors='warn')[source]

Validate a configuration dictionary against a “default” configuration dict.

Parameters:
  • config (dict) – configuration dict to be validated

  • default_config (dict) – Reference configuration. Missing keys/sections from ‘config’ will be updated with keys from this dictionary.

  • errors (str, optional) –

    What to do when an unknonw key/section is encountered. Possible actions are:
    • ”warn”: throw a warning, continue the validation

    • ”raise”: raise an error and exit

nabu.pipeline.config.overwrite_config(conf, overwritten_params)[source]

Overwrite a (validated) configuration with a new parameters dict.

Parameters:
  • conf (dict) – Configuration dictionary, usually output from validate_config()

  • overwritten_params (dict) – Configuration dictionary with the same layout, containing parameters to overwrite