github facebook/pyrefly 0.47.0
Pyrefly v0.47.0

4 days ago

Status : BETA
Release date: 05 January 2026

Pyrefly v0.47.0 bundles 207 commits from 35 contributors.


✨ New & Improved

Area What’s new
LSP Features - Improved autocompletion for keys in .get() on TypedDicts

- Improved documentation in hover tooltips for attributes like dataclass fields

- Improved import handling: import X as X and from Y import X as X are now recognized as explicit re-exports and not flagged as unused imports.
Type Checking - TypeIs calls now correctly narrow to the intersection of types instead of Never.

-Final attributes that are not initialized on the class are now enforced as such. Previously, Final was only enforced if the attribute was initialized on the class.

- Improved typing spec conformance by extending reassignment checks for variables declared as Final to additional binding constructs including unpacking, context managers, and loops.
Pydantic Support - Support added for Annotated fields

- Pyrefly now validates BaseModel fields at instantiation, catching out-of-range arguments (e.g., Model(x=0) when x must be gt=0).
Error Types / Diagnostics - New error codes (non-exhaustive-match, invalid-enum-pattern) warn about incomplete match statements over Enums and incorrect patterns.

- New missing-override-decorator error that is emitted when a method overrides a parent class method but does not have the override decorator. This error is off by default and can be enabled in your .toml configuration

- Pyrefly now suggests the closest stdlib module name for mistyped imports (e.g., import jsnDid you mean 'json'?).

🐛 bug fixes

We closed 34 bug issues this release 👏

  • #1952 - Allow typing_extensions for typing module special callables.
  • #1906 - The single-underscore function _ is now correctly exported from custom builtins for i18n support.
  • #1905 - Fixed stack overflow panic in protocol conformance check involving recursive Forall types and method lookups.
  • #1784 - Fixed subtype checking for LiteralString and Collection.
  • #1723 - Ignore textDocument/didClose for notebooks and vice versa in the LSP server.
  • #1597 - Type narrowing now uses intersection logic, preventing overly strict type errors.
  • #1375 - Improved support for object.__new__(C) which was previously incorrectly inferring the type as object.
  • #1086 - Autocomplete for string Literal values no longer inserts redundant quotes when completing inside a string literal.
  • And more: #1048, #880, #844, #821, #792, #504, #1274, #1271, #1213, #1209, #1091, #1393, #1659, #1657, #1603, #1783, #1758, #1903, #1880, #1856, #1791, #1948, #1910, #1962, #1961

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.47.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

🖊️ Contributors this release

@aleivag, @ArchieBinnie, @AryanBagade, @asukaminato0721, Bharath Sundararaj, Brian Chien, Cédric Barreteau, @connernilsen, @yangdanny97, @dtolnay, @fangyi-zhou, @gvozdvmozgu, @jackulau, @grievejia, @jvansch1, @Karman-singh15, @kinto0, @martindemello, @arthaud, @nikita-ashihmin, @nitinsingh-meta, @rchen152, @kitagry, @salmanmkc, @samwgoldman, @ska-kialo, @stroxler, Tatiana Ber, @tannguyencse19, @zanieb, @migeed-z

Don't miss a new pyrefly release

NewReleases is sending notifications on new releases.