[Import-SIG] PEP 402: specification questions

"Martin v. Löwis" martin at v.loewis.de
Thu Nov 10 05:54:57 CET 2011


Am 09.11.2011 23:57, schrieb Barry Warsaw:
> On Nov 09, 2011, at 05:13 PM, PJ Eby wrote:
> 
>> In other words, the intention of PEP 402 is to have a uniform and simple
>> way to evolve packages that as a side-effect allows both traditional and
>> "namespace" packages to work.  It implements namespace packages by
>> *removing* something (i.e., getting rid of __init__.py) rather than by
>> adding something new (e.g. .pyp extensions).  For that reason, I think it's
>> better for the future of the language.
> 
> That's one thing that appeals to me as a distro packager about PEP 402.  Under
> PEP 402, it seems like it would be less work to modify a set of upstream
> packages to eliminate the collisions on __init__.py.

I think this impression is incorrect. Assuming we are talking about
existing packages here that use the existing setuptools namespace
mechanism and which have been ported to Python 3 already, then no
change to the package should be necessary at all to support PEP 382.

Instead, setuptools/distribute should implement the namespace_packages
parameter of setup.py in such a way that it
a) drops the __init__.py from the sources, as that should contain
   something like
   __import__('pkg_resources').declare_namespace(__name__)
b) copies the files into a P.pyp folder rather than a P folder
   on build_py.

Such a change would be necessary/possible with either PEP 382 or PEP
402, so it seems to make no difference.

Regards,
Martin



More information about the Import-SIG mailing list