Status : BETA
Release date: 02 February 2026
Pyrefly v0.51.0 bundles 162 commits from 25 contributors.
✨ New & Improved
| Area | What’s new |
|---|---|
| Type Checking | - Fixes for incorrect type narrowing in boolean operations with generic functions - Intersection logic fixed to identify empty intersections ( Never) for final classes and populated Enums, as they cannot be subclassed. - Added support GenericAlias type, including special attributes like __origin__, __args__, and support for the pipe operator - Added support for checking that class-scoped type variables are not used in self annotations in __init__ methods, per typing spec
|
| Language server | - During module resolution, "phantom paths" (non-existent paths checked during import) are now tracked, improving watch mode and import re-resolution - List addition ( +) now propagates type hints to both operands, making assignments like l2: list[Base] = [A()] + [B()] work as expected
|
| Error Handling | - Added configuration to debug and/or bypass deep recursion, which is useful for diagnosing stack overflow issues in large or generated codebases - Multiple error messages have been shortened, clarified, or made more precise for better user experience (e.g., TypedDict, protocol variables, unpacking errors, pydantic, descriptor defaults). |
| Performance Improvements | - Faster suggested standard library imports (did you mean...?) - Reduced memory usage for type aliases of unions - Further improvements to tracking for fine-grained dependencies, improving IDE performance during incremental rechecks and accuracy of features like auto-imports |
🐛 bug fixes
We closed 21 bug issues this release 👏
- #2269 - Attribute lookups on classes inheriting from
Anynow fall back toAnyinstead of reportingmissing-attribute. - #2250 -
Selfis now properly bound in class body expressions. - #2236 - fixed issue where
--removed-unused-ignoresincorrectly removed ignores from other type checkers - #2196 - Tuple length checks with
isinstancenow work correctly with unpacked tuples and type variables - #2118 - Legacy
TypeVarsare now correctly inferred inCallableannotations without assignment - And more! #990, #842, #496, #2036, #1917, #1807, #1714, #1680, #2169, #2141, #2211, #2208, #2246, #2267, #2256, #2274
Thank-you to all our contributors who found these bugs and reported them! Did you know this is one of the most helpful contributions you can make to an open-source project? If you find any bugs in Pyrefly we want to know about them! Please open a bug report issue here
📦 Upgrade
pip install --upgrade pyrefly==0.51.0
How to safely upgrade your codebase
Upgrading the version of Pyrefly you're using or a third-party library you depend on can reveal new type errors in your code. Fixing them all at once is often unrealistic. We've written scripts to help you temporarily silence them. After upgrading, follow these steps:
pyrefly check --suppress-errors- run your code formatter of choice
pyrefly check --remove-unused-ignores- Repeat until you achieve a clean formatting run and a clean type check.
This will add # pyrefly: ignore comments to your code, enabling you to silence errors and return to fix them later. This can make the process of upgrading a large codebase much more manageable.
Read more about error suppressions in the Pyefly documentation
🖊️ Contributors this release
@rchen152, @stroxler, @migeed-z, @kinto0, @yangdanny97, @arthaud, @maggiemoss, @connernilsen, @grievejia, @samwgoldman, @rubmary, @fangyi-zhou, @AryanBagade, @bluetech, @ddrcoder, @javabster, @ndmitchell, @praskr-wisdom, @shayne-fletcher, @tsembp, @jvansch1, @tianhan0, @dtolnay