github facebook/pyrefly 0.43.0
Pyrefly v0.43.0

10 hours ago

Status : BETA
Release date: 24 November 2025

Pyrefly v0.43.0 bundles 213 commits from 24 contributors.

✨ New & Improved

Area What’s new
IDE/LSP Features - New warnings for unused imports and unused variables

- Pyrefly LSP features now apply to Python documents with the inmemory schema, improving support for interactive consoles and temporary code cells in IDEs like Positron.

- Added a configuration option to control whether "Go to definition" links appear in hover tooltips, enabled by default
Type Checker Improved support for unpacking tuple[*Ts], fixing cases where unpacking would previously degrade to object If a TypeVarTuple-annotated varargs is unmatched, it now resolves to an empty tuple in all cases
Error Messages - New --enabled-ignores command line flag and configuration option allow specifying exactly which tools’ ignore comments (e.g., # pyright: ignore) pyrefly respects

- CLI flags like --error, --warn, etc., now accept comma-separated lists, making it easier to enable or disable multiple error codes at once.
Pydantic Support Improved handling of RootModel types, including nested and union scenarios. Basic support for Pydantic BaseSettings. Fields in BaseSettings are now treated as optional by default.

🐛 bug fixes

We closed 17 bug issues this week 👏

  • #1642 - TypedDicts with any required keys are now correctly treated as always truthy, allowing for proper type narrowing in boolean expressions
  • #1611- correctly detects await in nested generator expressions, preventing them from being incorrectly typed as Generator instead of AsyncGenerator.
  • #1609 - fixed a bug where positional argument inlay hints for callables with *args would show incorrect positions or duplicates
  • #1598 - Literal strings now correctly participate in protocol subset checks (e.g., against typing.Container), fixing an issue with type signature mismatch
  • #1462 - Allow referencing inherited attributes from a class body's top level.
  • #1256 - fixes crash when the walrus operator (:=) appears in annotation positions
  • #273 - correctly handles tuple[()] | tuple[int, *tuple[int, ...]] to simplify to tuple[int, ...].
  • And more: #1644, #1635, #1633, #1631, #1625, #1604, #1268, #1230, #1016, #981

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.43.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:

  1. pyrefly check --suppress-errors
  2. run your code formatter of choice
  3. pyrefly check --remove-unused-ignores
  4. 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](https://pyrefly.org/en/docs/error-suppressions/)

🖊️ Contributors this release

@javabster, @AryanBagade, @asukaminato0721, @austin3dickey, @yangdanny97, Dhruv Mongia, @fangyi-zhou, @Imran-S-heikh, @grievejia, @jvansch1, @keito, @kshitijgetsac, @kinto0, @arthaud, @nathan-liyiming, @rchen152, Ron Mordechai, @samwgoldman, @cybardev, @stroxler, @tianhan0, @vinnymeller, @migeed-z

Don't miss a new pyrefly release

NewReleases is sending notifications on new releases.