Support legacy portions along with PEP 420 portions.
This commit is contained in:
parent
e8108d36cd
commit
ec4303b832
19
pep-0420.txt
19
pep-0420.txt
|
@ -38,6 +38,8 @@ Within this PEP:
|
|||
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 @@ be empty) is added to the list of recorded path entries and path
|
|||
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 @@ any standard library packages become namespace packages is outside the
|
|||
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
|
||||
======================
|
||||
|
||||
|
|
Loading…
Reference in New Issue