You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Mypy runs on the first file, even though the path passed is src/package/sub_package/.
project $ mypy src/package/sub_package/
src\package\__init__.py:1: error: Cannot find module named 'external'
src\package\__init__.py:1: note: See https://mypy.readthedocs.io/en/lates/running_mypy.html#missing-imports
src\package\sub_package\__init__.py:2: error: Unsupported operand types for + ("int" and "str")
I think this is strange, as I didn't specify src/package/. It should be noted that src/package/sub_package/__init__.py can be empty, but if it doesn't exist then the following error is returned:
There are no .py[i] files in directory 'src/package/sub_package'
The text was updated successfully, but these errors were encountered:
It's intentional. Mypy crawls up from the given filename(s) until it finds a directory without __init__.py, so it can follows imports. Without following imports, it wouldn't be able to check a lot of code, and without crawling up, it wouldn't be able to follow imports. If you don't want it to follow imports, you can use --follow-imports=error or --follow-imports=skip (but it will still crawl up to determine the file's module name). For full docs see https://mypy.readthedocs.io/en/latest/command_line.html.
With nothing but the following two files:
project/src/package/__init__.py
project/src/package/sub_package/__init__.py
Mypy runs on the first file, even though the path passed is
src/package/sub_package/
.I think this is strange, as I didn't specify
src/package/
. It should be noted thatsrc/package/sub_package/__init__.py
can be empty, but if it doesn't exist then the following error is returned:The text was updated successfully, but these errors were encountered: