Checked in major reorganization of __init__.py

Hi there,

I just checked in some major reorganization work in __init__.py

The main intention was to move the list of option defaults to a separate
file 'rcdefaults.py' that could be imported from setup.py to access the
settings with minimal dependencies on the remaining code.

To do so, I had to untangle a number of unnessessary dependancies within
__init__.py. I hope, the behavior of the code
should not have changed in the course of doing so. In case problems
arise, please contact me directly, I don't know
how closely I can follow the mailing list.

I hope that from this starting point, future maintenance of the option
settings will be somewhat easier.

Greetings,
Norbert

I haven't tested this but I did take a brief look at it and I think
your cleaning and organizing is useful. I think we have a naming
problem though -- this __init__ module defines an rcdefaults function,
which is likely to cause confusion with the new rcdefaults module.
Eg,

from matplotlib import rcdefaults

will be ambiguous. You may want to consider a new name.

DH

···

On 6/30/07, Norbert Nemec <Norbert.Nemec.list@...159...> wrote:

Hi there,

I just checked in some major reorganization work in __init__.py

The main intention was to move the list of option defaults to a separate
file 'rcdefaults.py' that could be imported from setup.py to access the
settings with minimal dependencies on the remaining code.

Hmm - let me think.... We already have
    rc
    rcParams
    rc_params
    rcdefaults
    rcParamDefaults
    defaultParams
in the main module of maplotlib

How about calling the new module 'rcdefaultparams.py', simply to make
the confusion complete and because I really feel that no other name
would fit the current "naming scheme" better... :wink:

Greetings,
Norbert

John Hunter wrote:

···

On 6/30/07, Norbert Nemec <Norbert.Nemec.list@...159...> wrote:
  

Hi there,

I just checked in some major reorganization work in __init__.py

The main intention was to move the list of option defaults to a separate
file 'rcdefaults.py' that could be imported from setup.py to access the
settings with minimal dependencies on the remaining code.
    
I haven't tested this but I did take a brief look at it and I think
your cleaning and organizing is useful. I think we have a naming
problem though -- this __init__ module defines an rcdefaults function,
which is likely to cause confusion with the new rcdefaults module.
Eg,

>from matplotlib import rcdefaults

will be ambiguous. You may want to consider a new name.

DH

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
matplotlib-devel List Signup and Options

Norbert Nemec wrote:

Hmm - let me think.... We already have
    rc
    rcParams
    rc_params
    rcdefaults
    rcParamDefaults
    defaultParams
in the main module of maplotlib

How about calling the new module 'rcdefaultparams.py', simply to make
the confusion complete and because I really feel that no other name
would fit the current "naming scheme" better... :wink:

Yes, it is confusing, there are too many similar names. I suspect some are used infrequently enough that we could change them without too much pain.

But the new module is really two things: 1) rc utilities (mainly validation facilities) and 2) a set of default values. If these are kept together the module could be called "rc_init.py" because everything is mainly used for rc initialization, although there are things still in mpl's __init__.py that are also part of the rc initialization. Or it could be called "rc_utils.py" or "rcsetup.py". I would prefer any of these to rcdefaultparams.py.

Furthermore, even after factoring out the rc things as you have done the mpl namespace is badly cluttered with things like checkdep_dvipng, (which is actually part of the rc validation, so maybe it should be in your new module) so still more refactoring and/or renaming might be in order. I can imagine a class being used to good effect to organize the whole business of rc handling.

One more miscellaneous thought: shouldn't mpl.rc() be using the validation functions instead of simply stuffing inputs into rcParams?

I suppose this brings us back to the old "traits, properties, or neither" question. But incremental improvements such as the one you have made are still helpful.

Eric

···

Greetings,
Norbert

John Hunter wrote:

On 6/30/07, Norbert Nemec <Norbert.Nemec.list@...159...> wrote:
  

Hi there,

I just checked in some major reorganization work in __init__.py

The main intention was to move the list of option defaults to a separate
file 'rcdefaults.py' that could be imported from setup.py to access the
settings with minimal dependencies on the remaining code.
    

I haven't tested this but I did take a brief look at it and I think
your cleaning and organizing is useful. I think we have a naming
problem though -- this __init__ module defines an rcdefaults function,
which is likely to cause confusion with the new rcdefaults module.
Eg,

>from matplotlib import rcdefaults

will be ambiguous. You may want to consider a new name.

DH

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
matplotlib-devel List Signup and Options

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
matplotlib-devel List Signup and Options

Norbert,

Revision 3445 has some very small changes to fix problems resulting from your reorganization. The questions of module and other naming are still open.

Eric

I just tried to commit a rename of 'rcdefaults.py' to 'rcsetup.py', but
I got an error:

···

-------------
...$ svn commit -m"renamed rcdefaults.py to rccsetup.py to avoid conflict"
Sending matplotlib/__init__.py
Deleting matplotlib/rcdefaults.py
Adding matplotlib/rcsetup.py
svn: Commit failed (details follow):
svn: COPY of rcsetup.py: 403 Forbidden (https://svn.sourceforge.net)
-------------

If anybody knows what the reason for this might be, please let me know...

Greetings,
Norbert

Eric Firing wrote:

Norbert Nemec wrote:
  

Hmm - let me think.... We already have
    rc
    rcParams
    rc_params
    rcdefaults
    rcParamDefaults
    defaultParams
in the main module of maplotlib

How about calling the new module 'rcdefaultparams.py', simply to make
the confusion complete and because I really feel that no other name
would fit the current "naming scheme" better... :wink:
    
Yes, it is confusing, there are too many similar names. I suspect some
are used infrequently enough that we could change them without too much
pain.

But the new module is really two things: 1) rc utilities (mainly
validation facilities) and 2) a set of default values. If these are
kept together the module could be called "rc_init.py" because everything
is mainly used for rc initialization, although there are things still in
mpl's __init__.py that are also part of the rc initialization. Or it
could be called "rc_utils.py" or "rcsetup.py". I would prefer any of
these to rcdefaultparams.py.

Furthermore, even after factoring out the rc things as you have done the
mpl namespace is badly cluttered with things like checkdep_dvipng,
(which is actually part of the rc validation, so maybe it should be in
your new module) so still more refactoring and/or renaming might be in
order. I can imagine a class being used to good effect to organize the
whole business of rc handling.

One more miscellaneous thought: shouldn't mpl.rc() be using the
validation functions instead of simply stuffing inputs into rcParams?

I suppose this brings us back to the old "traits, properties, or
neither" question. But incremental improvements such as the one you
have made are still helpful.

Eric
  

Greetings,
Norbert

John Hunter wrote:
    

On 6/30/07, Norbert Nemec <Norbert.Nemec.list@...159...> wrote:
  

Hi there,

I just checked in some major reorganization work in __init__.py

The main intention was to move the list of option defaults to a separate
file 'rcdefaults.py' that could be imported from setup.py to access the
settings with minimal dependencies on the remaining code.
    

I haven't tested this but I did take a brief look at it and I think
your cleaning and organizing is useful. I think we have a naming
problem though -- this __init__ module defines an rcdefaults function,
which is likely to cause confusion with the new rcdefaults module.
Eg,

>from matplotlib import rcdefaults

will be ambiguous. You may want to consider a new name.

DH

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
matplotlib-devel List Signup and Options

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
matplotlib-devel List Signup and Options
    
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
matplotlib-devel List Signup and Options

Norbert,

I just did the rename, and it worked:

efiring@...340...:~/programs/py/mpl/matplotlib_units$ svn move lib/matplotlib/rcdefaults.py lib/matplotlib/rcsetup.py
A lib/matplotlib/rcsetup.py
D lib/matplotlib/rcdefaults.py
efiring@...340...:~/programs/py/mpl/matplotlib_units$ svn status
? CXX.new
? svn-commit.2.tmp
? test.png
? svn-commit.tmp
? unit/legend_unit.png
? lib/svn-commit.tmp
D lib/matplotlib/rcdefaults.py
A + lib/matplotlib/rcsetup.py
? examples/units/basic_units.pyc
efiring@...340...:~/programs/py/mpl/matplotlib_units$ svn commit
Zed V1.0.3 by Sandro Serafini (c) 1997/98
Loading /home/efiring/.zedxrc...
Reading /home/efiring/myzed.cfg...
Resuming /home/efiring/.zedxrc...
Deleting lib/matplotlib/rcdefaults.py
Adding lib/matplotlib/rcsetup.py

Committed revision 3465.

I also changed __init__.py to import rcsetup in a revision that followed by about 2 minutes--so I hope no one did an svn update during that interval.

I have no idea what cause your svn commit failure.

Eric

Norbert Nemec wrote:

···

I just tried to commit a rename of 'rcdefaults.py' to 'rcsetup.py', but
I got an error:

-------------
...$ svn commit -m"renamed rcdefaults.py to rccsetup.py to avoid conflict"
Sending matplotlib/__init__.py
Deleting matplotlib/rcdefaults.py
Adding matplotlib/rcsetup.py
svn: Commit failed (details follow):
svn: COPY of rcsetup.py: 403 Forbidden (https://svn.sourceforge.net)
-------------

If anybody knows what the reason for this might be, please let me know...

Greetings,
Norbert