I noticed a change in behavior between versions 0.720 and 0.730 when using pkgutil-style namespace packages.
For the following __init__.py file:
__path__ = __import__('pkgutil').extend_path(__path__, __name__)
mypy == 0.720 will report:
$ mypy --version
mypy 0.720
$ mypy --show-traceback __init__.py
__init__.py:2: error: Cannot determine type of '__path__'
Thus, I "resolved" this with the following in, in 0.720:
from typing import Iterable
__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: Iterable[str]
With mypy ==0.730, I get the following:
$ mypy --version
mypy 0.730
mypy --show-traceback __init__.py
__init__.py:2: error: Module has no attribute "extend_path"
Found 1 error in 1 file (checked 1 source file)
When researching this issue, #7501 (comment) indicates that __import__ is not followed. However, I don't fully understand the change in behavior and had trouble using git-bisect to narrow it down.
I noticed a change in behavior between versions 0.720 and 0.730 when using
pkgutil-style namespace packages.For the following
__init__.pyfile:mypy == 0.720will report:Thus, I "resolved" this with the following in, in
0.720:With
mypy ==0.730, I get the following:When researching this issue, #7501 (comment) indicates that
__import__is not followed. However, I don't fully understand the change in behavior and had trouble usinggit-bisectto narrow it down.