opensourceprojects.dev

A broadsheet for software that doesn't ask for your email

Pyrefly: a Rust type checker that's 15x faster than Mypy
GitHub RepoViews0

Project Description

View on GitHub

Your Type Checker Shouldn't Make You Wait

You've probably felt it: you save a file, and your editor goes quiet while the type checker thinks. On a big codebase, that pause stretches into seconds, and suddenly the feedback loop that's supposed to help you is the thing slowing you down. Pyrefly is a bet that this doesn't have to be the tradeoff. It's a type checker and language server for Python written in Rust, and it's built around the idea that checking types should be fast enough that you forget it's happening.

What It Does

Pyrefly does two jobs in one tool. On the command line, it type checks your Python code. In your editor, it runs as a language server and provides the features you'd expect from a modern IDE setup: go-to-definition, autocomplete, hover information, inlay hints, semantic highlighting, and code navigation. The README emphasizes that results are consistent between the CLI and your editor, so you're not getting one set of answers in CI and another while you work.

It's written in Rust, which is where the speed comes from. The project reports checking over 1.85 million lines of code per second, and type checking something like PyTorch 15x faster than Mypy and Pyright. In the IDE, rechecks typically finish in under 10 milliseconds after you save a file. It also ships editor integrations for VS Code, Neovim, and Zed, among others.

Why It's Cool

The adoption list is the real proof. Plenty of tools claim to be fast. Pyrefly's README shows who's actually using it: Google adopted it as the Python type checker for its monorepo, replacing Pytype. Instagram uses it as the default type checker across 20 million lines of Python at Meta. Microsoft's Pylance can use Pyrefly for type checking through the Type Server Protocol. Positron made it the default Python language server. That's not a toy benchmark — those are codebases where a type checker either works or gets ripped out.

It handles the Python people actually write. A lot of type checkers are lovely until you point them at a Django project or a Pydantic model. Pyrefly has built-in support for Pydantic, Django, and pytest, which covers a huge share of real-world Python. The README also lists a long set of open source projects checked with it — PyTorch, JAX, NumPy, SciPy, scikit-learn, Polars, pandas-stubs, and more — which is a decent signal that it survives contact with heavy, unglamorous code.

Tensor shape checking is a genuinely interesting extra. As an experimental feature, Pyrefly can find shape mismatches in PyTorch code. If you've ever spent an afternoon debugging a tensor that was the wrong shape three functions upstream, you'll understand why that's worth paying attention to.

Migration is treated as a first-class problem. Pyrefly ships with pyrefly init to help you move over from Mypy or Pyright, and there's tooling to silence existing errors so you can adopt it incrementally instead of fixing everything at once. That's the difference between a tool you try and a tool you keep.

How to Try It

The README is truncated, so I can't give you the exact install command — but Pyrefly is published on PyPI, so the usual route applies. Check the repo's getting-started docs for the current instructions.

  1. Install the package from PyPI (see the repository for the exact command).
  2. Run pyrefly init in your project to set things up and generate a config, including options for migrating from Mypy or Pyright.
  3. Run the checker on your codebase and see how it does. If you've got a pile of existing errors, use the suppression tooling to silence them and start from a clean baseline.
  4. Install the editor extension — VS Code from the Marketplace, or the Neovim and Zed integrations — to get the language server features.
  5. If you want to go deeper, the docs cover the Pydantic, Django, pytest, and tensor shape support.

Final Thoughts

Pyrefly is aimed squarely at teams with large Python codebases, where type checking time is a real cost and editor latency is a daily annoyance. The speed numbers are the headline, but the more convincing argument is the adoption list and the built-in support for frameworks people actually use. If you're on a small project, your current checker is probably fine. If you've got hundreds of thousands of lines and a type checker that makes you wait, this is worth an afternoon of testing — especially since the migration path means you don't have to commit to a big-bang switch.


Follow @githubprojects for more developer tools and open source projects.

Back to Projects
Project ID: pyreflyLast updated: November 19, 2026 at 07:06 AM