[Import-SIG] New draft revision for PEP 382

P.J. Eby pje at telecommunity.com
Sat Jul 9 20:52:49 CEST 2011

At 06:13 PM 7/9/2011 +1000, Nick Coghlan wrote:
>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).
>(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.
>I believe this may need a "parent=''" argument so it can also be used
>to extend a package path.

Yes, it does; see the sketch here:  http://pastebin.com/G7fdFG2V

I just left that bit out of the spec as an extra detail that would 
need explaining; I see it as really being internal to the API being 
provided in that case.

> > 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.

Got it.

> > * ``*.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).

Yeah...  Honestly the more we talk about all that the more inclined I 
am to saying that it's a zero-length file, just to avoid more spec detail.  ;-)

I just don't know if there are any issues with packaging or revision 
control systems for zero length files, not to mention whether there 
are OSes where it's hard to make a zero-length file.

More information about the Import-SIG mailing list