[IPython-dev] Python-based configuration system
vivainio at kolumbus.fi
Wed Jun 30 06:56:24 CDT 2004
Apparently replacing the current configuration system with a
python-based one should not be too much work:
" execute the file in self.confdict namespace "
" return the underlying dict "
" a Struct-like proxy for dict "
" return RcProxy object "
The RcProxy instance given by getrcstruct would just implement
getattr/setattr to return the corresponding item in confdict, and
delegate non-existing key lookups to the confdict as such.
Implementation of Configuration methods is trivial, and RcProxy is
mostly copy-paste from here (delegation recipe):
Then we just put the RcProxy instance to the rc attrbute of the
interpreter, and nothing would need to be changed in interpreter class
and other classes that might use interpreter.rc.
Configuration could/should really be that simple, I've implemented such
a system in many seperate projects and there has never been any real
problems (most importantly, there has never been a need for more
sophisticated conflict resolution than "last evaluation wins". The
"seed" configuration file containing all the defaults (that is executed
first) could be in /etc/ipython-defaults (or whatever) and other
user/system config files would just be executed in the same
Configuration object after it.
More information about the IPython-dev