pyrefly
SHA-256极速 Python 类型检查器和语言服务器,经 Meta 2000 万行代码验证,速度是 Mypy/Pyright 的 15 倍,IDE 响应低于 10 毫秒,即装即用。
比 Mypy 快 15 倍的类型检查器,Instagram 在用,还能自动补全和导航代码。
核心功能
- 超高速检查:每秒处理 185 万行代码,是 Mypy 和 Pyright 的 15 倍
- 完整 IDE 支持:代码导航、自动补全、悬停信息、内联提示、语义高亮
- 原生框架支持:Pydantic 和 Django 开箱即用,模型验证与字段类型自动识别
- 无缝迁移:从 Mypy/Pyright 一键初始化,自动压制旧错误,逐步启用新检查
- 生产验证:Meta Instagram 2000 万行代码默认使用,PyTorch/JAX 等开源项目采用
避坑指南
- •Pyrefly 不遵循严格语义版本号,升级小版本可能引入新的类型错误,可使用 `pyrefly suppress` 命令一键静默升级后新增的错误。另外,部分非常规 Python 语法(如动态属性注入)可能无法完全覆盖。
适用场景
- 大型 Python 项目的类型检查和 IDE 增强,尤其是已有 Mypy/Pyright 配置的团队想提升速度
- 使用 Pydantic 或 Django 的项目,希望获得零配置的模型验证和字段类型支持
详细介绍
Pyrefly 是一款极速的 Python 类型检查器和语言服务器,经 Meta 内部 2000 万行 Instagram 代码库验证,每秒可检查超过 185 万行代码,速度是 Mypy 和 Pyright 的 15 倍。IDE 中保存文件后重新检查通常只需不到 10 毫秒。它提供完整的语言服务器功能(代码导航、自动补全、悬停信息、内联提示、语义高亮等),并原生支持 Pydantic 和 Django(模型验证、字段类型、自动补全开箱即用)。从 Mypy 或 Pyright 迁移只需 `pyrefly init` 初始化配置,`pyrefly suppress` 静默现有错误,`pyrefly infer` 自动生成类型注解。可通过 `pip install pyrefly` 安装命令行工具,也可安装 VS Code、Neovim、Zed 等编辑器扩展。
标签
快速上手
安装软件
根据你的发行版安装对应的包(dpkg / rpm / AppImage)
终端运行 pip install pyrefly 安装命令行工具
在项目目录执行 pyrefly init 生成配置文件(或直接运行 pyrefly 使用默认设置)
安装编辑器扩展:VS Code 搜索 Pyrefly 安装,或按官网配置 Neovim/Zed
- 终端运行 pip install pyrefly 安装命令行工具
- 在项目目录执行 pyrefly init 生成配置文件(或直接运行 pyrefly 使用默认设置)
- 安装编辑器扩展:VS Code 搜索 Pyrefly 安装,或按官网配置 Neovim/Zed
最新更新
**Status: STABLE**
*Release date: 12 May 2026*
## Pyrefly v1.0.0 is here\!
We're thrilled to announce that Pyrefly has reached its stable 1.0.0 release\! Since our [beta release](https://github.com/facebook/pyrefly/releases/tag/0.42.0) in November 2025, we've fixed hundreds of bugs, improved performance, and added lots of new functionality. Pyrefly is already the default type checker for Instagram at Meta and has been adopted by other large production codebases like PyTorch and JAX. Today, we're making it official: Pyrefly is production ready.
This would not have been possible without our amazing open-source community. To everyone who filed GitHub issues, submitted pull requests, gave us feedback at conferences, or joined us on Discord: thank you. Your contributions shaped this release.
These release notes cover the major highlights since our beta release. For the full history, see our [past weekly release notes](https://github.com/facebook/pyrefly/releases).
---
## Performance Improvements
We've continued to push Pyrefly's performance since the [speed improvements we shared in February](https://pyrefly.org/blog/2026/02/06/performance-improvements/). Since beta:
- **2–125x faster updated diagnostics** after saving a file (no, that’s not a typo\!). Thanks to fine-grained dependency tracking and streaming diagnostics, updates now consistently arrive in milliseconds
- **20–36% faster full type checking** on large projects like PyTorch and Pandas
- **2–3x faster initial indexing** when Pyrefly first scans your project
- **40–60% less memory usage** during both indexing and incremental type checking
(Tested on an M4 Macbook Pro using open-source benchmarks from [type\_coverage\_py](https://github.com/lolpack/type_coverage_py) and [ty\_benchmark](https://github.com/astral-sh/ruff/tree/e990dfd069fceef96f797b46161ef78862608449/scripts/ty_benchmark).)
Compare the performance of Pyrefly and other Python type checkers on our regularly updated [benchmarking suite](https://python-type-checking.com/typecheck_benchmark/), which runs against 53 popular Python packages.
---
## Configuration Presets
A new `preset` configuration option provides named bundles of error severities and behavior settings.
| Preset | Description |
| :---- | :---- |
| `off` | Silences all diagnostics. Useful for IDE-only users or if you want total control of which errors are enabled. |
| `basic` | Low-noise, high-confidence diagnostics only (syntax errors, missing imports, unknown names, etc.). Ideal for unconfigured projects or IDE-first users. |
| `legacy` | For codebases migrating from mypy. Disables checks mypy doesn't have. `pyrefly init` now emits this preset automatically when migrating from a mypy config. |
| `default` | The standard Pyrefly experience. Equivalent to having no preset. |
| `strict` | Enables additional strict checks on top of the `default` preset. For users who want to avoid `Any` types in their codebase. |
See the [configuration docs](https://pyrefly.org/en/docs/configuration/#preset) for details.
---
## Onboarding Experience
We’ve made improvements to the out-of-the-box experience for projects without a `pyrefly.toml`.
- **Automatic config synthesis** — if you have a mypy or pyright config, Pyrefly automatically migrates your settings and synthesizes an appropriate in-memory Pyrefly config. (This is the same migration that `pyrefly init` would commit to disk.)
- **Basic preset for unconfigured projects** — projects with no type checker config get the lightweight “basic” preset, which surfaces only high-confidence errors.
- **VS Code status bar** — the status bar shows the active preset — e.g. Pyrefly (Basic) or Pyrefly (Legacy) — so you always know which mode is active.
- **Type error display settings** — new VS Code settings let you control which preset applies to unconfigured files and suppress all diagnostics workspace-wide.
---
## Type Checker Improvements
We've been hard at work making the type checker robust and feature-complete, with a focus on driving down false positives and improving type quality in real-world code bases. Here are some highlights:
- Across the board we've eliminated many sources of false positives in enums, dataclasses, ParamSpec, descriptors, and more.
- Support has been added for more type narrowing patterns, including preserving narrows in nested scopes and recognizing container membership checks.
- Overload resolution was substantially reworked to handle more real-world patterns.
- Pyrefly’s conformance to the [Python typing specification](https://typing.readthedocs.io/en/latest/spec/) has improved from 70% at beta to over 90% today.
- We've added experimental support for tracking tensor dimensions through PyTorch models — see "What's Next" below.
---
## LSP & IDE Improvements
- We've added new refactoring capabilities like Safe Delete (with reference checking) and bulk `source.fixAll`.
- Navigation is more precise, and hover cards surface richer information for imports, tuples, and NamedTuples.
- Workspace mode is more stable, with multiple crash fixes and improved diagnostic publishing.
---
## Framework & Notebook Support
- **Django** — Pyrefly has improved support for model relationships, fields, and views, and understands [factory\_boy](https://factoryboy.readthedocs.io/) factories.
- **Pydantic** — Pyrefly models Pydantic's runtime behavior more faithfully, with support for lax mode and range constraint validation, and handles more of the Pydantic ecosystem: `RootModel`, `pydantic-settings`, and `pydantic.dataclasses`.
- **Pytest integration** — We've added Code Lens run buttons for test functions, as well as code actions to annotate fixture return types and parameters.
- **Jupyter notebooks** — `.ipynb` IDE support has reached full parity with `.py` files, with rename, find references, code actions, and document symbols all supported.
---
## Complementary Tooling
Pyrefly ships with tools to aid with adopting type checking in an existing codebase. Two new tools since beta:
- [**`pyrefly coverage report`**](https://pyrefly.org/en/docs/report/) outputs a JSON report with annotation completeness and type completeness metrics per function, class, and module, so you can track coverage over time.
- [**Baseline files**](https://pyrefly.org/en/docs/error-suppressions/#baseline-files-experimental) let you snapshot current errors into a JSON file so only *new* errors are reported, as an alternative to inline suppression comments.
---
## Updated Version Policy
Going forward, we’ll switch from a weekly to monthly cadence for minor (`1.x.0`) releases, with patch releases in between as-needed for critical fixes. We’ll continue providing [release notes](https://github.com/facebook/pyrefly/releases) for minor versions, so you can see what’s new in each release.
---
## What's Next
- **Tensor shape checking** — Experimental support for tracking tensor dimensions through PyTorch models and catching shape mismatches statically. [Learn more](https://pyrefly.org/en/docs/tensor-shapes/).
- **Pyrefly \+ AI agents** — Pyrefly's speed makes it a natural verification step in agentic workflows. See our guide on [adding Pyrefly to your agentic loop](https://pyrefly.org/blog/pyrefly-agentic-loop/).
- **Continued improvements** — We'll keep expanding library support, reducing false positives, and iterating on your feedback. Let us know what you need on [GitHub](https://github.com/facebook/pyrefly/issues) or [Discord](https://discord.gg/Cf7mFQtW7W).
---
## Thank you to all our contributors\!
The following people have directly contributed at least once to the development of Pyrefly since our first Alpha release.
@aahanaggarwal, @aaron-ang, @abdallhfattah, @Abel981, @abesto, @abhi-jha, @ABohra3, @Adamkaram, @Adist319, @adsi7698, @AHA705, @ahornby, @airvzxf, @ajaymiranda, @akmalsoliev, Alan Du, @Alex-Aron, Alok Priyadarshi, Alvaro Leiva Geisse, @AmalenduManoj, Anass Al-Wohoush, Anqi Wu, @ArchieBinnie, @arnav-jain1, @arosenber, @arthaud, @Arths17, @AryanBagade, @asm89, @asukaminato0721, @austin3dickey, @avikchaudhuri, Ben Carr, @bharath-2022, @bigfootjon, @bluetech, @bowiechen, @brchien, Brian Rosenfeld, @bv-saketha-rama, @capickett, Carlos Fernandez, @cbarrete, @cclauss, @charliecloudberry, @cjlongoria, Claudionor Santos, @connernilsen, @CookieComputing, @cooperlees, @cybardev, @DanielNoord, @danielocfb-test, @darricklaidin, David Tolnay, @davidbarsky, @ddrcoder, @dhleong, Dhruv Mongia, @diliop, @disrupted, @dluo, @Dogacel, @ducdetronquito, @ericweb2, @fangyi-zhou, @fannheyward, @fatelei, @github-main-user, @grantlouisherman, @grievejia, @gvozdvmozgu, @hanzel-sc, @hashiranhar, @hugovk, @iamPulakesh, @IDrokin117, @immanuel-peter, @Imran-S-heikh, @InSyncWithFoo, @ipr-ams, Ivan Loskutov, @j-piasecki, @jack-mcivor, @jackulau, @jagill, Jaimin Brahmbhatt, @JakobDegen, @javabster, @jchanke, Jess Wass, @jorenham, Jun Hao, @jvansch1, @K1T3K1, @KaranPradhan266, @Karman-singh15, Keito Uchiyama, @kinto0, @kitagry, @knQzx, @krathul, @krikera, @Krishnachaitanyakc, @kshitijgetsac, @kv9898, Li Shen, lianne, @lolpack, @Louisvranderick, @maggiemoss, @maifeeulasad, @maldoinc, @MarcoGorelli, @markmarkmarkthebest, @martindemello, @melvinhe, Miae Kim, @michaelcortese, @michel-slm, Mick Killianey, @migeed-z, Miles Conn, @mohesham88, Morgan Bartholomew, @MountainGod2, @mrsobakin, @mstykow, @mvanhorn, @NathanTempest, @ndmitchell, @nhawkes, @nikita-ashihmin, @nitinsingh-meta, @NSPC911, @ogios, @oopscompiled, @oriori1703, Owen Valentine, @oyarsa, @pavelzw, @pawelstrzmeta, @pawlowskialex, @PhilHem, @prasannavenkateshgit, @praskr-wisdom, @Prathamesh-tech-eng, @pswitchy, @pt2302, @QEDady, @QuantumManiac, @quark-zju, @Raf-Hs, @Rayahhhmed, @rchen152, @rchiodo, @regexyl, @rexledesma, @ricardoleal20, Robert Rusch, @robertoaloi, Ron Mordechai, @rubmary, @runlevel5, @salmanmkc, @salvatorebenedetto, @SamChou19815, @samwgoldman, @sandeshbhusal, @sargun, @Sehat1137, @self-sasi, @serephus, @sgavriil01, @shayne-fletcher, @shining44, @ship-it-ship-it, @shuv-amp, @sifex, @simonhollis, @singiamtel, @ska-kialo, @slawlor, @Solumin, @stanleyshen2003, @stroxler, Takuma Iwaki, @Tamchuk, @tannguyencse19, @tejasreddyvepala, @terror, @TheRustyPickle, @thomaspolasek, Tianhan Lu, @tkaleas, @tsembp, @ukautz, @Viicos, @vinnymeller, Vladimir Matveev, Weixi Ma, @Wilfred, Will Li, @willylau, @xaskii, @xl4624, @yamgent, @yangdanny97, @yeetypete, @yslim-030622, @zachmullen, @zanieb, @zbowling, @Zeko369, @zertosh, @zhuolix, @zpao, @zriser, @zsol
已提供 SHA-256 校验码,下载后可自行核对文件完整性
该校验码提取自 GitHub 官方 Release 页面
SHA256 校验码
8b35318ba7377a621ff9d9ef77a443b6ad3cf065be566c84f5ae9c8318df5459该校验码提取自 GitHub Release 页面,下载后请自行核对文件完整性
本平台所有 SHA-256 校验码均提取自项目在 GitHub 官方 Release 页面发布的文件,未做任何修改。你可以通过 GitHub Releases 页面自行验证。
开源透明
查看 GitHub 源码卸载说明
终端执行 pip uninstall pyrefly 卸载命令行工具;在 VS Code 扩展面板中禁用或卸载 Pyrefly 扩展。
无额外依赖
下载后即可直接使用,无需安装其他运行环境