github facebook/pyrefly 0.57.0
Pyrefly v0.57.0

latest release: 0.57.1
10 hours ago

Status: Beta
Release date: March 16, 2026

Pyrefly 0.57.0 bundles 116 commits from 17 contributors.


✨ New & Improved

Area What’s new
Type Checking - Improved type narrowing for hasattr inside loops

- pyrefly suppress no longer corrupts multiline f-strings/t-strings by inserting suppression comments inside the string; it now places comments above the string and also matches suppressions correctly for errors inside multiline f/t-strings

- Improved namedtuple support with * field unpacking

- Fewer false-positive “variable is not initialized” errors
Language Server - if a nested pyproject.toml contains [tool.ruff] / [tool.mypy] / [tool.pyright], it’s treated as a strong “this is a Python project root” marker, preventing parent pyrefly.toml from incorrectly shadowing it (notably improving go-to-def accuracy on some repos)
Performance - Typechecking speed has improved, making it now ~20% faster to type check Pytorch on recent benchmarks

🐛 bug fixes

We closed 24 bug issues this release 👏

  • #2696: Fixed an issue where Pyrefly’s LSP incorrectly flagged from typing import NewType as unused, even when NewType(...) was referenced.
  • #2743: Fixed an issue where TypedDict fields named items/values prevented access to the corresponding dict.items() / dict.values() methods via attribute lookup.
  • #2745: Fixed an issue where chained/nested narrowing expressions (e.g. multi-clause and conditions) failed to narrow correctly when using negative subscript indices.
  • #2737: Fixed an issue where functools.partial(...) results couldn’t be assigned back to a Callable typed with a ParamSpec, causing a false-positive type error.
  • #2650: Fixed an issue where a Protocol parameterized by ParamSpec[...] wasn’t considered compatible with an equivalent “gradual” protocol using *args: Any, **kwargs: Any.
  • #2334: Fixed an issue where calling __init__ on parametrized bound methods could trigger a false-positive type error due to incorrect attribute lookup behavior.
  • #2731: Fixed an issue where super() calls to abstract methods that do have a concrete runtime body were incorrectly reported as missing-attribute / abstract-call errors.
  • #828: Fixed an issue where reading a conditionally-initialized variable didn’t “commit” the initialization, leading to redundant follow-on “may be uninitialized” errors.
  • #835: Fixed an issue where type information for subclasses wasn’t handled correctly, leading to failures when type-checking subclass relationships.
  • And more! #2522, #1800, #2736, #2382, #913, #1397, #2261, #2669, #2744, #2739, #1575, #903, #1043, #1429, #2607

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.57.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 Pyrefly documentation


🖊️ Contributors this release

@stroxler, @grievejia, @yangdanny97, @migeed-z, @jvansch1, @rchen152, @asukaminato0721, @maggiemoss, @arthaud, @lolpack, @samwgoldman, @Adist319, David Tolnay, @avikchaudhuri, @rubmary, @javabster


Please note: These release notes summarize major updates and features. For brevity, not all individual commits are listed. Highlights from patch release changes that were shipped after the previous minor release are incorporated here as well.

Don't miss a new pyrefly release

NewReleases is sending notifications on new releases.