Andrew Straw wrote: > As the author of the only other known MPL toolkit (at least in the MPL > tree), I'm happy with the idea of using a namespace package for > mpl_toolkits. I understand your proposal to mean that each toolkit would > have a directory structure: > > setup.py > lib/ > mpl_toolkits/ > __init__.py (empty) > basemap/ > __init__.py > other_files.py > > This is OK with me, but I question is whether it's necessary to have the > "lib" directory -- it seems entirely redundant. I'm fine with either > way, though. > > -Andrew
Andrew: Yes, that's it, except that all the __init__.py files must be empty, not just the first one. Additionally, there would be a file 'api.py' in the same directory as 'other_files.py' that would have all the stuff that previously was imported directly into __init__.py. The rationale for this convention is discussed at http://neuroimaging.scipy.org/neuroimaging/ni/ticket/86, and is being used now in several projects. The lib directory is not necessary, you would just change the package_dirs = {'':'lib'} line in setup.py accordingly. -Jeff > > > Jeff Whitaker wrote: > >> Now that the transforms branch has merged with the trunk, I'd like to >> resurrect namespace packages so that toolkits will work again when >> matplotlib is installed as an egg. As was discussed in a previous >> thread, all __init__.py files in the toolkit hierarchy must be empty >> (aside declare_namespace statement). Since lib/matplotlib/__init__.py >> contains a lot of important stuff, I think the path of least resistance >> is to move the toolkits out of lib/matplotlib and into a separate >> directory lib/mpl_toolkits. The semantics of importing a toolkit would >> have to change from >> >> import matplotlib.toolkits.toolkit >> >> to >> >> import mpl_toolkit.toolkit. >> >> Of course, all the toolkit __init__.py files would need to be emptied. >> In the case of basemap, this would be changing imports from >> >> from matplotlib.toolkits.basemap import Basemap >> >> to something like >> >> from mpl_toolkits.basemap.api import Basemap >> >> All the stuff now imported directly into __init__.py would go in api.py. >> >> I've tried this in my local tree and it seems to work fine. Does this >> sound reasonable? If there's general agreement, I can make the >> necessary mods in matplotlib trunk and the mplsizer and basemap toolkits. >> >> -Jeff >> >> >> > > -- Jeffrey S. Whitaker Phone : (303)497-6313 Meteorologist FAX : (303)497-6449 NOAA/OAR/PSD R/PSD1 Email : [EMAIL PROTECTED] 325 Broadway Office : Skaggs Research Cntr 1D-124 Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace _______________________________________________ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel