[Import-SIG] PEP 420: Implicit Namespace Packages

Antoine Pitrou solipsis at pitrou.net
Sat May 5 00:47:11 CEST 2012


On Thu, 19 Apr 2012 16:18:21 -0400
"Eric V. Smith" <eric at trueblade.com> wrote:
> This reflects (I hope!) the discussions at PyCon. My plan is to produce
> an implementation based on the importlib code, and then flush out pieces
> of the PEP.

I don't understand why PEP 382 was rejected. There doesn't seem to be
any obvious argument against it. The mechanism is simple, explicit and
unambiguous. As PEP 382 points out:

“At the discussion at PyCon DE 2011, people remarked that having an
explicit declaration of a directory as contributing to a package is a
desirable property, rather than an obstactle. In particular, Jython
developers noticed that Jython could easily mistake a directory that is
a Java package as being a Python package, if there is no need to
declare Python packages.”

The "directory.pyp" scheme is highly unlikely to conflict with
unrelated uses of a ".pyp" directory extension. It's also easy to use,
and avoids oddities in the lookup algorithm such as “if the scan
completes without returning a module or package, and at least one
directory was recorded, then a namespace package is created”.

On the other hand, PEP 420 provides potential for confusion (for
example, if the standard "test" package is not installed, trying
to import it could end up importing some other arbitrary "test"
directory on the path as a namespace package), without seeming to have
any obvious advantage over PEP 382.

Unless there are clear advantages over PEP 382, I'm -1 on this PEP, and
would like to see PEP 382 revived.



More information about the Import-SIG mailing list