The Mypy docs state:
If a directory contains both a
.pyand a.pyifile for the same module, the.pyifile takes precedence. This way you can easily add annotations for a module even if you don’t want to modify the source code.
That behavior basically means that if you have stub files, you will miss all type errors in the respective source files.
I expected Mypy to check and compare both the source and the stub files. Is there a workable solution to this?
stubtest, but you might be better off using inline type hints. Is there a specific reason you can't do so?my_module.pyandmy_module.pyihave the same module name). You might be able to craft a solution using--shadow-fileand running mypy twice. (don't forget, mypy can read arguments from a file rather than all from the CLI, because its argument parser specifiesfromfile_prefix_chars)..pyis and inline-typed.pys in the same directory, usually when the quantity of type annotations and overloads are far far greater than the actual runtime code..pyfile is opaque to the typechecker, there's nothing wrong with that.stubtestcan check the interface compatibility.