mypy
mypy copied to clipboard
mypy is unusable when using incomplete stubs on local source
Bug Report
On a big source base, I generated stub files for each files (because I want to workaround the "Skipping analyzing X, missing library stubs" with inline-typed source). Most of my source base is untyped, leading to incomplete stub files. When I run mypy with my new stub files (using MYPYPATH), I now have a lot of errors about imported module stub files being incomplete (no-untyped-def errors). The parameter "follow-imports=skip" does not work in that case.
I guess that's a bug, if that's a feature I don't understand the rationale and it prevents me for using stub files, because I want to focus my tests on typed files.
To Reproduce
on an existing untyped source base (with imports between submodules), generate stubs files. Run mypy using stub files. Try to use the --follow-imports parameter to change output
Expected Behavior
Either add a way to exclude pyi files from analyze, or use the follow-imports parameter so that the analyze do not apply to imported stub files.
Actual Behavior
Very verbose logs, for each import, every incomplete stub files will generate a lot of logs, and follow-imports parameter does not change anything.
Your Environment
- Mypy version used: 1.10.1, via pre-commit (mirrors-mypy)
- Mypy command-line flags: [--ignore-missing-imports, --strict, --warn-return-any, --follow-imports, skip]
- Mypy configuration options from
mypy.ini
(and other config files): none - Python version used: 3.10.2