MCPcopy Index your code
hub / github.com/facebook/pyrefly

github.com/facebook/pyrefly @1.1.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release 1.1.1 ↗ · + Follow
16,072 symbols 64,606 edges 1,281 files 4,670 documented · 29%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Pyrefly: A fast type checker and language server for Python with powerful IDE features

pyrefly PyPI VS Code Open VSX Discord License: MIT

Pyrefly is a type checker and language server for Python, which provides lightning-fast type checking along with IDE features such as code navigation, semantic highlighting, and code completion. It is available as a command-line tool and an extension for popular IDEs and editors such as VSCode, Neovim, Zed, and more.

See the Pyrefly website for full documentation and how to add Pyrefly to your editor of choice.

Pyrefly's current development status is stable.

Key Features

  • Fast. Pyrefly checks over 1.85 million lines of code per second, type checking projects like PyTorch 15x faster than Mypy and Pyright. In the IDE, rechecks typically complete in under 10 milliseconds after saving a file.
  • Production-proven at scale. Pyrefly is the default type checker for Instagram's 20-million-line Python codebase at Meta, and has been adopted by large open source projects including PyTorch and JAX.
  • Full-featured language server. Code navigation, autocomplete, hover information, inlay hints, semantic highlighting, and more, with consistent results across the CLI and your editor of choice.
  • Understands real-world Python. Built-in support for frameworks like Pydantic and Django, with model validation, field types, and autocomplete that work out of the box.
  • Adoption-ready. Migrate from Mypy or Pyright with pyrefly init, silence existing errors with pyrefly suppress, and generate type annotations with pyrefly infer. Start with one file and expand at your own pace.

Getting Started

Version Policy

Pyrefly releases new minor versions (1.x.0) monthly and patch versions in between as-needed for critical fixes. Pyrefly does not follow strict semantic versioning: minor versions contain more significant changes than patch versions, but any version may introduce new type errors and other breaking changes. The pyrefly suppress command can be used to easily silence errors when upgrading to a new version.

Getting Involved

If you have questions or would like to report a bug, please create an issue.

See our contributing guide and architecture overview for information on how to contribute to Pyrefly.

Join our Discord to chat about Pyrefly and types. This is also where we hold biweekly office hours.

Extension points exported contracts — how you extend this code

Subscriber (Interface)
Trait to capture which handles are executed by `State`. Calls to `start_work` and `finish_work` will be paired. It may b [6 …
pyrefly/lib/state/subscriber.rs
Visit (Interface)
Visitors based on . Given a from type (`Self`) you want to visit all the [54 implementers]
crates/pyrefly_util/src/visit.rs
ConfigOptionMigrater (Interface)
A trait for configuration options that can be migrated from mypy or pyright to pyrefly [11 implementers]
crates/pyrefly_config/src/migration/config_option_migrater.rs
SourceDatabase (Interface)
Represents a virtual filesystem provided by a build system. A build system should understand the relationship between ta [5 …
crates/pyrefly_build/src/source_db/mod.rs
TypeEq (Interface)
(no doc) [55 implementers]
crates/pyrefly_types/src/equality.rs
EditorModel (Interface)
* Interface for editor model
website/src/__tests__/__mocks__/monaco-editor.ts
InterpreterProvider (Interface)
(no doc) [1 implementers]
lsp/src/python-environment.ts
Keyed (Interface)
Any key that sets `EXPORTED` to `true` should not include positions Incremental updates depend on knowing when a file's [24 …
pyrefly/lib/binding/binding.rs

Core symbols most depended-on inside this repo

clone
called by 3001
pyrefly/lib/report/pysa/pysa_report_capnp.rs
unwrap
called by 2376
crates/pyrefly_types/src/stdlib.rs
get
called by 1063
pyrefly/lib/alt/answers.rs
map
called by 1016
pyrefly/lib/state/loader.rs
path
called by 843
pyrefly/lib/error/error.rs
as_ref
called by 729
pyrefly/lib/state/state.rs
join
called by 727
pyrefly/lib/lsp/non_wasm/connection.rs
range
called by 698
pyrefly/lib/alt/expr.rs

Shape

Method 7,329
Function 6,373
Class 1,842
Enum 399
Interface 84
Route 45

Languages

Rust69%
Python29%
TypeScript2%

Modules by API surface

pyrefly/lib/report/pysa/pysa_report_capnp.rs442 symbols
pyrefly/lib/binding/scope.rs225 symbols
scripts/issue_ranker/tests/test_issue_ranker.py186 symbols
pyrefly/lib/alt/answers_solver.rs178 symbols
pyrefly/lib/state/lsp.rs177 symbols
pyrefly/lib/test/lsp/code_actions.rs173 symbols
scripts/primer_classifier/test_classifier.py165 symbols
pyrefly/lib/lsp/non_wasm/server.rs165 symbols
crates/pyrefly_types/src/types.rs160 symbols
pyrefly/lib/solver/solver.rs154 symbols
pyrefly/lib/binding/bindings.rs151 symbols
pyrefly/lib/alt/class/class_field.rs148 symbols

Datastores touched

mydbDatabase · 1 repos

For agents

$ claude mcp add pyrefly \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact