mypy vs Pyright: Which Python Type Checker for CI?
mypy is the reference Python type checker; Pyright is a fast, strict checker that also powers Pylance in VS Code.
mypy is the original, widely-used static type checker for Python, maintained alongside the typing standards. Pyright (from Microsoft) is a fast TypeScript-implemented checker known for strong inference, speed, and tight VS Code integration via Pylance.
| mypy | Pyright | |
|---|---|---|
| Speed | Moderate | Fast (incremental, watch mode) |
| Inference | Good | Strong |
| Editor integration | Via plugins/LSP | Native (Pylance/VS Code) |
| Strictness controls | Granular flags | Granular, strict mode |
| Reference status | Typing reference impl | Independent, widely used |
In CI
Both run as a CI gate that fails on type errors. Pyright is generally faster and has strong inference, which can catch issues mypy misses and gives quick feedback; running the same checker in the editor (Pylance) and CI keeps results consistent. mypy is the reference implementation and the closest match to the official typing semantics, with a large body of existing configs and stubs. Some projects run both to maximize coverage.
Choosing for pipelines
Want speed and editor parity with VS Code/Pylance: Pyright. Want the reference checker and closest alignment to typing standards: mypy. Pin the version and the strictness flags in CI so results are reproducible.
The verdict
Want fast checks and editor parity: Pyright. Want the reference checker aligned to typing standards: mypy. Both make solid CI gates - pin versions and strictness, and consider running both for max coverage.