In my package's __init__.py, when I list the names of all my submodules along with the functions imported from them in __all__, such that from pkg import * would make the submodule objects available in the global namespace as well, stubtest thinks the submodules are missing, meaning __all__ is inconsistent with what happens at runtime.
However, python's import machinery means that loading a submodule binds it to the parent module as an attribute with the same name. This is how when you import a submodule in any way, it is accessible by dotted name on the parent module, so there is nothing wrong with including the submodules in my __all__, and in my case an intended behaviour. This is significant since stubtest annoyingly produces one diagnostic per submodule, and including them in allowlist may shadow other issues.
In my package's
__init__.py, when I list the names of all my submodules along with the functions imported from them in__all__, such thatfrom pkg import *would make the submodule objects available in the global namespace as well, stubtest thinks the submodules are missing, meaning__all__is inconsistent with what happens at runtime.However, python's import machinery means that loading a submodule binds it to the parent module as an attribute with the same name. This is how when you import a submodule in any way, it is accessible by dotted name on the parent module, so there is nothing wrong with including the submodules in my
__all__, and in my case an intended behaviour. This is significant since stubtest annoyingly produces one diagnostic per submodule, and including them in allowlist may shadow other issues.