
Pyrefly
github.com/facebook/pyrefly- Category
- Developer Tools
- Rank
- No. 179Tools index
- Type
- APP
- Builder
- GitHub
- 7.0k stars
- Latest release
- 1.3.1
- Date
About
A fast type checker and language server for Python, from Meta.
What it does
Pyrefly analyzes Python code for type errors, then uses the same results in terminals and editors. Its editor features include completion, navigation, hover details, inlay hints, and semantic highlighting. Built-in handling covers Pydantic, Django, and pytest, while migration tools support gradual adoption.
Why it's ranked here
The case rests on unusually concrete operational evidence. The project reports checking over 1.85 million lines per second, rechecking saved files in under 10 milliseconds, and serving as Instagram’s default checker across 20 million lines. PyTorch and JAX adoption further supports its large-project credibility.
What's good
Command-line and editor diagnostics stay consistent, reducing disagreements between local work and automated checks. Migration support can initialize configuration, suppress existing failures, and infer annotations. Teams may begin with one file. Framework-aware analysis adds model validation, field typing, fixture navigation, and completion without extra setup.
Tradeoffs
Version upgrades need deliberate handling. The project does not follow strict semantic versioning, and any release may introduce new errors or other breaking changes. Suppression tooling softens that cost, but it can also turn upgrade work into deferred cleanup. Specialized framework support does not guarantee identical behavior for every Python project.
How to use it well
Use Pyrefly for typed Python projects where fast feedback must work both in automation and during editing. It particularly suits large repositories, gradual migrations from Mypy or Pyright, and code using Pydantic, Django, or pytest. Keep separate formatting, linting, and runtime testing tools because Pyrefly focuses on type analysis and editor intelligence.
Technical notes+
Cargo.toml defines a 13-member Rust workspace, including the main pyrefly crate, shared type and configuration crates, LSP tests, bundled resources, and pyrefly_wasm. pyrefly_wasm/lib.rs exposes Playground through wasm_bindgen as State, with bindings for file updates, diagnostics, hover, semantic tokens, definitions, completion, and inlay hints. lsp/build-pyrefly.js builds the Rust binary and copies it into the extension bundle, while lsp/esbuild.js bundles the TypeScript extension and tests. test.py orchestrates Cargo or Buck builds, formatting, linting, unit tests, conformance checks, tensor-shape checks, and schema validation. schemas/validate_schemas.py validates both standalone and pyproject TOML configurations against Draft-07 JSON schemas, including extensive negative cases.
Observed
- License
- MIT
- Primary implementation
- Rust workspace with 13 members, plus Python and JavaScript tooling
- Installation
- Command-line package available through pip install pyrefly
- Interfaces
- Command-line tool, language server, editor extensions, browser sandbox, and WebAssembly bindings
- Editor support
- Documented support includes VS Code, Neovim, and Zed
- Testing structure
- Repository test orchestration covers Cargo and Buck builds, formatting, linting, unit tests, conformance, tensor shapes, and JSON schemas
Read from README.md, Cargo.toml, test.py, lsp/esbuild.js, pyrefly_wasm/lib.rs, scripts/projects.py, lsp/.vscode-test.mjs, lsp/build-pyrefly.js, scripts/github_utils.py, scripts/llm_transport.py, scripts/sandbox_links.py, scripts/primer_history.py, schemas/validate_schemas.py, scripts/merge_primer_shards.py.
Tech Stack
Comments (0)
No comments yet
Editorially curated, with community endorsements as a secondary signal. Corrections welcome.