Pyrefly: Python type checker and language server in Rust
New Rust-Based Type Checkers (Pyrefly, Ty, Zuban)
- Several fast Rust implementations (Pyrefly, Ty, Zuban) are emerging as alternatives to Pyright/mypy, alongside BasedPyright (TS).
- Users welcome the speed gains, especially on large codebases, but report that all the new tools still feel alpha-level in real projects.
- Some note frequent panics/segfaults in Rust tools due to complex Python edge cases; unsafe Rust usage in Zuban raises concerns.
Performance vs Feature Parity
- Pyrefly is praised for speed but currently misses checks Pyright provides (e.g., unreachable code) and can be slow to initialize in some setups.
- Autocomplete, auto-imports, signatures/docs-on-completion, and “go to declaration” are unevenly implemented across tools; Pyrefly and Ty devs state these are priorities.
- Several people find PyCharm’s analysis still superior in complex inheritance/inference, though less strict than dedicated type checkers.
Typing Philosophy and Strictness
- Strong debate around “opinionated” type checkers:
- Some argue tools should enforce safer, more explicit patterns even when they deviate from idiomatic Python (e.g., preferring LBYL over EAFP).
- Others insist type checkers should not push style choices and that strictness/false positives quickly erode trust.
- There’s disagreement over how much inference (e.g., from empty lists) is desirable versus requiring explicit annotations.
Ecosystem Fragmentation and Tooling Explosion
- Python tooling is compared to JavaScript’s 2010s era: many overlapping tools (linters, formatters, type checkers, package managers).
- Some see this as healthy experimentation that will settle around a few winners; others are fatigued and waiting for consolidation.
- uv, ruff, and BasedPyright are cited as examples of “good enough + fast + effortless” tools that gain rapid adoption.
Pydantic, Django, and Type System Limits
- Many view support for Pydantic and Django as a gating factor; Pyrefly advertises experimental Pydantic support and ongoing Django work.
- Discussion highlights structural limitations of Python’s typing (dataclasses, kwargs, metaprogramming) and divergence between checkers.
- Some argue Python’s type system feels bolted on compared to designs like TypeScript; others say the main difficulty is typing highly dynamic patterns, not the basic system.