python / mypy

Optional static typing for Python
https://www.mypy-lang.org/
Other
17.85k stars 2.74k forks source link

mypy is unusable when using incomplete stubs on local source #17444

Open ClementDelannoySlateDigital opened 6 days ago

ClementDelannoySlateDigital commented 6 days ago

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