ManderaGeneral/generalimport

Handle namespace packages

Mandera opened this issue · 1 comments

Pip uninstall sometimes leaves behind empty folders which will return in namespace packages indicated by their lack of __path__.
These can be imported like normal meaning our custom importer will never be asked.

Solution I'm trying is to insert an importer at index 0 of sys.meta_path and only put namespace packages there.
I'm creating a function to check if a module is a namespace package, had some trouble because I forgot to remove it from sys.modules meaning it bypassed all importers