Status : ALPHA
Release date: 02 September 2025
Pyrefly v0.31.0 bundles 69 commits from 19 contributors
✨ New & Improved
Area | What’s new |
---|---|
PEP 728 support | - extra_items is now fully supported, with these changes support for PEP 728 is now complete! 🚀
|
LSP Features | - Introduced Pylance config python.analysis.importFormat , with possible values ”absolute” and ”relative” . - The default "absolute" maintains the current behavior, while "relative" enables importing modules using relative paths server name and version string now returned during LSP initialisation, useful for LSP clients for debugging/logging. |
Type Narrowing | - Improved narrowing for getattr(...) Narrow hasattr with string literals to Any if the attribute does not already exist
|
Inference & autocomplete | - Improved inference for self annotation: inferred to be type[Self] when decorated with classproperty or lazy_classproperty . - Improved autocomplete for imports with addition of import keywords. (Previously from x imp… would autocomplete to from x import imp ) |
Build System Integration | - Standalone pre-commit hook now available, see updated docs here - Refactored Buck build functionality into a new pyrefly_build crate. This does not involve functional changes but lays the groundwork for future work to enable Pyrefly to work more effectively with various build systems in both OSS and IDE environments.
|
Conformance | - Pyrefly has now been added to the conformance test suite, enabling users to compare behaviour of static type checkers against expectations defined in the Python typing specification |
🐛 Bug fixes
We closed 12 bug issues this release 👏
- A few issues with decorators:
- #921- incorrect type signature labelled for
type[T].__new__
- #509 - panic on
__all__
mutation without definition - #322 - error thrown falsely on
unittest.main()
- #71 - issue iterating over enums
- Other bugs: #932, #926, #765, #245, #162
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.31.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
@lolpack, @aahanaggarwal, @donsbot, @kinto0, @stroxler, @rchen152, @grievejia, @brosenfeld, @yangdanny97, @SamChou19815, @migeed-z, @connernilsen, @tianhan0, @javabster, @PIG208, @samwgoldman, @IDrokin117, @maggiemoss, @arthaud , @melvinhe, @rchiodo, @VladimirMakaev