"namespace" vs "module" packages (was Re: [Zope3-dev] packaging conventions note)

Jim Fulton jim@zope.com
Sat, 14 Dec 2002 09:34:03 -0500


Barry A. Warsaw wrote:
>>>>>>"JF" == Jim Fulton <jim@zope.com> writes:
>>>>>>
> 
>     JF> Namespace packages should not export any names from their
>     JF> __init__ modules.
> 
> That's a nice distinction, if it can work in practice.
>     
>     JF> It should be possible to distribute sub-packages or submodules
>     JF> of these independently.  I would even say that namespace
>     JF> packages should allow themselves to be spread over multiple
>     JF> physical locations.  For example, I want the zope and
>     JF> zopeproducts packages to have an __init__ that arranges for
>     JF> all zope and zopeproducts directories found on the Python path
>     JF> to be added to the respective package paths,
> 
> That would solve the problem of having to make sure all the
> subpackages have the same (or at least non-conflicting)
> __init__.py's.  Jim said in a previous message that that would be
> manageable, but if those namespace package __init__.py's have any
> significant code at all, I would disagree.  Look at something like the
> proliferation of test.py's.
> 
> So what kind of infrastructure are you thinking about to allow
> super-packages like zope and zopeproducts to have components spread
> around the file system?

You and I discussed this before. I think you even prototyped something.

Any installation of the zope package would have an identical
__init__.py module. This module would have a bit of boilerplate that
seached through sys.path and added every zope directory found in the
path to the zope package path.

Jim

-- 
Jim Fulton           mailto:jim@zope.com       Python Powered!
CTO                  (888) 344-4332            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org