You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
zipimporter misses namespace packages for implicit dirs #80921
As discovered in pypa/packaging-problems#212, if a PEP-420 namespace package is represented by an implicit directory (that is, there's no explicit entry for the directory, only entries for the contents of the directory), that directory won't be picked up as a namespace package. The following code illustrates the issue:
As you can see, in simple.zip, the pkg directory is implied, but despite that condition, pkg is importable.
However, with namespace.zip, the name ns is not visible even though it's present in the zipfile and would be importable if that zipfile were extracted to a file system.
If you were to reconstruct that zip file on the file system using standard tools or explicitly include 'ns/' in the zip entries, the namespace package becomes visible:
Activity
jaraco commentedon Apr 27, 2019
As discovered in pypa/packaging-problems#212, if a PEP-420 namespace package is represented by an implicit directory (that is, there's no explicit entry for the directory, only entries for the contents of the directory), that directory won't be picked up as a namespace package. The following code illustrates the issue:
As you can see, in simple.zip, the
pkgdirectory is implied, but despite that condition,pkgis importable.However, with namespace.zip, the name
nsis not visible even though it's present in the zipfile and would be importable if that zipfile were extracted to a file system.If you were to reconstruct that zip file on the file system using standard tools or explicitly include 'ns/' in the zip entries, the namespace package becomes visible:
For consistency, the zip import logic should probably honor implicit directories in zip files.
ericvsmith commentedon Apr 28, 2019
This is a duplicate of bpo-14905.