github pyrefly-org/pyrefly 1.5.1
Pyrefly v1.5.1

one hour ago

Release date: November 30, 2026

Pyrefly v1.5.1 is a patch release that fixes a narrowing regression in v1.5.0.


🐛 Bug fixes

  • #5546: An or of two type guards keeps the narrowed type again. In v1.5.0, the narrow was dropped when the guarded type matches every class, such as a class that extends Any or an empty protocol. For example, with attrs, if attrs.has(cls) or attr.has(cls): left cls as type[object] instead of type[AttrsInstance], so cls.__attrs_attrs__ gave a false missing-attribute error.

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==1.5.1

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.

Don't miss a new pyrefly release

NewReleases is sending notifications on new releases.