ANN: New configuration module released

Sylvain Thenault sylvain.thenault at nospam.logilab.fr
Thu Nov 4 04:03:24 EST 2004


On Wed, 03 Nov 2004 15:26:07 -0500, Neal D. Becker wrote:

> Looks good so far.
> 
> 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.

the "configuration" module in logilab's common library is doing this (make
a bridge between optparse and ConfigParser). You give a kind of
configuration schema to a configuration object and then it can be
initialized from a configuration file and/or command line. Environment
variable are not considered yet, but I don't think it would be hard to add
this feature. The main problem is the lack of documentation, but if there
is some interest I can post an usage example.

Notice that this library also provides some new option types for optparse
(usable by the configuration module, of course), such as regexp (for
regular expression), csv (comma separated values), yn (yes or no) and
named (arbitrary name=value pair).

-- 
Sylvain Thénault                               LOGILAB, Paris (France).

http://www.logilab.com   http://www.logilab.fr  http://www.logilab.org





More information about the Python-list mailing list