Description
Bug Report
We have a project that includes type stubs for a python package that does not provide it's own typing. We followed guidance per https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-library-stubs-or-py-typed-marker number 3
(venv) vfazio@vfazio2 ~/development/xtf $ grep mypy_path mypy.ini
mypy_path=$MYPY_CONFIG_FILE_DIR/stubs
In mypy 0.961, type checks pass
(venv) vfazio@vfazio2 ~/development/xtf $ mypy -V; mypy xes/
mypy 0.961 (compiled: no)
Success: no issues found in 86 source files
In mypy 0.971, these now fail because the current path is being added to the path search
(venv) vfazio@vfazio2 ~/development/xtf :( $ mypy -V; mypy xes/
mypy 0.971 (compiled: no)
['/mnt/development/mypy/venv/lib/python3.10/site-packages', '/mnt/development/xtf']
/mnt/development/xtf is in the MYPYPATH. Please remove it.
See https://mypy.readthedocs.io/en/stable/running_mypy.html#how-mypy-handles-imports for more info
If i modify mypy/pyinfo.py::getsearchdirs
to exclude the current working directory (effectively reverting 2132036) the type checks "work" except I now get type failures for the stubs
(venv) vfazio@vfazio2 ~/development/xtf $ mypy -V; mypy xes/
mypy 0.971 (compiled: no)
stubs/redacted/path/file.pyi:49:9: error: Function is missing a return type annotation [no-untyped-def]
stubs/redacted/path/file.pyi:49:9: note: Use "-> None" if function does not return a value
<snip>
Found 58 errors in 2 files (checked 86 source files)
Expected Behavior
Failures wouldn't occur or documentation would be updated to reflect how to accommodate this use case.
Actual Behavior
mypy now fails to type check our code because we include stubs as part of our source tree
Your Environment
- Mypy version used: 0.971
- Mypy command-line flags:
- Mypy configuration options from
mypy.ini
(and other config files): - Python version used: 3.10.4
- Operating system and version: Ubuntu 20.04