This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author pje
Recipients barry, brett.cannon, eric.araujo, eric.snow, georg.brandl, larry, ncoghlan, pitrou, pje, python-dev, skrah
Date 2012-08-02.20:28:24
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1343939307.28.0.675883632818.issue15295@psf.upfronthosting.co.za>
In-reply-to
Content
Hope I'm not too late to the bikeshed painting party; just wanted to chip in with the suggestion of "self-contained package" for non-namespace packages.  (i.e., a self-contained package is one that cannot be split across different sys.path entries due to its use of an __init__ module).

Also, technically, namespace portions do not only contribute subpackages; they can contribute modules as well.

Another point of possible confusion: meta finders and path finders are both described as "hooks", but this terminology seems in conflict with the use of "hook" as describing a callable on path_hooks.  Perhaps we could drop the term "hook" from this section, and retitle it "Import System Extensions" and say you can extend the system by writing meta finders and path entry finders.  This would let the term "hook" be the exclusive property of path_hooks, which is how you extend the import system to use your custom finders.

The statement about __path__ being a list is also out-of-date; as of PEP 420, it can be an immutable, iterable object.  Specification-wise, __path__ need only be a re-iterable object, and people reading its value must NOT assume that it's a list or even indexable.

The term "sys path finder" should also be replaced by "path entry finder".  The former term is both incorrect and misleading, as it both implies that such a finder actually searches sys.path, and that it is exclusive to sys.path.  Path entry finders are used to look for modules within a location specified by a "path entry" - a string found in sys.path or in a __path__ attribute.

The term "path importer" is also horribly confusing in context...  after some reflection, I suggest the following additional terminology changes:

1. Replace "meta path finder" with "import handler"
2. Replace "path importer" with "sys.path import handler"

Now we can say that you extend the import system by adding import handlers to sys.meta_path, and that one of the default handlers is the sys.path import handler, which processes imports using sys.path and module __path__ attributes.

The sys.path import handler can of course in turn be extended by adding path hooks to sys.path_hooks, which are used to create module finder objects for the path entry strings found in sys.path and module __path__ attributes.  A path hook must return a finder object, which implements similar methods to those of an import handler, but with some important differences.

Whew.  It's a bit of a mouthful, but I think that this set of terms would keep all the roles and functions clear, along with their relationships to one another.  In addition, I think it provides greater clarity as to which pieces you need to extend when, why, and how.

What do you think?
History
Date User Action Args
2012-08-02 20:28:27pjesetrecipients: + pje, barry, brett.cannon, georg.brandl, ncoghlan, pitrou, larry, eric.araujo, skrah, python-dev, eric.snow
2012-08-02 20:28:27pjesetmessageid: <1343939307.28.0.675883632818.issue15295@psf.upfronthosting.co.za>
2012-08-02 20:28:26pjelinkissue15295 messages
2012-08-02 20:28:24pjecreate