Skip to main content

Pyrefly v1.1 is here!

· 7 min read

Pyrefly v1.1

Pyrefly v1.1 is now available 🎉 This is our first minor release since reaching stable v1.0 in May, and it brings improvements across the board: better performance, smarter type checking, and new IDE refactoring tools.

This release bundles over 250 commits from 40 contributors. To get started with the new version you can run:

pip install --upgrade pyrefly==1.1.0

In this post, we'll walk through what's new and what's changed.

Performance

Pyrefly v1.1 is 27% faster than Pyrefly v1.0 on Astral's ty_benchmark suite.

ProjectPyrefly 1.1Pyrefly 1.0ty 0.0.49mypy 2.1.0Pyright 1.1.410
black0.262s0.397s0.175s1.339s2.047s
discord.py0.380s0.522s0.421s4.607s3.636s
homeassistant5.398s6.076s5.027s21.332s27.645s
isort0.206s0.379s0.526s1.046s3.525s
jinja0.196s0.343s0.156s1.432s1.894s
pandas1.494s1.672s1.152s18.269s8.826s
pandas-stubs0.401s0.543s0.208s8.259s3.302s
prefect0.560s0.682s0.275s0.997s3.901s
pytorch2.105s2.524s2.989s36.253s16.664s

We modified the benchmark suite to include the newest versions of Pyrefly, ty, mypy, and Pyright. We also added support for parallelizing mypy and Pyright, to make them more comparable to Pyrefly and ty. We limited parallelism to 10 threads for all projects, and ran each project 10 times with 3 warmup runs.

Type Checking Improvements

We've made continuous improvements to type checking capabilities, these are some of the highlights. For a more detailed breakdown you can check the Pyrefly documentation or recent release notes.

  • New incompatible-comparison diagnostic catches comparisons like int == str where operand types can never overlap.
  • Smarter TypeVar default handling: parameters like x: T = 0 now correctly validate defaults against constraints, and the default is used when solving type variables in calls.
  • Frozen dataclass enforcement: frozen dataclasses now reject manual __setattr__/__delattr__ overrides.
  • Descriptor field recognition: annotation-only descriptor fields like SQLAlchemy's Mapped type are now properly recognised.
  • PEP 661 (Sentinel Values) support: PEP 661 sentinels (builtins.sentinel in Python 3.15+, typing_extensions.Sentinel in lower versions) are fully supported.
  • PEP 800 (disjoint base) support: the @disjoint_base decorator (imported from typing in Python 3.15+, typing_extensions in lower versions) is now fully supported.

Tensor Shape Checking

Since the experimental release of tensor shape checking, we've been excited to see your enthusiasm for this new feature. During this release we've been working on making it easier for early adopters to get started using the feature and contribute improvements.

Tensor shape operations now live in a dedicated stubs sub-directory (tensor-shapes/torch-stubs). This moves shape logic out of the type checker's Rust internals and into editable stub files, making it easier to extend and maintain shape definitions for new operations.

We've also set up a pyrefly_torch_shape_demo repository, which includes a minimal demonstration project showing how to set up experimental Pyrefly tensor shape checking for PyTorch code. The demo shows you how to clone a copy of the experimental stubs in the Pyrefly repository which should allow you to easily patch the stubs and submit a PR to Pyrefly if you find bugs or missing features you need.

Language Server / IDE Improvements

v1.1 adds new refactoring tools, smarter completions, and better navigation to the language server, among other things. For a more detailed breakdown you can check the Pyrefly documentation or recent release notes.

  • Move module member and move symbol to new file: restructuring your codebase no longer means manually updating imports everywhere. Move a function or class to a different module (or extract it into a new file), and Pyrefly rewrites all consumer imports across your codebase automatically.
  • Convert dict to TypedDict, dataclass, or Pydantic model: if you have a dict literal that's grown complex enough to deserve a proper type, a new code action can convert it and add the necessary imports for you.
  • Pytest fixture support: go-to-definition and find-references now work for pytest fixtures used as function parameters, so you can navigate directly to a fixture's definition instead of searching for it manually.
  • Literal value completions: when you're assigning to a variable or returning from a function with a Literal type, the editor now suggests the valid values.
  • Sphinx docstring links: :meth:, :class:, and :func: cross-references in docstrings now render as clickable links in hover tooltips, making it easier to navigate documentation without leaving your editor.

We're also excited to see more IDEs leverage Pyrefly's speed and robustness to bring enhanced experiences to their users. JetBrains now offers Pyrefly as an external type provider in PyCharm 2026.1.2, and Microsoft is building early preview support for Pyrefly in Pylance via the new Type Server Protocol.

Other Usability Improvements

Besides improvements to core typechecking and language server capabilities, we've also made a handful of other changes to improve the developer experience of Pyrefly:

  • Basic Mode Preset: has been expanded to include 8 new error types: BadClassDefinition, BadInstantiation, BadKeywordArgument, BadRaise, BadUnpacking, InvalidLiteral, InvalidSuperCall, UnexpectedPositionalArgument.
  • New all preset: this new preset enables all checks, it is the strictest possible setting for Pyrefly.
  • PyTorch efficiency lints: enable the new pytorch-efficiency-lints flag to catch common GPU performance pitfalls at type-check time, such as .item() calls that force a GPU sync, redundant .to(device) when the tensor is already on the target device, deprecated .cuda() usage, and print(tensor) in hot paths that triggers expensive string formatting.
  • pyrefly coverage check is a new command that lets you gate CI on type coverage. Set a --fail-under percentage and choose your output format; the build fails if coverage drops below your threshold. Useful for teams gradually adopting types who want to prevent backsliding.
  • JUnit XML output (--output-format junit-xml): Pyrefly can now emit results in the format that CI dashboards like Jenkins, GitHub Actions, and GitLab CI already understand, so type errors show up alongside your test results.
  • musllinux wheels: if you're deploying in Alpine containers or other musl-based environments, you can now pip install pyrefly without building from source.
  • Compiles on stable Rust: building Pyrefly from source no longer requires the nightly Rust toolchain, lowering the barrier for contributors and custom builds.

Bug Fixes

As always we've continued to fix bugs as they crop up, so if you've been waiting for a specific issue to be resolved before adopting Pyrefly, it's worth taking another look. Between v1.0 and v1.1 we closed 101 bug issues, covering false positives, import resolution, type narrowing, and more. You can find the full list on GitHub here.

What's Next & How to get Involved

As we move towards the next release we'll continue driving down false positives, expanding library support, and shipping improvements on a regular cadence. If you want to follow along or get involved we recommend the following resources:

Thank you to everyone who helped ship this release. We're grateful for every issue filed, PR submitted, and conversation had, and we look forward to building v1.2 together.