[Import-SIG] New PEP draft: "Simplified Package Layout and Partitioning"

Nick Coghlan ncoghlan at gmail.com
Thu Jul 14 05:16:50 CEST 2011

Excellent write-up!

On Thu, Jul 14, 2011 at 3:11 AM, P.J. Eby <pje at telecommunity.com> wrote:
> Thus, the only potential backwards-compatibility issues are:
> 1. Tools that expect package directories to have an ``__init__``
>   module, that expect directories without an ``__init__`` module
>   to be unimportable, or that expect ``__path__`` attributes to be
>   static, will not recognize virtual packages as packages.
>   (In practice, this just means that tools will need updating to
>   support virtual packages, e.g. by using ``pkgutil.walk_modules()``
>   instead of using hardcoded filesystem searches.)

It's probably worth noting here that tools that do manual filesystem
searches often already break when confronted with PEP 302 importers
(including zipimport), so this would just be more incentive for them
to do the right thing.

We may also want to provide (probably in importlib) a way to walk the
*potentially* importable modules on a path entry without actually
importing them.

While I understand the desire to focus on an import.c/pkgutil.py based
implementation at this point, it's highly likely than builtin
__import__ will be importlib based for 3.3. I'd be a lot happier if we
stopped double-keying work and just wrote the importlib versions
rather than messing with the soon-to-die C code any further.


Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia

More information about the Import-SIG mailing list