API Documentation

aumbry.FILE

Alias of SourceTypes.file

Type:

str

aumbry.CONSUL

Alias of SourceTypes.consul

Type:

str

class aumbry.Attr(attr_name, attr_type, serialize=True, required=False, coerce=None)

Attribute Definition

Parameters:
  • name – Python attribute name

  • type – Attribute type (e.g str, int, dict, Model, [<type>], etc)

  • serialize – Determines if the attribute can be serialized

  • required – Forces attribute to be defined

  • coerce – Forces attribute to be coerced to its type (primitive types)

class aumbry.GenericConfig

A type of AumbryConfig for Generic Dict Configurations.

class aumbry.JsonConfig

A type of AumbryConfig for JSON Configurations.

class aumbry.SourceTypes

Used to specified the source type to load a configuration.

consul = 'consul'
etcd2 = 'etcd2'
fernet = 'fernet'
file = 'file'
parameter_store = 'parameter_store'
class aumbry.YamlConfig

A type of AumbryConfig for Yaml Configurations.

aumbry.load(source_name, config_class, options=None, search_paths=None, preprocessor=None, handler=None)

Loads a configuration from a source into the specified Config type

Parameters:
  • source_name (str) – The name of the desired source.

  • config_class (AumbryConfig) – The resulting class of configuration you wish to deserialize the data into.

  • options (dict, optional) – The options used by the source handler. The keys are determined by each source handler. Refer to your source handler documentation on what options are available.

  • search_paths (list, optional) – A list paths for custom source handlers

  • preprocessor (function) – A function that pre-processes the source data before loading into the configuration object.

  • handler (AbstractHandler) – An instance of a handler to process the configuration data.

Returns:

An instance of the passed in config_class

aumbry.merge(config_class, sources, preprocessor=None, handler=None)

Loads a configuration from multiple sources into the specified Config type. Each source has to be the same type.

Parameters:
  • config_class (AumbryConfig) – The resulting class of configuration you wish to deserialize the data into.

  • sources

    an iterable collection of dicts with with the following keys: source_name (str): The name of the desired source. options (dict, optional): The options used by the source handler.

    The keys are determined by each source handler. Refer to your source handler documentation on what options are available.

    search_paths (list, optional): A list paths for custom source

    handlers

  • preprocessor (function) – A function that pre-processes the source data before loading into the configuration object.

  • handler (AbstractHandler) – An instance of a handler to process the configuration data.

Returns:

An instance of the passed in config_class

aumbry.save(source_name, config_inst, options=None, search_paths=None, preprocessor=None, handler=None)

Loads a configuration from a source into the specified Config type

Parameters:
  • source_name (str) – The name of the desired source.

  • config_inst (AumbryConfig) – The instance of a configuration class wish save.

  • options (dict, optional) – The options used by the source handler. The keys are determined by each source handler. Refer to your source handler documentation on what options are available.

  • search_paths (list, optional) – A list paths for custom source handlers

  • preprocessor (function) – A function that pre-processes the configration data before saving to the source.

  • handler (AbstractHandler) – An instance of a handler to process the configuration data. Defaults to the configuration handler.

Format Handlers

class aumbry.formats.generic.GenericHandler
deserialize(raw_config, config_cls)

Method to handle deserialization to a Config object.

property imports

List of modules to import.

serialize(config)

Method to handle serialization to a string.

class aumbry.formats.yml.YamlHandler
deserialize(raw_config, config_cls)

Method to handle deserialization to a Config object.

property imports

List of modules to import.

serialize(config)

Method to handle serialization to a string.

class aumbry.formats.js.JsonHandler
deserialize(raw_config, config_cls)

Method to handle deserialization to a Config object.

property imports

List of modules to import.

serialize(config)

Method to handle serialization to a string.