ANN: New configuration module released

Michael Foord fuzzyman at gmail.com
Tue Nov 9 03:32:58 EST 2004


Anthony Baxter <anthonybaxter at gmail.com> wrote in message news:<mailman.6072.1099842837.5135.python-list at python.org>...
> On Wed, 03 Nov 2004 15:26:07 -0500, Neal D. Becker
> <ndbecker2 at verizon.net> wrote:
> > The boost c++ library (about to be released) has a new program_options
> > parser.  One feature I appreciate in the design, is that the source of
> > options is seperated from the rest of the design.  This means that, out of
> > the box, it reads options from command line, from config files, and from
> > env variables.  Probably not hard to extend if anyone could think of a
> > reason.
> > 
> > I believe a decent config module should at least handle both config files
> > and command line options.  ENV variables are a nice touch too.
> 
> I did something similar in shtoom (see the svn repo) - you provide
> definitions of the options, and it builds up optparse, configparser,
> and GUI preferences dialogs for them. Options provided are then stored
> in the configparser file format, so you don't have to re-enter them
> each time.

Complex ways of specifying expected options are fine - but it would be
really good if a new ConfigParse module also had an ultra simple
interface as well.

ConfigObj (here we go...) my config file parser, if called with just a
filename, parses everything in the config file and presents the
results as a dictionary. That means you can add config file support
with basically 1 line of code (plus the import statement). This is
particularly useful for small admin scripts where you write the config
files yourself - speed and simplicity over flexibility.

Regards,

Fuzzy
http://www.voidspace.org.uk/atlantibots/pythonutils.html



More information about the Python-list mailing list