Comparing Python Type Checkers: Typing Spec Conformance
8 hours ago
- #Python
- #Programming
- #Type Checking
- Python's type system started with PEP 484 and was initially defined by mypy.
- Multiple type checkers like Pyright, Pytype, and Pyre emerged, leading to divergent interpretations of typing rules.
- The Python typing specification was created to consolidate typing rules and includes a conformance test suite.
- The conformance test suite checks for false positives (unexpected errors) and false negatives (missed errors).
- As of early March 2026, Pyright leads with a 97.8% pass rate, while mypy lags at 58.3%.
- Conformance matters as it affects code compatibility and reduces the need for workarounds.
- Conformance does not measure type inference, type refinement, or experimental features.
- Other factors like performance, IDE integration, and error messages are also important when choosing a type checker.