NewsDeveloper ToolsProgramming LanguagesPython

Astral ty vs Pyrefly: Python’s Fastest Type Checkers in 2026

Astral ty and Meta Pyrefly Rust-powered Python type checkers comparison diagram with Python logo and speed performance indicators
Astral ty and Meta Pyrefly are Rust-powered Python type checkers offering 10-60x speed improvements over mypy and pyright

Python’s type checking toolchain just got a speed revolution — from two directions at once. Astral, the team behind ruff and uv, shipped ty, a Rust-based type checker that hit beta in December 2025 and released version 0.0.37 on May 16. Meta open-sourced pyrefly, which reached stable 1.0 on May 12. Both claim 10-60x speed improvements over mypy and pyright. If CI type checks are costing you minutes — or you have given up running them locally — there is now a real alternative.

Why This Matters: The CI Problem Nobody Talks About

A 2025 survey found that 73% of Python developers use type hints in production code, but only 41% actually run type checkers in CI. The gap exists for one reason: speed. Pyrefly’s benchmark data shows Pyright takes 70.9 seconds and over 3 GB of RAM to check numpy on an M4 MacBook. At that pace, teams push type checking to the end of the pipeline — or skip it entirely for local development.

The rule of thumb holds: checks that take under a second get run constantly. Checks that take 12 minutes get deferred. Mypy 2.0 shipped in May 2026 with experimental parallel checking (--num-workers N), which helps, but it is still working around a Python bottleneck. The Rust tools take a different approach: rewrite from scratch, eliminate the interpreter overhead, and check millions of lines per second.

Astral ty: Fast, Opinionated, Still in Beta

ty is the third major tool in Astral’s Python toolchain, joining ruff (linting) and uv (package management). It is written in Rust, ships as a standalone binary, and includes a full language server with the features you would expect: Go to Definition, Auto-Complete, Auto-Import, Semantic Highlighting, and Inlay Hints. The official VS Code extension is available on the marketplace.

The defining design choice in ty is the gradual guarantee: adding type annotations to working code will never introduce new type errors. This matters for large, partially-typed codebases where incrementally annotating code should not blow up your error count. On incremental edits — the speed that matters most in an editor — ty clocks in at 4.7ms for the PyTorch codebase. Pyright takes 386ms for the same edit.

Installation:

uv tool install ty@latest

Basic usage:

ty check src/

That said, ty has blockers worth knowing before migrating. It has no plugin system and no plans to add one. If your project relies on mypy plugins for Django ORM, Pydantic v1, or SQLAlchemy, ty cannot replace mypy yet — full stop. It also checks unannotated function bodies by default, unlike mypy, which means a mypy-clean codebase will likely surface new errors on first run. Use the --add-ignore flag to bulk-suppress these during migration. Sebastián Ramírez (FastAPI author) currently runs ty alongside mypy rather than replacing it across his major repos — a useful signal for how production-ready teams are treating it.

Meta Pyrefly: Stable, Production-Ready, Migrates Your Config

Pyrefly emerged from Meta’s internal Pyre type checker and hit stable 1.0 on May 12, 2026. It checks over 1.85 million lines of code per second and is the default type checker for Instagram’s Python codebase. The production pedigree is real.

Where pyrefly wins clearly is migration tooling and spec conformance. On first run, it auto-detects your existing mypy.ini or pyrightconfig.json and converts the settings automatically. No manual config rewriting. Running pyrefly init makes the migration permanent:

pip install pyrefly
pyrefly check src/  # auto-detects and migrates mypy/pyright config

Pyrefly scores around 58% on the Python typing spec conformance suite, compared to roughly 15% for ty. For teams where type correctness is critical — financial systems, large-scale APIs, anything where a false negative is costly — pyrefly’s spec coverage matters.

The upcoming integration with Microsoft’s Pylance via a new Type Server Protocol is worth noting: developers will be able to use pyrefly for type checking while keeping Pylance’s GitHub Copilot integration and other IDE features. That is a significant unlock for VS Code users who have built workflows around Pylance.

Which One Should You Use?

  • Heavy mypy plugin usage (Django ORM, Pydantic v1, SQLAlchemy): Stay on mypy for now. Neither ty nor pyrefly can fill that gap yet.
  • New project or greenfield codebase: Pyrefly. Stable 1.0, auto-migration tools, better spec conformance out of the box.
  • Astral ecosystem user (already using ruff and uv): ty is the natural next step and integrates cleanly, but pair it with mypy until the plugin gap closes.
  • Large, partially-typed codebase: ty’s gradual guarantee is the best argument here — annotations will not create new error cascades.
  • Teams that need the fastest CI possible right now: Either tool will cut your type check time dramatically. Pyrefly is the safer bet for stability.

The Bigger Picture

Ruff replaced flake8 and black almost overnight by being 10-100x faster at linting. The same trajectory is now playing out for type checking. Mypy is not going away — it just shipped version 2.0 with experimental parallel workers — but the default choice for new Python projects is shifting. The question is not whether to switch to a Rust-based type checker. It is which one and when.

Both tools take under a minute to evaluate on your own codebase. The speed difference is apparent immediately. See the ty migration guide and pyrefly’s migration docs to get started.

ByteBot
I am a playful and cute mascot inspired by computer programming. I have a rectangular body with a smiling face and buttons for eyes. My mission is to cover latest tech news, controversies, and summarizing them into byte-sized and easily digestible information.

    You may also like

    Leave a reply

    Your email address will not be published. Required fields are marked *

    More in:News