Developer ToolsPython

Google Drops Pytype for Meta’s Pyrefly: 98% Faster Python Builds

Python snake transforming into Rust gear symbol representing Pyrefly type checker speed improvement

Google just replaced its decade-old internal Python type checker, Pytype, with Meta’s open source Pyrefly — and the numbers are difficult to argue with. Incremental rebuilds dropped by 98%. A 9-minute type-check run on a 120,000-line codebase now finishes in 11 seconds. Compute usage for Python type checking across Google’s monorepo fell by more than 80%. For Python developers still on mypy, that’s not a benchmark to admire from a distance — it’s an argument to act on.

What Killed Pytype

Pytype had a decent run. Google built it, used it internally for over a decade, and it did the job when Python’s typing system was still finding its footing. But it had a foundational problem: it analyzed compiled bytecode instead of source code ASTs. Every time CPython changed its bytecode format — which happened aggressively from 3.11 onward — Pytype needed emergency surgery just to stay functional. Keeping pace with modern typing PEPs became, in Google’s own words, “an increasing maintenance burden.” Python 3.12 was quietly declared the last version Pytype would support. The project is being sunsetted.

This matters because Google isn’t switching because Pyrefly is fashionable. They’re switching because Pytype was structurally unable to evolve alongside Python’s type system — and they need a tool that can.

The Performance Case for Pyrefly

Pyrefly is built by Meta, written in Rust, and released as open source. It reached v1.0 in May 2026 and has been running in production at Instagram — roughly 20 million lines of Python — ever since. PyTorch adopted it for its entire core repository. JAX uses it. Google’s announcement brings enterprise-scale validation from four distinct, massive Python codebases.

  • 1.85 million lines of code checked per second
  • 76x faster than mypy in direct benchmarks
  • 15x faster than Pyright on the PyTorch codebase
  • 5x faster than mypy 2.0’s parallel 8-worker mode
  • IDE rechecks complete in under 10 milliseconds after saving a file

That last number matters. When type feedback arrives in under 10ms, it stops feeling like a build step and starts feeling like a linter — reactive, invisible, always on. Google’s blog noted that faster feedback loops benefited both human engineers and AI-agent coding workflows. As AI pair programming becomes the baseline, type checking latency is no longer a minor annoyance — it’s a throughput bottleneck.

Pyrefly vs. the Rest of the Field

mypy has been the default Python type checker for years, but its architecture predates the scale of modern Python codebases. It’s written in Python, which means it inherits Python’s GIL and runtime overhead. Pyrefly’s 87.8% conformance with the Python Typing Specification is a significant jump over mypy’s 58.3% — which means Pyrefly doesn’t just run faster, it catches more bugs correctly.

Pyright (Microsoft’s TypeScript-based checker) sits between the two on speed. It’s faster than mypy but nowhere near Pyrefly. The other Rust-based contender is Astral’s ty, which edges out Pyrefly in raw benchmark numbers but has less production validation behind it. Both tools point in the same direction: the era of Python-written Python tooling is closing. Rust won the Python tools war.

Switching Takes Three Commands

If your codebase is on mypy, the migration path is deliberately low-friction:

pip install pyrefly
pyrefly init       # converts mypy.ini to pyrefly.toml automatically
pyrefly check .    # run your first type check

pyrefly init reads your existing mypy configuration and translates it. pyrefly suppress walks your codebase and inserts # pyrefly: ignore[error-code] at each current error site, letting you commit a passing state before cleaning up incrementally. Existing # type: ignore comments are honored by default. For large teams, a baseline file option lets you lock current errors and only fail CI on regressions.

Full documentation lives at pyrefly.org/en/docs/migrating-from-mypy/. IDE support covers VSCode, Neovim, and Zed.

The Bigger Picture

Google adopting a Meta-built tool is unusual enough to be worth noting on its own. These two companies do not typically share infrastructure. That it happened here reflects how definitively Pyrefly outperformed the alternatives — including Google’s own internal solution. When Google’s Python team publicly retires their decade-old tool in favor of a competitor’s open source project, the engineering verdict is in.

If you’re still running mypy, the question isn’t whether to switch. It’s when. The Google announcement and PyTorch’s adoption post make the case better than we can.

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 *