Pyrefly is a fast type checker and language server for Python, developed by Meta and written in Rust. It provides lightning-fast static type checking along with powerful IDE features such as code navigation, semantic highlighting, and code completion. Pyrefly aims to catch type-related errors before runtime, improve code quality, and enhance the developer experience. It is available as a command-line tool and an IDE extension, with new releases typically every Monday and more frequent updates for new features and bug fixes.
pip install pyreflyNo compatibility data collected yet for this library.
This quickstart demonstrates how to install Pyrefly, initialize a project, and run a basic type check on a Python file containing a simple type error. Pyrefly operates as a command-line tool, not typically imported within Python code.
Migrate your `.pre-commit-config.yaml` to use the consolidated `pyrefly-check` hook. Refer to the `pyrefly-pre-commit` GitHub repository for specific migration steps.
Use `pyrefly check --suppress-errors` to temporarily silence existing errors, followed by `pyrefly check --remove-unused-ignores` after running your code formatter. Repeat until a clean state is achieved.
This is not an actual error, but an informational message. Proceed to add your Python or Jupyter Notebook files to the project.
Be aware of potential instabilities if relying on Pyrefly's build system integration. Monitor official documentation and GitHub issues for updates and workarounds.
Install pyrefly using `cargo install pyrefly` and ensure that `$HOME/.cargo/bin` is added to your shell's PATH (e.g., by adding `export PATH="$HOME/.cargo/bin:$PATH"` to your `.bashrc`, `.zshrc`, or `.profile` file).
Install pyrefly using the Rust package manager: `cargo install pyrefly`.
Navigate to your project's root directory and run `pyrefly init` to generate a default configuration file.
Ensure pyrefly is correctly installed via `cargo install pyrefly` and that the `$HOME/.cargo/bin` directory (where `pyrefly` resides) is included in your system's PATH. Then, restart VS Code or your IDE.