# ty 1.0 发布：24 倍速提升的 Python 类型检查器

Original title: Ty 1.0: an extremely fast Python type checker and language server

> Hacker News story 50717444 · language: zh · submitted 2026-12-01
> Web version: https://zeli.app/zh/story/50717444
> About this feed: https://zeli.app/llms.txt · Agent guide: https://zeli.app/skill.md

▲ 706 · by [burntsushi](<https://news.ycombinator.com/user?id=burntsushi>) · 💬 159
[original](<https://astral.sh/blog/ty-1.0>) · [HN discussion](<https://news.ycombinator.com/item?id=50717444>)

## Summary

Astral 正式推出 ty 1.0，这是一款用 Rust 编写的超高速 Python 类型检查器和语言服务器。作为 mypy 和 Pyright 的有力替代者，ty 已成为 OpenAI 内部默认的类型检查工具，覆盖数百万行关键代码。迁移数据显示，ty 带来了中位数 24 倍的速度提升和 73% 的内存峰值降低。新版本不仅性能卓越，还引入了基于集合论的渐进式类型系统，大幅减少了误报，并原生支持 Pydantic 等主流库。从自动修复诊断到脚本环境管理，ty 旨在通过更精细的增量架构，让 Python 成为生产力最高的版本。

## Key quote

> 我们想构建的不仅仅是一个“更快的类型检查器”，而是一个更好的类型检查器，它能够与 Python 的类型系统共同进化。

## HN discussion (159 comments)

### [cataflam](<https://news.ycombinator.com/item?id=50723332>)

> 我记得今年三月重新评估过，并从（视项目情况而定）mypy 或无类型检查切换到了 pyright。
>
> 当时，ty 的兼容性套件通过率是 53%，pyrefly 是 88%，而 pyright 是 98%（那时我还不知道 zuban）。
>
> 现在 [1] pyrefly 和 zuban 都达到了 100%，ty 是 97%，pyright 是 96%。
>
> 是时候重新评估了。
>
> [1] https://github.com/python/typing/blob/main/conformance/resul...

### [adsharma](<https://news.ycombinator.com/item?id=50721799>)

> 所有要求 Django 类型检查的人：天下没有免费的午餐。你必须改变编写 Django 的方式，使其更利于类型检查。SQLAlchemy/SQLModel 也是如此。
>
> https://github.com/adsharma/fquery/blob/main/tests/django_ex...
>
> https://github.com/adsharma/fastapi-shopping/blob/main/src/f...

### [memco](<https://news.ycombinator.com/item?id=50720281>)

> 我对 Ty 感到兴奋，因为我觉得它很好用，但这次公告很难让人欣赏，因为它写得不太好。
>
> 他们的基准测试图表没有正确标注；链接（如果下面有的话）也没有提供更全面的图景（你只能来回跳转，试图把表格和图表对应起来？）；而且年同比增长图表看起来很奇怪。这个 YoY 图表让我更想知道为什么 mypy 从 2025 年到 2026 年增长了 4 倍，而不是让我觉得 Ty 拥有健康的用户增长。更令人担忧的是，他们为什么要强调用户群的增长，而不是 Ty 实际带来的类型检查优势，尤其是 1.0 版本带来的改进。
>
> 这简直是一堆杂乱无章的信息，感觉非常欠缺。

### [fishgoesblub](<https://news.ycombinator.com/item?id=50718673>)

> 很好奇 Ty 现在在实际使用中与 Pyrefly 相比如何。当时因为 Ty 的表现远不如 Pyrefly，我不得不从 Ty 切换出去。现在在 Python 类型检查器的选择上，真是让人挑花眼了。

### [kccqzy](<https://news.ycombinator.com/item?id=50720369>)

> 我已经放弃在工作代码库中使用 Python 类型检查了。我的同事不在乎类型，过度使用元编程（太多改变类型的装饰器和元类等等），我见过每 1 万行代码就有高达 2000 个误报的情况。
>
> 但即便如此，当我从 pyright 切换到 ty 时，我对像“跳转到定义”这样的操作速度之快感到震惊。使用 pyright 时，基于语言服务器的“跳转到定义”往往比 ripgrep 搜索还要慢。

### [scosman](<https://news.ycombinator.com/item?id=50722209>)

> 我们在早期测试版期间从 Pyright 切换到了 Ty，之后从未回退。速度优势明显，我们遇到的少数几个 bug 也都得到了解决。Astral 团队干得漂亮。

### [user-error](<https://news.ycombinator.com/item?id=50725517>)

> 从 alpha 版就开始使用 ty 了。确实像宣传的那样快，但仍有部分功能缺失。好奇 1.0 版本是否填补了这些空白。
>
> Python 的类型系统已经非常成熟，配合 3.14 版本，大部分易用性问题都已解决。再加上 AI 编程，没有理由不在 Python 代码中开启严格类型检查。但 mypy 实在太慢，实际无法使用，所以我想最终会在 ty 和 pyrefly 之间二选一。

### [dang](<https://news.ycombinator.com/item?id=50720153>)

> 过去相关的讨论串。还有其他的吗？
>
> Ty – A fast Python type checker, written in Rust - https://news.ycombinator.com/item?id=46100637 - Nov 2025 (15 comments)
>
> Pyrefly vs. Ty: Comparing Python's two new Rust-based type checkers - https://news.ycombinator.com/item?id=44107655 - May 2025 (160 comments)
>
> Ty: A fast Python type checker and language server - https://news.ycombinator.com/item?id=43918484 - May 2025 (287 comments)

---

## Cite

- Page: https://zeli.app/zh/story/50717444
- Date: 2026-12-01
- Source: astral.sh (https://astral.sh/blog/ty-1.0)
- Hacker News: https://news.ycombinator.com/item?id=50717444

## Other languages

- en: https://zeli.app/story/50717444 · markdown: https://zeli.app/story/50717444.md
- ja: https://zeli.app/ja/story/50717444 · markdown: https://zeli.app/ja/story/50717444.md
- ko: https://zeli.app/ko/story/50717444 · markdown: https://zeli.app/ko/story/50717444.md
- de: https://zeli.app/de/story/50717444 · markdown: https://zeli.app/de/story/50717444.md
- es: https://zeli.app/es/story/50717444 · markdown: https://zeli.app/es/story/50717444.md
- ru: https://zeli.app/ru/story/50717444 · markdown: https://zeli.app/ru/story/50717444.md
