A fast type checker and language server for Python, written in Rust
open sourceMITfree
Pyrefly is Meta's open source type checker and language server for Python, written in Rust. It type checks large codebases quickly (its README cites PyTorch checked 15x faster than mypy and Pyright) and gives editors go to definition, autocomplete, hover, inlay hints and semantic highlighting, with the same results on the command line and in the editor. It understands Pydantic, Django and pytest, has experimental tensor shape checking for PyTorch, and helps teams migrate from Mypy or Pyright with pyrefly init, pyrefly suppress and pyrefly infer. It's installed with pip, and has editor extensions for VS Code (also on Open VSX), Neovim and Zed. Google uses it for its monorepo and Instagram for 20 million lines of Python, and it's Positron's default Python language server.
Problems it solves
- Python type checking takes too long on our big codebase
- get fast autocomplete and type errors for Python in my editor
- move our Python project off Mypy to a faster type checker
Features
- fast Python type checking
- language server: go to definition, autocomplete, hover, inlay hints
- Pydantic, Django and pytest support
- experimental tensor shape checking for PyTorch
- migration from Mypy or Pyright with init, suppress and infer
Alternatives
The same job
These do what Pyrefly does.
- ty An extremely fast Python type checker and language server, written in Rust
- Pyright Static type checker for Python
- mypy Optional static typing for Python
- Pylance A performant, feature-rich language server for Python in VS Code
- Sorbet A fast, powerful type checker designed for Ruby
- TypeScript JavaScript with static types, compiled to plain JavaScript