Mypy and implicit namespaces

History / Edit / PDF / EPUB / BIB /
Created: March 3, 2020 / Updated: March 9, 2020 / Status: finished / 1 min read (~78 words)

I use mypy but it doesn't seem to scan all my files. Why?

You might be using implicit namespaces in your code (see PEP 420). Support for implicit namespaces in mypy is rather flaky as of 2020-03-03.

One solution for the moment is to add __init__.py and make all your namespaces explicit.

Another solution is to replace your calls to mypy some-path with mypy $(find some-path -name "*.py").