Mypy is an optional static type checker for Python.
Mypy can find many classes of bugs automatically, improving the quality of your code. Perhaps more importantly, type annotations act as machine-checked documentation and make your code easier to understand and maintain. Mypy can scale to multi-million line codebases, while providing quick incremental checking through the mypy daemon.
Mypy lets you freely mix type checked and unannotated code, making it possible to gradually migrate existing codebases to static type checking.
What is mypyc?
Mypyc is a compiler from a type annotated Python dialect to CPython C extension modules that uses mypy as the front end. It can often significantly speed up Python code. We originally built mypyc to compile mypy, making mypy 4x faster. We are now looking at making mypyc useful for end users as a practical tool to make Python programs and libraries more efficient.
It's easy to ensure that programs compiled with mypyc continue to also be valid (non-compiled) Python programs. Modules compiled with mypyc can freely interact with interpreted modules. Mypyc lets you compile a few performance-sensitive modules and keep the rest of your program interpreted.
mypy 2020 Projects
Generalize mypyc IR to Make non-C Backends PossibleMypyc now employs an IR that is tightly bound to C, which makes potential experiments with new backends impractical and also breaks the layering...