We are thrilled to announce the launch of an alpha version of Pyrefly, an open-source Python type checker and IDE extension built with Rust. Pyrefly serves as a static type checker that scans Python code to verify type adherence, helping to identify errors before execution. It provides support for IDE integration and command-line use, allowing flexibility in your development process.
Get Started
Eager to get started? Visit the official Pyrefly website for detailed information. Here’s a quick overview to start using it:
The Motivation Behind Pyrefly
In 2017, we aimed to develop a type checker that could effectively manage Instagram’s extensive typed Python codebase. This effort led to the creation of the Pyre type checker, inspired by the designs of Hack and Flow, and crafted in OCaml for scalable efficiency.
Pyrefly’s Core Principles
We are excited to present Pyrefly, a project developed collaboratively on GitHub. We invite you to explore our project and test it with your own code. While Pyrefly is the result of numerous technical decisions, key principles we adhered to include:
Performance
We aim to transition checks that previously occurred during CI to being performed with each keystroke. This requires fast code verification (we can check 1.8 million lines per second on large codebases) and careful considerations for updates. Built in Rust, Pyrefly is designed for optimal performance across various codebases.
IDE-Centric Design
We strive for a uniform experience between the IDE and command line, necessitating well-crafted abstractions to manage differences without incurring added latency. Establishing these abstractions from the beginning was more feasible than adapting them retroactively, as experienced with Pyre.
The Vision Ahead for Pyrefly
We plan to collaborate with the Python community to advance the language and enhance the developer experience. Since launching Pyre, we have freely shared our code and contributed several PEPs alongside the type checker maintenance community. We believe Pyrefly can further assist Python developers in leveraging type benefits for developers, library authors, and those new to coding.
As we roll out Pyrefly in alpha, we’re also addressing various bugs and features with the aim of removing the alpha tag this summer. Your insights are vital for this process, so we encourage you to try Pyrefly and report any issues or suggestions for improvement. Even if Pyrefly isn’t suitable for your project, we would love to hear how you use types and what enhancements you seek.
Join us in this journey as we work to illuminate software bugs with Pyrefly. Happy coding! 🐍✨