Behold, fig’s documentation!

fig is a configuration library for Python.


Why another configuration library? The simple answer is that none of the available options gave me everything I wanted, with an API that I enjoyed using. This library is as close to my ideal as I have been able to come. It tries to provide some (but not too much) powerful functionality, without sacrificing ease-of-use.


  • Automatic value conversion.
  • Simple section nesting.
  • Dict-like access.
  • Easily extensible input/output formats.


fig installs easily using easy_install or pip:

$ pip install figpy

NOTE: The package exists as figpy on PyPI due to a naming conflict. The installed package name is fig.


Basic usage is cake. Assuming our config file looks like this (INI formatting is also supported):
server.port: 9090

First we specify the defaults and types to expect:

>>> cfg = fig.Config('server.cfg')
>>> cfg.init('', 'localhost')
>>> cfg.init('server.port', 8080)

Then we sync our current state with the state of the config file:

>>> cfg.sync()

Then we can access the values directly without any extra effort, either directly:

>>> cfg['']

Or by section:

>>> server_cfg = cfg.section('server')
>>> server_cfg['port']


There is no shortage of configuration libraries for Python. The Python wiki keeps a list of contenders that sought to replace the standard library’s ConfigParser: ConfigParserShootout.