Dan Gass (dan.gass@gmail.com)
cfgparse is a more convenient, flexible, and powerful module for parsing configuration files than the standard library ConfigParser module. cfgparse uses a more declarative style modelled after the popular optparse standard library module.
cfgparse can optionally cooperate with the optparse module to provide coordination between command line and configuration file options. In addition, the cooperation can be used to allow the user to control features of the parser from the command line.
If you like this module and want to see it in the standard Python distribution, please take the time and add your comments to the Python Configuration File Parser Shootout wiki: http://www.python.org/moin/ConfigParserShootout.
ini
style configuration syntax
For example:
# file: intro.ini retries = 10
And script:
# file: intro.py import cfgparse c = cfgparse.ConfigParser() c.add_option('retries', type='int') c.add_file('intro.ini') opts = c.parse() print 'Number of retries:',opts.retries
Results in:
$ python intro.py Number of retries: 10