[Python-checkins] peps: Support legacy portions along with PEP 420 portions.

eric.smith python-checkins at python.org
Wed May 16 04:13:38 CEST 2012


http://hg.python.org/peps/rev/10b1bffbb69a
changeset:   4384:10b1bffbb69a
user:        Eric V. Smith <eric at trueblade.com>
date:        Tue May 15 22:13:32 2012 -0400
summary:
  Support legacy portions along with PEP 420 portions.

files:
  pep-0420.txt |  19 +++++++++++++++++++
  1 files changed, 19 insertions(+), 0 deletions(-)


diff --git a/pep-0420.txt b/pep-0420.txt
--- a/pep-0420.txt
+++ b/pep-0420.txt
@@ -38,6 +38,8 @@
    stored in a zip file) that contribute to a namespace package.
  * "regular package" refers to packages as they are implemented in
    Python 3.2 and earlier.
+ * "legacy portion" refers to a portion that uses ``__path__``
+   manipulation in order to implement namespace packages.
 
 This PEP defines a new type of package, the "namespace package".
 
@@ -184,6 +186,11 @@
 searching continues.  If ``loader`` is not ``None``, it is immediately
 used to load a module or regular package.
 
+Even if ``loader`` is returned and is not ``None``,
+``<iterable-of-path-entries>`` must still contain the path entries for
+the package.  This allows code such as ``pkgutil.extend_path()`` to
+compute path entries for packages that it does not load.
+
 Note that multiple path entries per finder are allowed.  This is to
 support the case where a finder discovers multiple namespace portions
 for a given ``fullname``.  Many finders will support only a single
@@ -230,6 +237,18 @@
 scope of this PEP.
 
 
+Migrating from legacy namespace packages
+----------------------------------------
+
+As described above, prior to this PEP ``pkgutil.extend_path()`` was
+used by legacy portions to create namespace packages.  Because it is
+likely not practical for all existing portions of a namespace package
+to be migrated to this PEP at once, ``extend_path()`` will be modified
+to also recognize PEP 420 namespace packages.  This will allow some
+portions of a namespace to be legacty portions while others are
+migrated to PEP 420.
+
+
 Packaging Implications
 ======================
 

-- 
Repository URL: http://hg.python.org/peps


More information about the Python-checkins mailing list