Skip to content

Commit b6df99b

Browse files
committed
update title
1 parent 159a04e commit b6df99b

1 file changed

Lines changed: 20 additions & 20 deletions

File tree

content/future-python-type-checkers.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
+++
2-
title = "Ty versus Pyrefly versus Zuban: Reviewing the future of Python type checkers (Draft)"
2+
title = "How Well Do New Python Type Checkers Conform? A Deep Dive into Ty, Pyrefly, and Zuban"
33
date = 2025-08-29
4-
description = "A comparison of three new Rust-based Python type checkers: Astral's ty, Meta's pyrefly, and David Halter's zuban"
4+
description = "A comparison of three new Rust-based Python type checkers through the lens of typing spec conformance: Astral's ty, Meta's pyrefly, and David Halter's zuban"
55

66
[taxonomies]
77
tags = ["rust", "python", "type-checkers", "typing"]
@@ -39,7 +39,7 @@ Before examining these new Rust-based tools, it's worth understanding the curren
3939

4040
**pyre** - A type checker from Meta, written in a mix of OCaml and Python. Designed to handle Meta's massive Python codebase, pyre introduced several performance optimizations and incremental checking capabilities. However, Meta is now developing pyrefly as pyre's successor.
4141

42-
**pytype** - Google's type checker that takes a unique approach by performing type inference on unannotated Python code. Unlike other checkers that primarily validate existing type annotations, pytype can infer types from runtime behavior and generate stub files for gradual typing adoption. Written in Python, it's particularly useful for analyzing legacy codebases without type hints. However, Google announced in 2024 that pytype is being deprecated and Python 3.12 will be the last supported version of Python.
42+
**pytype** - Google's type checker that takes a unique approach by performing type inference on unannotated Python code. Unlike other checkers that primarily validate existing type annotations, pytype can infer types from runtime behaviour and generate stub files for gradual typing adoption. Written in Python, it's particularly useful for analysing legacy codebases without type hints. However, Google announced in 2024 that pytype is being deprecated and Python 3.12 will be the last supported version of Python.
4343

4444
## The newcomers
4545

@@ -49,6 +49,7 @@ Before examining these new Rust-based tools, it's worth understanding the curren
4949
**Development Repository:** <https://github.com/astral-sh/ruff/>
5050

5151
**Key Highlights:**
52+
5253
- Strong focus on gradual guarantee principles
5354
- Planned tight integration with Astral's existing linting tool `ruff`, with the aim to support type based linting rules.[^1]
5455
- Backing from a team combining Python core developers and very experienced Rust tooling developers
@@ -61,6 +62,7 @@ Before examining these new Rust-based tools, it's worth understanding the curren
6162
**Repository:** <https://github.com/facebook/pyrefly>
6263

6364
**Key Highlights:**
65+
6466
- Successor to Meta's existing [pyre](https://github.com/facebook/pyre-check) type checker, designed to eventually replace it
6567
- Enhanced type inference capabilities by default
6668
- Potentially higher upfront adoption cost due to aggressive inference which might flag issues with correct code
@@ -74,26 +76,26 @@ Before examining these new Rust-based tools, it's worth understanding the curren
7476
**Documentation:** <https://docs.zubanls.com/en/latest/>
7577

7678
**Key Highlights:**
79+
7780
- Created by the author of the popular Python LSP tool `jedi`
7881
- Aims for high-degree of compatibility with `mypy` to make adoption in large existing codebases seamless.
7982
- Not FOSS[^2], will require a license for codebases above 1.5 MB (~50,000 lines of code)[^3].
8083
- Currently maintained by a single author seems a potential risk to long-term sustainability as Python typing does not stand still.
8184

8285
**Philosophy:** Zuban aims to provide the smoothest possible migration path from existing type checkers, particularly `mypy`, making it attractive for organizations with substantial existing typed codebases.
8386

84-
8587
# Typing Conformance Suite Analysis
8688

87-
The Python Typing Council maintains a [Conformance test suite](https://github.com/python/typing/tree/main/conformance) which validates the behavior of static type checkers against the expectations defined in the [Python typing specification](https://typing.python.org/en/latest/spec/index.html).
89+
The Python Typing Council maintains a [Conformance test suite](https://github.com/python/typing/tree/main/conformance) which validates the behaviour of static type checkers against the expectations defined in the [Python typing specification](https://typing.python.org/en/latest/spec/index.html).
8890

8991
`ty` and `pyrefly` have not yet been added to the conformance suite, so it's harder to establish a baseline for their progress on this front.
9092

9193
To help resolve this gap I have [expanded the current test harness to support both of them](https://github.com/sinon/typing/pull/1)[^4], this also adds some additional debugging information to the html report to show the split between false negatives and false positives that the suite has detected in each test case.
9294

9395
I've also included a local build of `ty` for two main reasons:
9496

95-
* I've wanted to investigate contributing to `ty` and/or `ruff` for a while, so this was good impetus to get things set up.
96-
* `ty` releases are cut relatively infrequently and I am impatient.
97+
- I've wanted to investigate contributing to `ty` and/or `ruff` for a while, so this was good impetus to get things set up.
98+
- `ty` releases are cut relatively infrequently and I am impatient.
9799

98100
## Summary
99101

@@ -105,12 +107,12 @@ __Generated 29/08/2025__
105107
>
106108
> That being said even though `ty` is lagging on this metric at the moment it is still the type checker that I am most excited to use long-term because of the quality of the tooling Astral has built so far.
107109
108-
| Type Checker | Total Test Case Passes | Total Test Case Partial | Total False Positives | Total False Negatives | False Negatives |
109-
| :---------------------------------------------: | :--------------------: | :---------------------: | :-------------------: | :-------------------: | --------------- |
110-
| zuban 0.0.20 | 97 | 42 | 152 | 89 | 92 |
111-
| ty 0.0.1-alpha.19 (e9cb838b3 2025-08-19) | 20 | 119 | 371 | 603 | 603 |
112-
| Local:ty ruff/0.12.11+27 (0bf5d2a20 2025-08-29) | 20 | 119 | 370 | 590 | 590 |
113-
| pyrefly 0.30.0 | 81 | 58 | 100 | 187 | 187 |
110+
| Type Checker | Total Test Case Passes | Total Test Case Partial | Total False Positives | Total False Negatives |
111+
| :---------------------------------------------: | :--------------------: | :---------------------: | :-------------------: | :-------------------: |
112+
| zuban 0.0.20 | 97 | 42 | 152 | 89 |
113+
| ty 0.0.1-alpha.19 (e9cb838b3 2025-08-19) | 20 | 119 | 371 | 603 |
114+
| Local:ty ruff/0.12.11+27 (0bf5d2a20 2025-08-29) | 20 | 119 | 370 | 590 |
115+
| pyrefly 0.30.0 | 81 | 58 | 100 | 187 |
114116

115117
## Review of progress
116118

@@ -132,6 +134,7 @@ The conformance test suite focuses heavily on advanced typing features that, whi
132134
- Intricate interactions between multiple typing features
133135

134136
In contrast, the majority of Python codebases primarily use:
137+
135138
- Basic type annotations (`str`, `int`, `List[str]`, etc.)
136139
- Simple class hierarchies
137140
- Optional types and Union types
@@ -151,14 +154,12 @@ For teams evaluating these type checkers, the conformance scores provide valuabl
151154
- **For large, complex codebases or libraries leaning on more esoteric generic patterns**: Higher conformance scores may indicate better handling of advanced patterns you might encounter
152155
- **For teams new to typing**: The difference in conformance scores may be less relevant than IDE integration, error message quality, and performance
153156

154-
155157
# Other resources to learn more
156158

157-
* [Edward Li's excellent blog post comparing `ty` and `pyrefly`][1] which also contains the videos recorded at the PyCon typing summit which both `ty` and `pyrefly` gave presentations at.
158-
* [Happy Path Programming - 114 ty: Fast Python Type Checking with Carl Meyer](https://www.youtube.com/watch?v=V1OmqEYoSz4)
159-
* [Happy Path Programming - 115 More Python Type Checking! Pyrefly with Aaron Pollack & Steven Troxler](https://www.youtube.com/watch?v=huHF0Rv8L14)
160-
* [Talk Python - ty: Astral's New Type Checker (Formerly Red-Knot)](https://talkpython.fm/episodes/show/506/ty-astrals-new-type-checker-formerly-red-knot)
161-
159+
- [Edward Li's excellent blog post comparing `ty` and `pyrefly`][1] which also contains the videos recorded at the PyCon typing summit which both `ty` and `pyrefly` gave presentations at.
160+
- [Happy Path Programming - 114 ty: Fast Python Type Checking with Carl Meyer](https://www.youtube.com/watch?v=V1OmqEYoSz4)
161+
- [Happy Path Programming - 115 More Python Type Checking! Pyrefly with Aaron Pollack & Steven Troxler](https://www.youtube.com/watch?v=huHF0Rv8L14)
162+
- [Talk Python - ty: Astral's New Type Checker (Formerly Red-Knot)](https://talkpython.fm/episodes/show/506/ty-astrals-new-type-checker-formerly-red-knot)
162163

163164
# Footnotes
164165

@@ -167,6 +168,5 @@ For teams evaluating these type checkers, the conformance scores provide valuabl
167168
[^3]: Full pricing information at: <https://zubanls.com/pricing/>
168169
[^4]: This is just for this blog post, no plans to seek merging this.
169170

170-
171171
<!-- Reference links --->
172172
[1]: https://blog.edward-li.com/tech/comparing-pyrefly-vs-ty/

0 commit comments

Comments
 (0)