Module Reference

State global to the whole package.

metaconfig.add_config(name, config_parser)[source]

Add a config_parser object to metaconfig.

metaconfig.add_config_file(name, config, ConfigClass=None)[source]

Read a config file and add it to metaconfig.

metaconfig.get_config(name, inherit=True)[source]

Returns the ConfigParser.ConfigParser for the given name.

Parameters:
  • name – The name of the config object to return. This is interpreted as a ‘.’-separated hierarchical namespace.
  • inherit – If True and cofig name does not exist each config above name in the hierarchy will be tried before returning an empty config object. For instance get_config("x.y.z") would try to return existing configs x.y.z, x.y and x before returning a new, empty config x.y.z.
metaconfig.init(search_path=None)[source]

Initialise metaconfig.

An exception will be raised if metaconfig has already been initialised.

Parameters:
  • search_path – A sequence of file paths to search for a metaconfig configuration.

If search_path is None it defaults to:

  1. The value of the METACONFIG_CONF environment variable if set.
  2. metaconfig.conf in the current directory.
  3. $HOME/.metaconfig.conf
  4. <sys.prefix>/etc/metaconfig.conf
metaconfig.init_from_config(config)[source]

Initialise metaconfig from a ConfigParser.ConfigParser instance.

An exception will be raised if metaconfig has already been initialised.

metaconfig.init_from_string(config_str)

Initialise metaconfig from a string.

An exception will be raised if metaconfig has already been initialised.

Previous topic

Configuration Management Interface

Next topic

TODO

This Page