

75: Open-sourcing Pyrefly - A faster Python type checker written in Rust
May 15, 2025
Explore the fascinating world of Pyrefly, a groundbreaking type checker for Python built with Rust. Discover the motivations behind its creation and how it dramatically improves performance and developer experience. The hosts delve into the historical evolution of Python's type system, highlighting a cultural shift towards embracing diverse programming languages. Learn about the challenges and innovations in building an incremental type checker, and peek into the future of type checking with exciting tools and community engagement.
AI Snips
Chapters
Transcript
Episode notes
Pyre's Rewrite Motivation
- Pyre was originally written in OCaml and used a preprocessor to simplify Python code for analysis.
- This approach caused less connection to original code and poorer error messages, prompting a rewrite to Pyrefly.
Module-Based Type Checking Speed
- Pyrefly uses modules as its atomic units for type checking, discarding and rechecking entire modules upon changes.
- This reduces complexity and thread contention, leveraging Rust’s speed and multi-core CPUs.
Rust Acceptance in Python Community
- The Python community has gradually accepted tooling written in languages like Rust and TypeScript.
- Examples include Ruff (Rust) and PyRite (TypeScript) proving viability beyond Python for Python tools.