-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Open
Labels
bugmypy got something wrongmypy got something wrong
Description
--namespace-packages
runs into an issue if we import from __init__.py
explicitly.
For instance, given:
.
└── proj
├── __init__.py
└── a.py
$ cat proj/__init__.py
x: int
$ cat proj/a.py
from .__init__ import x
$ cat proj/b.py
from proj.__init__ import x
running mypy will result in:
$ mypy proj --namespace-packages
proj/__init__.py: error: Source file found twice under different module names: 'proj' and 'proj.__init__'
This issue comes up at least twice in mypy_primer's corpus.
This is correct in that you do get two entries in sys.modules, but undesirable for this to block type checking
autosquash
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrong