[Distutils] bdist_wheel alters namespace packages paths:

Brian Allen Vanderburg II brianvanderburg2 at aim.com
Mon Jul 4 11:49:39 EDT 2016


In a manor similar to my previous messages about path manipulation from
the .pth files, I've noticed that a wheel created by bdist_wheel also
performs some path manipulation issues for namespace packages:

First it seems that setup.py when creating the wheel does not install
the __init__.py namespace file.  When the nspkg.pth file gets loaded by
site.py, it creates the dummy namespace module in sys.modules and sets
the __path__ to contain where it was found.

There seem to be couple issue with this:

Every namespace package under the same namespace must use the same
method to register it's path.  That is, every namespace package under
the same namespace will need an nspkg.pth file to extend the module
path.  This also prevents loading any namespace packages from the
current directory, such as for testing purposes, since the dummy module
is created by the nspkg.pth and seems to prevent the normal scanning of
sys.path for namespace packages during import.


Brian Allen Vanderburg II



More information about the Distutils-SIG mailing list