Mypy
Rationale
We use Mypy as the main static type checker for Python source code.
- It is an old-school Python type checker, which means it has many rules implemented and has been thoroughly tested.
- It is open source.
- It has a huge number of typing checks.
- It supports caching already-reviewed files for performance.
- It does not provide a language server out of the box, considerably affecting development experience.
- It integrates in-editor typing using its VS Code extension for the development experience.
- As it is built in Python, it has serious performance limitations.
Alternatives
Below are alternatives we are currently considering as possible replacements for Mypy:
Ty
- Ty is a static type checker developed by Astral, creators of uv and Ruff ; it is still under development.
- Is open source.
- It does not have as many typing checks as Mypy.
- Although it currently does not support caching, it is still much faster compared to Mypy.
- It provides a language server out of the box, considerably improving the development experience.
- It integrates in-editor typing using its VS Code extension for the development experience.
- As it is built in Rust, it is considerably faster compared to other type checkers, up to a point where performance is no longer a concern.
Ty was last reviewed on Aug 1, 2025.
Pyright
- Pyright is a static type checker developed by Microsoft; after Mypy, it is the most widely used type checker and is production-ready.
- It is open source.
- It is very close to Mypy, maybe even ahead, in terms of typing checks.
- Although it currently does not support caching, it is still much faster compared to Mypy.
- Provides a language server out of the box, considerably improving development experience.
- Integrates in-editor typing using its VS Code extension for the development experience.
- As it is built in TypeScript, it is faster than Mypy, but still slower than Rust-based ones.
Pyright was last reviewed on Aug 1, 2025.
Pyrefly
- Pyrefly is a static type checker developed by Meta; it is still under development.
- It is open source.
- It does not have as many typing checks as Mypy.
- Although it currently does not support caching, it is still much faster compared to Mypy.
- It provides a language server out of the box, considerably improving development experience.
- It integrates in-editor typing using its VS Code extension for the development experience.
- As it is built in Rust, it is considerably faster compared to other type checkers, up to a point where performance is no longer a concern.
Pyrefly was last reviewed on Aug 1, 2025.
Usage
We use Mypy to enforce strict static type checking on all of Fluid Attacks’ Python source code.
Last updated on