[Distutils] Proper handling of PEP420 namespace packages with setuptools and pip

Chris Barker chris.barker at noaa.gov
Wed Apr 22 23:25:40 CEST 2015


A note from the peanut gallery:

I  like the idea of namepace packages, but every time I've tried to use
them, I've been stymied -- maybe this PEP will solve that, but...

First -  the issues:

- It somehow seems like a lot of work, details to get right, and
more-than-one-way-to-do-it. But maybe that's all pre- PEP 420

- Last time I tried, I couldn't get them to work with "setup.py develop"

But at the core of this -- Why does it have to be so hard? It seems very
simple to me -- what am I missing?

What are namespace packages? To me, they are a package that serves no other
purpose than to provide a single namespace in which to put other packages.
This makes a lot of sense if you have a bunch of related packages where
users may only require one, or a couple, but not all. And you want to be
able to maintain them, and version control them independently.

But it seem to get this, all we need is:

1) A directory with the top-level name

2) It has an (empty)  __init__.py (so it is a python package)

3) It has other directories in it -- each of these are regular old python
packages -- the ONLY difference is that they are installed under that name

That's it. Done. Now all we need is a way to install these things -- well
that's easy, each sub-package installs itself just like it would, maybe
overwriting the top level directory name and the __init__.py, if another
sub-package has already installed it. But that's OK, because the name is by
definition the same, and the __init__ is empty.

This seems SO SIMPLE. No declaring things all over the place, no dynamic
path manipulation, nothing unusual at all, except the ability to install a
module into a dir without clobbering what might already be in that dir.

What am I missing?

-Chris





-- 

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20150422/c5241ade/attachment-0001.html>


More information about the Distutils-SIG mailing list