Pyrefly is an advanced type checker and language server designed specifically for Python, offering exceptionally fast type checking and a comprehensive suite of integrated development environment (IDE) features. Developed and maintained by Facebook, Pyrefly aims to enhance the productivity and reliability of Python developers by providing robust static analysis, code navigation, semantic highlighting, and intelligent code completion. Its design focuses on both speed and accuracy, making it suitable for large-scale codebases and real-world Python projects.
One of Pyrefly’s standout features is its remarkable performance. It is capable of checking over 1.85 million lines of code per second, making it significantly faster than other popular type checkers such as Mypy and Pyright. For example, Pyrefly can type check large projects like PyTorch up to 15 times faster than these alternatives. In practical development workflows, this means that after saving a file, type rechecks in the IDE typically complete in under 10 milliseconds, ensuring a seamless and responsive experience for developers.
Pyrefly is not only fast but also proven at scale. It serves as the default type checker for Instagram’s massive 20-million-line Python codebase at Meta and has been adopted by other major open source projects, including PyTorch and JAX. This production-level reliability demonstrates Pyrefly’s capability to handle complex and extensive codebases while maintaining high accuracy and performance.
As a full-featured language server, Pyrefly provides a range of IDE functionalities. These include code navigation, autocomplete, hover information, inlay hints, and semantic highlighting. These features are available consistently across both the command-line interface and various editors, ensuring that developers have access to the same powerful tools regardless of their preferred workflow. Pyrefly supports integration with popular editors such as Visual Studio Code, Neovim, and Zed, and can be easily installed via pip or through dedicated IDE extensions.
A key strength of Pyrefly is its deep understanding of real-world Python code. It offers built-in support for widely used frameworks like Pydantic and Django, enabling features such as model validation, field type inference, and context-aware autocomplete out of the box. This makes Pyrefly especially valuable for developers working with modern Python web and data frameworks, as it can provide accurate type checking and assistance tailored to these environments.
Pyrefly is designed to be adoption-ready, with tools that facilitate migration from other type checkers like Mypy or Pyright. The `pyrefly init` command helps initialize projects, while `pyrefly suppress` can silence existing type errors, and `pyrefly infer` can generate type annotations automatically. This incremental adoption approach allows teams to start using Pyrefly on a single file and gradually expand its coverage as needed.
The project follows a regular release cadence, with new minor versions released monthly and patch versions for critical fixes. While not adhering strictly to semantic versioning, Pyrefly provides mechanisms to manage breaking changes and new type errors, such as the error suppression command.
Pyrefly is open source and welcomes community involvement. Developers can report issues, contribute code, and participate in discussions via GitHub and Discord. Comprehensive documentation, a sandbox for trying out features, and detailed guides are available on the official Pyrefly website, making it accessible for both individual developers and large teams seeking to improve their Python code quality and development experience.