Description
When trying to use the pip package ciso8601, I found that my project saw the module as empty. On further inspection, I found that this package had provided an __init__.pyi
file (see https://github.com/closeio/ciso8601/tree/master/ciso8601), but no __init__.py
. I'm not very familiar with how the module system treats __init__.pyi
files, but it seems to work fine in isolation.
However, an __init__.py
provided by add_pkgutil_style_namespace_pkg_init was taking precedence.
When I removed the __init__.py
, my project could see the ciso8601 module as intended. The problem also goes away when enable_implicit_namespace_pkgs = True
is provided to pip_install
, but this may not generalize well to other packages (nothing has broken yet, but I can only presume the functionality is there for a reason).
The issue, at least for this purpose, is that add_pkgutil_style_namespace_pkg_init
is only looking for a __init__.py
. My suggestion is to also check for an __init__.pyi
before creating the new __init__.py
.