[Distutils] namespace packages
pje at telecommunity.com
Thu Apr 22 18:10:38 CEST 2010
At 04:36 PM 4/22/2010 +0900, David Cournapeau wrote:
>On Thu, Apr 22, 2010 at 1:10 PM, P.J. Eby <pje at telecommunity.com> wrote:
> > At 10:18 AM 4/22/2010 +0900, David Cournapeau wrote:
> >> One problem with the setuptools implementation is
> >> that several packages sharing the same namespace have files in common,
> > If that were actually true (it isn't), then it would be considered a bug in
> > setuptools.
>I am confused, then, by the setuptools doc:
>Note, by the way, that your project's source tree must include the
>namespace packages' __init__.py files (and the __init__.py of any
>parent packages), in a normal Python package layout. These __init__.py
>files must contain the line:
If you read two paragraphs further in that doc, you'll see where it
goes on to say:
"You must NOT include any other code and data in a namespace
package's __init__.py. Even though it may appear to work during
development, or when projects are installed as .egg files, it will
not work when the projects are installed using "system" packaging
tools -- in such cases the __init__.py files **will not be
installed**, let alone executed. " (emphasis added)
>and because that's in the rationale of Pep 382. If this is not true,
>we need to update our own instructions because we advise to write such
>__init__.py in scikits namespace in the scipy community.
You still need to write them, for egg-based installs. But when
packaged for *system* installation, they aren't going to be there.
> >> (setuptools namespace implementation depends on pkg_resources, which is a
> >> complicated and quite slow piece of code).
> > Slow at doing what, precisely, and slower compared to what alternative?
>Merely importing it is already quite slow,
I'd be interested in knowing under what conditions that's the case
(e.g. how many .egg zipfiles vs. how many .egg subdirs); it might be
possible to improve it.
More information about the Distutils-SIG