[Import-SIG] New draft revision for PEP 382

Nick Coghlan ncoghlan at gmail.com
Sat Jul 9 10:13:47 CEST 2011


Nice write up!

Barry covered most things, just a few minor comments below.

On Sat, Jul 9, 2011 at 5:51 AM, P.J. Eby <pje at telecommunity.com> wrote:
> Vendor Package
>    A group of files installed by an operating system's packaging
>    mechanism (e.g. Debian or Redhat packages installed on Linux
>    systems).

s/Redhat/RPM/

(or Red Hat. Either works, but Redhat is wrong)

> * A new ``extend_namespaces(path_entry)`` function, to extend existing
>  and already-imported namespace packages' ``__path__`` attributes to
>  include any portions found in a new ``sys.path`` entry.  This
>  function should be called by applications extending ``sys.path``
>  at runtime, e.g. to include a plugin directory or add an egg to the
>  path.
>
>  The implementation of this function does a simple breadth-first walk
>  of ``sys.namespace_packages``, and performs any necessary
>  ``namespace_subpath()`` calls to identify what path entries need to
>  be added to each package's ``__path__``, given that `path_entry`
>  has been added to ``sys.path``.

I believe this may need a "parent=''" argument so it can also be used
to extend a package path.

> For users, developers, and distributors of namespace packages:
>
> * ``sys.namespace_packages`` is allowed to contain non-existent or
>  not-yet-imported package names; code that uses its contents should
>  not assume that every name in this set is also present in
>  sys.packages or that importing the name will necessarily succeed.

s/sys.packages/sys.modules/

>
> * ``*.ns`` files must be empty or contain only ASCII whitespace
>  characters.  This leaves open the possibility for future extension
>  to the format.

+1 for Barry's suggestion to mandate # as a comment prefix and
disallow any other contents (even though the interpreter itself won't
enforce that).

Cheers,
Nick.

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


More information about the Import-SIG mailing list