ibid.config – Configuration Files

This module handles Ibid’s configuration file and provides helper functions for accessing configuration from sources and plugins.

Helper Functions

class ibid.config.Option(name, description, default=None)

A unicode string configuration item.

Parameters:
  • name – The configuration key
  • description – A human-readable description for the configuration item.
  • default – The default value, if not specified in the configuration file.

If created as an attribute to a ibid.plugins.Processor or ibid.source.IbidSourceFactory, it will retrieve the value of plugins.plugin.name or sources.source.name.

This is also the base class for other Options.

Example:

class Secret(Processor):
   password = Option('password', 'Secret Password', 's3cr3t')

Assuming that processor is in the secret plugin, the configuration item could be provided as:

[plugins]
   [[secret]]
      password = blue
class ibid.config.BoolOption(name, description, default=None)

A boolean configuration item.

Usage is identical to Option.

class ibid.config.IntOption(name, description, default=None)

A integer configuration item.

Usage is identical to Option.

class ibid.config.FloatOption(name, description, default=None)

A floating-point configuration item.

Usage is identical to Option.

class ibid.config.ListOption(name, description, default=None)

A list configuration item. Values will be unicode strings.

Usage is identical to Option.

class ibid.config.DictOption(name, description, default=None)

A dictionary configuration item. Keys and values will be unicode strings.

Usage is identical to Option.

Core Functions

ibid.config.FileConfig(filename)

Parses filename and returns a configuration tree.