[Python-Dev] Application configuration (was: PEP 389: argparse)
olemis at gmail.com
Mon Sep 28 18:03:50 CEST 2009
On Mon, Sep 28, 2009 at 10:33 AM, Oleg Broytman <phd at phd.pp.ru> wrote:
> On Mon, Sep 28, 2009 at 09:23:22AM -0600, m h wrote:
>> Does anyone else have interest in such functionality? Is it outside
>> the realm of this PEP?
> It is outside the scope of this particular PEP, but it is certainly an
> interesting idea.
> Actually it is the Right Thing, but I doubt it is possible to implement
> such a generic configuration *framework* in the Python standard *library*.
> Applications use different configfile layouts, some programs use w32
> registry instead of configfiles...
If this is the only reason :
- What if only INI files are considered ?
In the end, that's the format included in stdlib and used by stdlib
commands (e.g. distutils ;o), and also by others (e.g. Trac, Hg, ...).
Reducing the scope in this direction could yield good results.
OTOH, if other cfg need to be supported, then possibly an «object
layer» (e.g. compatible with ConfigParser) could be used in order to
support further config layouts built outside stdlib. For instance, in
the case of WinReg :
RegParser = RegConfigParser(HKEY_CURRENT_USER, r'Software\MyApp\xxx')
RegParser.sections() # Children of this reg key
RegParser.options('s1') # Values under
... and similar solutions could be implemented outside stdlib for e.g. YAML, ...
PS: BTW, is there something like this already for WinReg ?
Blog ES: http://simelo-es.blogspot.com/
Blog EN: http://simelo-en.blogspot.com/
Sobrepasa las 300 descargas el módulo dutest -
More information about the Python-Dev