Assembly Line

Instead of mypy: Pyrefly

Use Pyrefly instead of mypy. It is Meta's Rust type checker, stable since its 1.0 release in May 2026, and much faster than mypy. It reads your mypy config and ships a preset that matches mypy's behaviour during migration.

Old mypy ★ 21k See repository Python Pushed today mypy-lang.org
Instead Pyrefly ★ 7.2k MIT Rust Pushed today pyrefly.org

Both are for type checking Python code.

Why Pyrefly is better

  • Meta reports Pyrefly checking over 1.85 million lines of code per second. Independent benchmarks collected by PkgPulse show the Rust checkers 10 to 50 times faster than mypy.
  • Pyrefly reached a stable 1.0 release on 12 May 2026 and is the default type checker for Instagram, with PyTorch and JAX as adopters.
  • Pyrefly's pass rate on the Python typing specification tests rose from 70% at beta to over 90%, according to its release notes.
  • Pyrefly is also a language server with autocomplete, navigation and refactoring, so the same engine runs in CI and in the editor.

When to keep mypy

Keep mypy if you rely on mypy plugins that Pyrefly does not cover, or on a long history of mypy-specific type: ignore codes. mypy is still the reference implementation and the most widely supported in CI tooling.

Switching

Run pyrefly init. It converts your mypy.ini or [tool.mypy] section and sets preset = legacy, which disables checks mypy does not have. Read the generated config, because unrecognised settings are dropped without warning. Run both checkers on the same commit, then use pyrefly suppress to silence existing errors before removing mypy.

Watch out

Pyrefly implements the type system independently, so it reports some errors mypy did not, and checks unannotated functions by default. Framework support for Django and Pydantic is built in, but custom mypy plugins have no equivalent. Astral's ty is faster in the editor but is still beta and catches less today.

Also worth a look

  • ty Astral's type checker, fastest in the editor but still in beta; pick it if you already use uv and Ruff and can live with gaps.
  • Pyright Microsoft's checker behind VS Code's Pylance; pick it for the most complete typing spec support if speed is not a problem.

More newer, better linters, formatters and type checkers

Sources

Judged on 2026-11-06. See every linters, formatters and type checkers, or all 66 replacements.