whatisgithub

What is pyrefly?

facebook/pyrefly — explained in plain English

Analysis updated 2026-06-26

5,730RustAudience · developerComplexity · 2/5Setup · easy

In one sentence

Pyrefly is Meta's open-source Python type checker that finds bugs in your code before it runs, checking over 1.85 million lines per second, 15 times faster than Mypy or Pyright, with editor support and automatic type inference.

Mindmap

mindmap
  root((repo))
    What it does
      Finds type errors
      Powers editor autocomplete
      Infers missing annotations
      Suppresses existing errors
    Performance
      1.85M lines per second
      Sub-10ms editor feedback
      15x faster than Mypy
    Editor support
      VS Code extension
      Neovim extension
      Zed extension
    Framework support
      Pydantic
      Django
      PyTorch
      JAX
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Catch type errors in a large Python codebase before running tests or deploying

USE CASE 2

Get instant autocomplete and hover documentation in VS Code or Neovim powered by a fast language server

USE CASE 3

Migrate a Python project from Mypy to a faster type checker without fixing every existing error at once using the suppression helper

USE CASE 4

Automatically add type annotations to untyped Python code using the built-in inference command

What is it built with?

RustPython

How does it compare?

facebook/pyreflydudykr/stcflosse/rust-web-framework-comparison
Stars5,7305,7255,724
LanguageRustRustRust
Setup difficultyeasyhardeasy
Complexity2/54/52/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 5min
Open-source from Meta, free to use, modify, and distribute.

So what is it?

Pyrefly is a tool from Meta that checks Python code for type errors before the code runs. In Python, variables and functions can optionally carry type annotations that describe what kind of data they hold or return. A type checker reads those annotations and warns you when the code does something that conflicts with them, catching whole categories of bugs without executing a single line. The main selling point is speed. Pyrefly checks over 1.85 million lines of Python code per second, which the README says is 15 times faster than the two most established alternatives, Mypy and Pyright. At Meta, it is the default type checker for Instagram's Python codebase, which runs to about 20 million lines. Large open source projects including PyTorch and JAX have also adopted it. Beyond checking for errors at the command line, Pyrefly works as a language server, which means it can power editor features like autocomplete, jump-to-definition, hover documentation, and code highlighting. Extensions are available for VS Code, Neovim, and Zed. The check that runs after you save a file typically completes in under 10 milliseconds, so the feedback appears almost immediately while you work. For teams migrating from an existing type checker, Pyrefly provides a few helper commands. One initializes a configuration file and sets up a project. Another adds suppression comments to any errors that already exist in the codebase, so you can start enforcing types on new code without having to fix every old error at once. A third command can infer and insert type annotations automatically for code that does not have them yet. The tool also has built-in understanding of popular Python frameworks like Pydantic and Django, including their specific patterns for defining data models and fields.

Copy-paste prompts

Prompt 1
I have a Python project using Pydantic models. Run Pyrefly on it and explain each type error it finds, then show me how to fix them one by one.
Prompt 2
Help me configure Pyrefly for a Django project, set up the VS Code extension, and write a pre-commit hook that fails if any new type errors are introduced.
Prompt 3
I'm migrating from Mypy to Pyrefly. Walk me through running the suppression command on my existing codebase so I can enforce types on new code without breaking the build on old errors.
Prompt 4
Use Pyrefly's annotation inference command on this Python module and review the types it suggests, accept the correct ones and explain any it got wrong.

Frequently asked questions

What is pyrefly?

Pyrefly is Meta's open-source Python type checker that finds bugs in your code before it runs, checking over 1.85 million lines per second, 15 times faster than Mypy or Pyright, with editor support and automatic type inference.

What language is pyrefly written in?

Mainly Rust. The stack also includes Rust, Python.

What license does pyrefly use?

Open-source from Meta, free to use, modify, and distribute.

How hard is pyrefly to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is pyrefly for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.