There is a non-namespace package pkg:
pkg/__init__.py (non-empty) pkg/file1.py pkg/lib/file2.py
Someone adds a “semi-namespace” package pkg_extras with same top level directory pkg
What can go wrong here
Previously I thought that uninstalling one of the packages breaks another since they both think they own the root directory pkg. But this does not seem to be the case in practice. Uninstalling pkg_extras only deletes “pkg/extras/" and when uninstalling pkg, it tries to delete "pkg/”, but preserves the “pkg/extras/*” files.
So, is there still an issue with using the same root directory/module in non-namespace packages?
P.S. We’ve also added
__path__ = __import__('pkgutil').extend_path(__path__, __name__) to the non-empty
pkg/__init__.py file, but I do not fully understand what this really does. Can you help me understand that line and whether it’s beneficial or detrimental for this case?