[Distutils] namespace_packages

Robert Kern robert.kern at gmail.com
Wed Jan 18 19:51:34 CET 2006


Charlie Moad wrote:
> Following the instruction for setuptools, I am trying to make
> matplotlib and basemap (a mpl toolkit) share the namespace
> "matplotlib/toolkits".  I can build and install the eggs no problems. 
> "matplotlib/toolkits" is in both's "EGG-INFO/namespace_packages.txt"
> files.  I have added __init__.py files with
> "__import__('pkg_resources').declare_namespace(__name__)" in both the
> mpl and basemap matplotlib/toolkits folders.  Basically I have done a
> ton of playing around and "from matplotlib.toolkits import basemap"
> will not work.  It is always limited to the scope of the matplotlib
> egg which it is hitting first.  Are the docs not reflective of the
> 0.6a9 release?  Any help is greatly appreciated.

That approach (adding the declare_namespace() calls to __init__.py files) should
only be necessary when the __init__.py files contain actual code that needs to
be executed. In this case, matplotlib/toolkits/__init__.py are otherwise empty,
IIRC. You should just add "matplotlib.toolkits" to the namespace_packages.txt.
Note the spelling of that. "." not "/".

-- 
Robert Kern
robert.kern at gmail.com

"In the fields of hell where the grass grows high
 Are the graves of dreams allowed to die."
  -- Richard Harter



More information about the Distutils-SIG mailing list