On Thursday 26 July 2007 11:40:23 am Fernando Perez wrote:
> On 7/26/07, Darren Dale <[EMAIL PROTECTED]> wrote:
> > On Thursday 26 July 2007 10:30:34 am Ted Drain wrote:
> > > Why do you need an api file at all?  Why not have config be a python
> > > package and let config/__init__.py take care of importing
> > > everything?
[...]
> I don't remember the exact details, but we started using the api.py
> approach instead of  __init__ on Enthought's lead
[...] 
> You may want to inquire with them for the details

I did ask at enthought-dev, and they said it was primarily due to circular 
dependencies. The use of __init__ is already causing us some headaches in 
mpl, so I decided to stick with api.py, leaving __init__ empty.

I just uploaded my work to matplotlib svn. The idea is that matplotlib would 
import the rcParams (and eventually mplConfig) from config/api, but for just 
think of config/ as a sandbox. The new config system is turned on by default 
in api.py by setting 

USE_NEW_CONFIG = True

If it is True, you can run configtest.py in IPython, which will import the 
traited mplConfig object and rcParams, a thin wrapper to mplConfig. 
configtest will change rcParams['backend'] to Cairo, validate that the change 
occured in mplConfig, and will then try to change the backend to something 
nonsensical and should throw an error.

For now, validation in mplConfig is very similar to validation in the old 
system. I have not taken advantage of the more advanced capabilities of 
traits, like shadow attributes and so forth. For now I just wanted to get 
something that should work with existing matplotlib. 

The first time the traited config module mplconfig is loaded, it checks your 
config_dir (the cwd and then probably ~/.matplotlib) for a matplotlib.conf 
file. If it does not exist, it creates one, loads your old matplotlibrc, 
updates mplConfig based on your matplotlibrc, saves any non-default settings 
to the new matplotlib.conf. If the file does exist, it updates mplConfig 
accordingly.

The config/matpltolib.conf.default file was auto-generated (comments and all, 
thanks to Fernandos wizardry).

Darren

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to