Repository navigation
Releases: meta/pyrefly
Release list
Pyrefly v1.4.0
Release date: October 14, 2026
Pyrefly v1.4.0 bundles 1191 commits from 66 contributors.
Release Highlights
Language Server
- The VS Code extension now runs the Pyrefly from your environment. By default, the extension launches the Pyrefly installed in your active Python environment (for example, your project's
.venv), so your editor and your command line use the same version. If the environment has no Pyrefly, the extension falls back to its bundled binary. Setpyrefly.pyreflyExecutabletobundledto keep the old behavior. See Pyrefly binary selection.
Configuration & CLI
- uv workspace members are now type checked. In a uv workspace, the interpreter puts each member's source directory on
sys.pathas an editable install. Pyrefly treated those directories as installed packages and skipped them, so errors in workspace members went unreported. Pyrefly now checks editable sources inside your project, while regularsite-packagesstay excluded.
Type Checking
- Easier migration from BasedPyright. Pyrefly reads
basedpyrightsections inpyproject.tomland applies the matching type checking mode preset. - New opt-in checks for untyped code. New error kinds such as
unknown-member-type,unknown-return-type,untyped-function-decorator, anduninitialized-instance-variablehelp you find whereAnyenters your code.
Tensor Shapes
- JAX shape stubs on PyPI. This is the first stable release that ships JAX shape stubs as the
jax-pyrefly-stubspackage.
⚠️ Behavior Changes
These may change your editor setup or surface new errors in code that checked cleanly under v1.3.0.
- The VS Code extension now uses the Pyrefly in your active environment by default instead of its bundled binary. If your environment pins an older Pyrefly, the editor now runs that version. The Pyrefly language server output channel shows which binary was chosen and why.
- Pyrefly now checks the source of uv workspace members (editable installs inside your project). Errors in those packages that were hidden before can now appear.
--typeshed-pathnow replaces the bundled typeshed entirely instead of overlaying it.- The
incompatible-overload-residualerror kind is renamed toincompatible-overload-argument. The old name still works as a deprecated alias. site-package-pathis renamed tosite-packages-path. The old name still works.
✨ New & Improved
Type Checking
- Pyrefly now recognizes
basedpyrightconfiguration sections inpyproject.tomland applies appropriate type checking mode presets, making it easier to migrate from BasedPyright. - TypedDict handling has been significantly improved: generic
extra_itemsare now instantiated correctly, extra items can supply missing arguments, anddefinitely_seencalculation in callable checking has been fixed. - TypeVar restriction checking is now enforced even when the expected type is gradual, preventing silent violations of TypeVar bounds and constraints when
Anyappears in the expected type. - Improved handling of overloaded function arguments in generic function calls through a new overload table mechanism, replacing the previous residual-based approach. The
incompatible-overload-residualerror kind has been renamed toincompatible-overload-argument(the old name remains as a deprecated alias). - Variance inference has been improved with fixes for nested variance reliability bugs and explicit stored variance evidence.
- Property decorator validation now reports invalid signatures with extra required parameters.
- Added opt-in
uninitialized-instance-variablecheck for annotated instance attributes never assigned in__init__or class body, including@dataclass(init=False)fields. - Improved higher-order function call handling with quantified finalization and better overload branch capture.
functools.partialnow uses standard quantified finalization and handles generic overload targets.- Improved ParamSpec variance in generic comparisons and handling of generic callable residuals.
- Added support for propagating divergence through compound statements to detect unreachable code after
if/elseblocks where all paths diverge. - Added support for evaluating
sys.version_infocomparisons against tuples with release levels like(3, 14, 0, "beta").
Type Checking Fixes
- Overload evaluation now forces per-overload argument types before rolling back variables, so variables are no longer pinned by accident.
- Overload evaluation step 5 (argument materialization) now runs for implicit descriptor
__get__calls. - Invalid
type(...)calls in annotations now suggest valid type forms liketypes.NotImplementedType,types.EllipsisType,None,types.ModuleType, ortype[MyClass]. - Invalid function calls in return annotations now produce clearer error messages.
- Unknown unions in class bases now accept valid known classes while recording dynamic bases.
- Conditionally imported base classes now keep the known class while recording a dynamic base.
- Tuple constructor type variables no longer leak when the constructor is passed as a higher-order factory callable.
- Overloaded constructors no longer leak type parameters through gradual arguments.
- Version-gated returns now preserve configured reachability.
- Environment-dependent branch tests (like
TYPE_CHECKING = False) no longer report their suites as unreachable. - Descriptor setter override checking now checks every overload.
- Module resolution now honors first-match-wins between single-file modules and packages in later roots.
Nevercontainers (list[Never],dict[Never, Never], etc.) are now recognized as falsy.- Unpacking an overloaded tuple now combines branches position by position.
- Assigning to an overloaded type now succeeds when the value fits any branch.
- Facet narrowing now narrows overloaded values by ruling out branches.
- Attribute access and subset checks on overloaded types are more accurate.
- Overload selection now ignores type variables that appear only in the return type.
- Overloads that violate TypeVar restrictions under a gradual expected type are now rejected.
- Return type variables of overloaded protocol methods in invariant classes are now handled correctly.
- Union type arguments in indirect diamond inheritance are now compared without regard to member order.
max/mincalls withkey=anddefault=no longer report argument errors from rejected union hint members.- Attribute facets are now rebased correctly when the base type is replaced.
Annotatedmetadata is no longer type checked, which removes spurious errors.- Methods typed as a union with
Any, or whose decorator returnsT | Any, now bind correctly. - A custom
__new__inherited from an intermediate NamedTuple subclass is now handled correctly. - Identity and membership tests with an
Anyoperand now inferbool. - Soft errors no longer drive constructor, default, and decorator checks.
- A
python-versionbelow 3.5 is now rejected with an error instead of crashing.
Language Server
- The VS Code extension now launches the Pyrefly installed in your active Python environment by default, and falls back to the bundled binary. A new
pyrefly.pyreflyExecutablesetting (from-environmentorbundled) controls this. Selecting a different interpreter restarts the server with the new binary when it changes. - Pyrefly now watches explicit
configPathsettings and reloads configuration when those files change. - Hover now prefers interface (
.pyi) docstrings over implementation (.py) docstrings when both exist. - Go-to-definition for standard library symbols now searches the interpreter's stdlib for
.pyfiles. - Go-to-definition now prefers stub definitions over unresolved
__all__entries and handles re-export cycles. - Go-to-definition now works for TypedDict subscript keys.
- LSP rename now includes attribute assignments and deletions across files.
- Added LSP quick-fix code action for removing unused ignores.
- Added LSP registration for
workspace/didChangeConfigurationonpythonsection. - Fixed language server to answer startup requests with workspace settings instead of defaults.
- Fixed language server deadlock when configuration response triggers file watcher registration.
- Added TSP
pyrefly/typeFactsrequest for batch type queries. - Fixed TSP
--configto pin config for every file. - Added code action videos to IDE features documentation.
- Fixed attribute definition index recording for assignment and deletion targets in rename.
- Added object attributes to LSP attribute completion, ranked after class attributes.
Callableclass attributes now bindselfwhen first parameter is the containing class.
Polars Support
selectandwith_columnsnow handle both positional and keyword arguments correctly, preserving schema information.- Added validation for Polars conditional predicates, duplicate
with_columnsoutputs, and sole-argument list expansion rules. - Improved Polars column-width tracking with
OutputCountenum to distinguish provable width from unknown width. - Added support for Polars
pl.col.attribute completion, suggesting columns from the enclosing DataFrame operation. - Added validation for column names in Polars
filter,sort,unique, anddrop_nullsmethods.
Django Support
QuerySet.annotate()now preserves keyword annotation attributes on result rows for attribute lookup and LSP completion.- Fixed Django relation
to=keyword argument resolution. - Fixed Django
ForeignKeykeyword-formto=resolution.
Configuration & CLI
- uv workspace members (editable installs inside the project) are now checked instead of being excluded as site packages (#2667).
- Added
pyrefly completioncommand to generate shell comp...
Pyrefly v1.4.0-dev.4
Pyrefly v1.4.0-dev.3
Release date: October 1, 2026
About dev releases
Dev releases (versions likeX.Y.Z-dev.N) are non-stable snapshots cut periodically from trunk. They give early adopters a chance to try in-progress features and surface issues before the next stable release, but they don't carry the same stability or compatibility guarantees as a stable release — don't pin production projects to a dev version.
Pyrefly v1.4.0-dev.3 bundles 86 commits from 19 contributors.
This is a short snapshot — three days after v1.4.0-dev.2 — so it is a small release focused on unreachable-code reporting and language-server fixes.
✨ New & Improved
Type Checking
- Unreachable-code reporting continues to expand: Pyrefly now reports
exceptclauses that can never be entered, redundant exception classes inside a reachableexceptclause, and dead code after a call that never returns.
Language Server
- Pyrefly migrated from its
lsp-typesfork togen-lsp-types0.11.0. - Baselines now have the option to automatically remove fixed baselined errors on file save.
Other
- Build-system-supplied configuration is better documented, and module finder options moved into a struct.
- Agent invocation metadata is now shared and used for error telemetry.
🐛 Bug fixes
- #4825: Fixed a false
bad-returnfor a generator function annotatedIterator[X] | T. - #5073: Fixed a series of unreachability bugs that made it into the last release.
- #4668: Extension-less Python scripts, such as a shebang script named
scriptrather thanscript.py, got no diagnostics in the editor. Their errors were computed and then dropped before publishing, because the defaultproject-includesglobs cannot match a path with no extension. These files are now reported, and they respectproject-includesby matching as though they ended in.py. - An unsaved file is now checked as the language the editor reports it to be, rather than always being assumed to be Python.
- An assignment to a field inherited from a frozen Pydantic model is now checked. The assigned value was skipped, so a type mismatch went unreported and the attribute narrowed to
Never. - The right-hand side of an attribute assignment is now always inferred. It was sometimes skipped, which hid errors in the assigned expression.
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.4.0-dev.3How 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:
pyrefly check --suppress-errors- Run your code formatter of choice
pyrefly check --remove-unused-ignores- 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, @connernilsen, @rchen152, @kinto0, @asukaminato0721, @samwgoldman, @grievejia, @shobhitmehro, @jakevdp, @nitishagar, @shahhamdihassan, @arthaud, @Trighap52, @maggiemoss, @dantrapp, @tonyyuyiding, @MarcoGorelli, @igorsugak, @NarxPal
🔬 Tensor Shape Support
JAX stub support is still under development and is not yet available on PyPI. The JAX improvements below describe ongoing work in the repository rather than an installable stub package in this release.
- JAX
svdshape typing is improved. jnp.crossno longer accepts 2D vectors.
Please note: These release notes summarize major updates and features. For brevity, not all individual commits are listed.
Pyrefly v1.4.0-dev.2
Release date: September 28, 2026
About dev releases
Dev releases (versions likeX.Y.Z-dev.N) are non-stable snapshots cut periodically from trunk. They give early adopters a chance to try in-progress features and surface issues before the next stable release, but they don't carry the same stability or compatibility guarantees as a stable release — don't pin production projects to a dev version.
Pyrefly v1.4.0-dev.2 bundles 493 commits from 20 contributors.
⚠️ Notable change: X | None annotations with an unknown X
Pyrefly now decides whether | builds a type union from the type-form context of the expression, instead of from the types of its operands. Before this change, an annotation such as UnresolvedType | None (for example, when UnresolvedType comes from a missing import) was evaluated as plain Unknown, and the | None was silently dropped. Pyrefly now evaluates it as Unknown | None.
This is more correct, but it can surface new errors, such as missing-attribute on None, in code that uses unresolved types in Optional-style annotations. Please try this dev release and report any false positives. (#4846)
✨ New & Improved
Type Checking
- Pyrefly now respects the
stdlib/VERSIONSfile of a custom typeshed, and it notices when that file changes. - Build systems can now supply a default configuration.
- Unreachable-code reporting is more precise: Pyrefly reports dead code after a run of
withstatements, branches that are decided by the type of their test, andexceptclauses that can never match. - Pydantic
Stricttypes, such asStrictInt, now enable strict mode for the field. TypeVarTuplevariance is now checked.NewTypeover an abstract class no longer produces a false-positivebad-instantiationerror.
Language Server
- The status indicator refreshes when a
pyrefly.tomlfile is added or removed, and Pyrefly rewatches files when an explicitly configured config file changes. - The TSP
initializeresponse now includesserverInfo. - In a
matchvalue pattern, attribute completion now ranks enum members that earliercasearms already cover lower. - Baseline matching supports a new
column-orderedmode, and the language server matches baselines in batches.
Other
- Pyrefly now has an experimental programmatic API for Monty.
- When some warnings are hidden, the message now explains how to show them.
- Memory usage and commit latency in the incremental state are improved.
🐛 Bug fixes
- #4846: Fixed regressions from v1.3.0 in type inference after a variable is reassigned to
Any. See also the notable change above. - #4858, #4618:
Enum.valueno longer widens a literal value to its base type (for example, tostr). - #4400: Pydantic private attributes (
PrivateAttr) are no longer treated as frozen. - #4995: Django models now give
pkthe correct type when the primary key is aForeignKey(..., primary_key=True). - #4991:
pyrefly suppressnow writes# pyrefly: ignore[code]without a space before the bracket, which matches the documentation. - #4986: Hover now works on attribute assignments in
__init__. - #4813: Pyrefly no longer rejects a duck-typed
Mappingin a**dict unpacking. - #4650:
stubgenno longer keeps the full analysis of the whole import closure in memory. - #4592: A
__get__overload with a self type ofConcatenate[ObjT, P1]and a siblingTypeVarnow matches correctly.
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.4.0-dev.2How 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:
pyrefly check --suppress-errors- Run your code formatter of choice
pyrefly check --remove-unused-ignores- 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, @connernilsen, @rchen152, @kinto0, @asukaminato0721, @samwgoldman, @jakevdp, @yeetypete, @MarcoGorelli, @grievejia, Abby Mitchell, @Pager-dot, @arthaud, @digvijaysai29, David Tolnay, @yangdanny97, @Aniketsy, @QEDady, @alexander-beedie, Alan Kurusingal
🔬 Tensor Shape Support
JAX stub support is still under development and is not yet available on PyPI. The JAX improvements below describe ongoing work in the repository rather than an installable stub package in this release.
- Torch shape stubs cover much more of the public API, including more pointwise, reduction, indexing, FFT, pooling, convolution, and attention operations, and they report unknown top-level Torch APIs.
- A new
IntVar[N]runtime wrapper supports dimension arithmetic. Bare*tuple[...]and*IntTuplesplats are now accepted in shapes. - JAX and NumPy stubs have improved shape inference for
random,lax,pad,split,expand_dims, and other operations, and the top-leveljaxnamespace now has stubs.
Please note: These release notes summarize major updates and features. For brevity, not all individual commits are listed.
Pyrefly v1.3.2
Release date: September 28, 2026
Pyrefly v1.3.2 is a patch release that fixes regressions in how Pyrefly infers the type of a variable after it is assigned a value of type Any.
🐛 Bug fixes
- #4846: Fixed several regressions from v1.3.0 in type inference after a variable is reassigned to
Any:- Assigning an implicit
Any(a value with no known type, such as the result of an unannotated function or an unresolved import) to an annotated variable once again producesUnknown. It no longer turns into an explicitAny. - When a variable annotated as
Optional[T]orT | Noneis narrowed toNoneand then reassigned inside that branch, Pyrefly no longer adds the annotation'sNoneback after the branch. For example,x: Any | Nonefollowed byif x is None: x = get_any()now givesAnyinstead ofAny | None. - When a variable's annotation is a union that contains
Any, assigningAnyto it now narrows the variable toAny. For example,x: Any | Nonefollowed byx = x or get_any()now givesAnyinstead ofAny | None, so later attribute access no longer reports a falsemissing-attributeerror onNone.
- Assigning an implicit
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.3.2How 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:
pyrefly check --suppress-errors- Run your code formatter of choice
pyrefly check --remove-unused-ignores- 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.
Pyrefly v1.4.0-dev.1
Release date: September 18, 2026
About dev releases
Dev releases (versions likeX.Y.Z-dev.N) are non-stable snapshots cut periodically from trunk. They give early adopters a chance to try in-progress features and surface issues before the next stable release, but they don't carry the same stability or compatibility guarantees as a stable release — don't pin production projects to a dev version.
Pyrefly v1.4.0-dev.1 bundles 98 commits from 13 contributors.
✨ New & Improved
Type Checking
- A new opt-in
uninitialized-instance-variablecheck reports instance attributes that may be read before assignment, including fields on dataclasses declared withinit=False. - Overload inference now handles generic call targets and callable fallbacks more precisely, including
functools.partial, independently pruned arguments, and writable callback variance. - Property getters, setters, and deleters with extra required parameters now report invalid signatures when the decorator is applied.
- Unaliased directory imports now bind the imported name correctly, and source files nested beyond the configured analysis depth are rejected cleanly.
- Django
annotate()calls now add their declared attributes to the resulting queryset type.
Language Server
- Hover information now prefers interface docstrings when available and falls back consistently to implementation docstrings across imports.
- Parameter-name inlay hints now align correctly for bound methods whose receiver is named
__self.
🐛 Bug fixes
We closed 3 bug issues this release 👏
- #4918: Property decorators now reject getters, setters, and deleters with extra required parameters instead of silently accepting invalid signatures.
- #4936: Fixed shifted parameter-name inlay hints for bound methods whose receiver is named
__self, such as methods onloguru.Logger. - #1610: SQLAlchemy dataclass fields now reject mutable
dict,list, andsetliterals passed tomapped_column(default=...)and recommenddefault_factoryinstead.
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.4.0-dev.1How 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:
pyrefly check --suppress-errors- Run your code formatter of choice
pyrefly check --remove-unused-ignores- 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
@rchen152, David Tolnay, @dependabot, @Kylei, @dedsec-terminal, Oleh Prypin, Gábor Varga, @jakevdp, @jasonnathanieln, @stroxler, @ndmitchell, @connernilsen, @asukaminato0721
🔬 Tensor Shape Support
JAX stub support is still under development and is not yet available on PyPI. The JAX improvements below describe ongoing work in the repository rather than an installable stub package in this release.
The current
einopsstubs are limited to Torch tensors. We are still exploring how to support multiple array packages.
- JAX NumPy, linear algebra, and FFT APIs now accept
ArrayLikeinputs more broadly, with improved shape inference forlinspace,logspace, andgeomspace. - JAX, NumPy, and PyTorch constructors now preserve shapes derived from nested list literals, including zero-sized dimensions.
- Torch shape stubs now expose public submodules as attributes and support the single-argument and keyword forms of
torch.whereand bare@torch.no_grad. - Shape-aware einops stubs now cover the remaining public APIs for Torch tensors.
pyrefly-shape-extensionsnow supports Python 3.10 and provides runtime markers for regular nested lists.
Please note: These release notes summarize major updates and features. For brevity, not all individual commits are listed.
Pyrefly v1.2.1
Release date: September 16, 2026
Pyrefly v1.2.1 is a patch release with a single performance improvement.
⚡ Performance
- TSP requests on a file that is not open (for example
getComputedType) used to solve the whole module from scratch in a throw-away transaction, then discard that work once the request finished. The solve is now committed to shared state when possible, so later requests for the same file reuse the earlier solve instead of repeating it. In a captured Pylance session with 43,811getComputedTyperequests, median latency for non-open-file requests dropped from 16.9ms to 0.07ms, and total TSP request time for that session fell from about 671s to about 6.4s.
📦 Upgrade
pip install --upgrade pyrefly==1.2.1How 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:
pyrefly check --suppress-errors- Run your code formatter of choice
pyrefly check --remove-unused-ignores- 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.
Pyrefly v1.3.1
Release date: September 14, 2026
Pyrefly v1.3.1 is a patch release with a single bug fix.
🐛 Bug fixes
- #4909: Fixed a critical issue where Pyrefly would immediately crash on startup with a thread panic when empty or relative base paths were encountered during configuration. The server now safely resolves these paths against the working directory, preventing the crash and allowing normal operation.
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.3.1How 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:
pyrefly check --suppress-errors- Run your code formatter of choice
pyrefly check --remove-unused-ignores- 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.
Pyrefly v1.3.0
Release date: September 10, 2026
Pyrefly v1.3.0 bundles 934 commits from 71 contributors.
🔍Release Highlights
Type Checking
- New diagnostics and more accurate type inference. Pyrefly now catches invalid literal regular expressions, invalid
mock.patchtargets, unsupporteddataclass_transformarguments, incompatibleProtocol.__call__overrides, and unimplemented abstract methods. Pattern-match exhaustiveness, overload resolution, narrowing, and generic inference are also more accurate. - Better support for major Python frameworks. Pyrefly understands same-file Django reverse relationships, checks SQLAlchemy updates against model fields, and recognizes attributes registered on PyTorch modules.
Language Server
- Search the whole workspace for methods and nested definitions. Workspace symbol search now covers methods, nested classes and functions, and class attributes even in unopened files.
- New editor refactorings and quick fixes. Change Signature updates a function and its call sites together, while new quick fixes remove unused imports and insert
assert x is not None. Inlay hints can also insert required imports and link to definitions.
Configuration & CLI
- Target individual Pyrefly errors with standard suppression comments.
# type: ignore[pyrefly:<code>]suppresses a specific Pyrefly diagnostic without hiding unrelated errors on the same line. - Choose how Pyrefly handles untyped dependencies. The new
--replace-untyped-imports-with-anyoption replaces selected third-party packages that lack stubs or apy.typedmarker withAny, andpyrefly inittranslates mypy'sfollow_untyped_importssetting automatically. - Baseline files are easier to maintain and review. Baselines can match by concise description instead of source position, use a compact format, show existing errors at reduced severity, remove stale entries with
--prune-baseline, and reject them in CI with--error-stale-baseline.
Experimental Extensions
- Much broader shape-aware JAX and NumPy support. New JAX stubs cover array creation, manipulation, and linear algebra, while the new
pyrefly-numpy-stubspackage brings shape checking to NumPy. These stubs use a new type-level shape DSL, which replaces the old@shaped_arrayAPI. - Expanded Polars and pandas DataFrame schema support. Pyrefly tracks Polars schemas through common DataFrame transformations, with support for typed
Seriesand schema annotations. pandascolumns=projections now preserve the requested schema as well.
✨ New & Improved
Type Checking
- Pattern matching gained stronger exhaustiveness checking, including tuple subjects and open types such as unions. Open-type exhaustiveness now has its own configurable
non-exhaustive-match-open-typeerror kind. - Overload selection now follows the latest typing specification more closely, producing a safe common return type for gradual arguments and reducing false positives in complex overloads.
- Type inference and narrowing are more precise for membership tests, equality checks,
hasattr, wideLiteralunions, callable values, reverse tuple slices, and values assigned fromAny. - Dataclass fields backed by descriptors are now checked for incompatible read and write types under the new
bad-dataclass-descriptorerror kind. - String targets passed to
unittest.mock.patchare validated, with nonexistent attributes reported asmissing-attribute-patch-targetwarnings. - Literal regular expressions are checked for invalid patterns and capturing groups under the new
regexerror kind. - Django support now understands reverse
ForeignKey,OneToOneField, andManyToManyFieldrelationships in the same file, while Django REST Framework serializers avoid false override errors for commonMetaand field patterns. - SQLAlchemy
update().values()checks values against mapped model fields. - PyTorch modules recognize attributes registered through
register_bufferandregister_parameter.
Language Server
- Workspace symbol search now includes methods, nested classes, nested functions, and class attributes.
- Cross-file call hierarchy, type hierarchy, and find-references now work without first opening every relevant file.
- A new change-signature refactoring updates a function's parameters and its call sites together.
- New quick fixes remove unused imports and insert
assert x is not Nonewhen an optional value needs narrowing. - Inlay hints can add required imports, are clickable for navigation, and now handle callable objects, instance methods, positional arguments, and
**kwargs: Unpack[TypedDict]more accurately. - Rename and navigation are more reliable for relative imports, decorated functions, named dataclass and Pydantic arguments, operators, module paths in strings, and legacy type-parameter declarations.
- Custom
pyrefly.lspPathvalues now work correctly with Windows, home-relative, and workspace-relative paths. - LSP clients can provide
extraSearchPathsandextraProjectExcludesduring initialization, improving integration with editors that manage their own import paths and excluded directories. - Editors can display custom build-system activity and failures through the new
pyrefly/typeErrorDisplayStatusChangednotification.
Performance
- TSP now reuses analysis for unopened files instead of solving the same module for every request. In a captured Pylance session, 22,294 unopened-file
getComputedTyperequests fell from 668 seconds to 3.4 seconds, while total request time fell from 671 seconds to 6.4 seconds. - Unknown-name suggestions are dramatically faster in files with very large scopes. Pyrefly now skips suggestion work for diagnostics that will be discarded and rejects unlikely candidates before computing their full edit distance. A pathological internal case fell from 96.8 seconds to 0.62 seconds, while focused benchmarks improved by 15–1,390x.
Configuration & CLI
# type: ignore[pyrefly:<code>]comments suppress only the named Pyrefly diagnostic without hiding unrelated errors on the same line.- The new
type-ignore-unknown-tag-behavioroption controls how tags belonging to other tools affect Pyrefly diagnostics: they can have no effect, downgrade diagnostics to warnings, or retain the legacy blanket-suppression behavior. - The new
replace-untyped-imports-with-anyoption replaces selected installed third-party packages withAnywhen they provide neither stubs nor apy.typedmarker. pyrefly initautomatically translates mypy's global and per-modulefollow_untyped_importssettings to the new option.baseline-matching-modecan match diagnostics by their column or concise description, reducing churn when unrelated code moves.baseline-formatcan write full metadata or a minimal representation containing only the fields needed for matching.baseline-error-levelcan expose matched diagnostics atinfo,warn, orerrorseverity instead of hiding them, with baseline provenance included in text, JSON, SARIF, and summary output.--prune-baselineremoves stale entries without recording new errors, while--error-stale-baselinelets CI reject a baseline containing obsolete entries.- The opt-in
treat-all-caps-as-finaloption treats reassignment ofALL_CAPSnames as abad-assignment. - Projects can require a compatible Pyrefly version from
pyrefly.tomlusing a PEP 440 version constraint. - The new
python-interpreter-find-commandsetting supports custom interpreter discovery. - Multiple
--outputdestinations with different formats can be specified in one CLI invocation. - New documentation explains how to integrate Pyrefly with Pants through the
pants-pyreflyplugin.
Experimental Extensions
- A composable type-level DSL now describes tensor shape transformations, and the JAX, NumPy, and PyTorch stubs have migrated from the decorator-based V1 shape system to direct V2 signatures.
- Shape-aware JAX stubs now cover array creation, indexing, reductions, searching and sorting, FFT, linear algebra, einsum and other contractions, and most of
jax.lax. - The new
pyrefly-numpy-stubspackage brings shape-aware checking to NumPy alongside the existing PyTorch support. - The legacy
@shaped_arrayAPI has been removed; custom shape annotations must migrate toIntTuple-generic classes and the V2 DSL. - Polars DataFrame analysis now tracks schemas through construction,
select,with_columns,group_by().agg(), joins, CSV readers, and lazy/eager conversion, with typedSeries, nested and owned dtypes, and schema information from variables, calls, andTypedDicts. - PEP 593
Annotated[DataFrame, Schema(...)]supports exact and open schema contracts, while the newcolumn-schema-mismatchandduplicate-columnerrors catch invalid schemas and conflicting output columns before runtime. - pandas DataFrames built with
columns=now project their inferred schema onto the requested column set and order.
🐛 Bug fixes
We closed 88 bug issues this release 👏
- #3653: Eliminated exponential work when nested calls contain container literals by inferring shared expression subtrees once.
- #4678: Fixed pathological check times exceeding a thousand seconds on small files containing very long non-ASCII lines.
- #4437: Fixed a stack overflow crash when checking code with a recursive
__new__method. Pyrefly now detects direct recursive__new__targets. - #4459: Fixed a panic when a
NamedTuplewas defined inline inside amatchstatement. A dedicatedMatchSubjectbinding key now prevents collisions. - #4130: Star imports from
py.typedpackages installed insite-packagesnow recognize the package's public names as re-exports.
Thank you to all our contributors who found these bugs and reported them! Did you...
Pyrefly v1.3.0-dev.4
Release date: September 03, 2026
About dev releases
Dev releases (versions likeX.Y.Z-dev.N) are non-stable snapshots cut periodically from trunk. They give early adopters a chance to try in-progress features and surface issues before the next stable release, but they don't carry the same stability or compatibility guarantees as a stable release — don't pin production projects to a dev version.
Pyrefly v1.3.0-dev.4 bundles 198 commits from 23 contributors.
✨ New & Improved
Type Checking
- New composable type system primitives have been introduced for tensor shape types. See https://github.com/facebook/pyrefly/discussions/4807 for details.
- Overload selection now infers the most general return type assignable to all candidate return types when argument types are gradual.
Language Server
- Parameter-name inlay hints now align correctly for instance methods, skipping
selfand displaying hints for all user-visible parameters. - Incoming call hierarchy and find-references now preserve parameter references in unopened files by escalating only the necessary modules to full analysis.
- Semantic autocomplete now works correctly on lines preceding comments by handling CRLF-aware comment offsets.
- Go-to-definition for decorated functions now navigates to the original function definition instead of the decorator's
__call__method. - Workspace symbol search now includes class methods from project-indexed files, not just top-level exports.
Tensor Shape Support
- JAX, NumPy, and Torch stubs have migrated from the V1 shape DSL to type-level V2 signatures, removing decorator-based evaluation in favor of direct DSL calls.
Configuration
- The
replace-untyped-imports-with-anyflag and config option now replace imports from third-party packages missing stubs orpy.typedmarkers withAny, matching mypy'sfollow_untyped_importsbehavior. - Mypy's
follow_untyped_importssetting is now auto-migrated to the newreplace-untyped-imports-with-anyoption.
🐛 Bug fixes
We closed 15 bug issues this release 👏
- #4552: Fixed an issue where semantic autocomplete failed on lines immediately above comments due to incorrect CRLF-aware offset calculations.
- #4484: Stopped reporting
__tracebackhide__as an unused variable, since pytest reads it implicitly when formatting tracebacks. - #4611: Fixed parameter-name inlay hints being shifted by one position for instance-method calls, now correctly skipping
selfand aligning hints with actual parameters. - #4616: Allowed plain subclasses of slotted dataclasses to assign new attributes without triggering false
missing-attributeerrors, since slot enforcement no longer applies to subclasses that don't declare slots themselves. - #4626: Fixed bounded
type[T]calls with custom metaclass returns to only substitute the constructor result withTwhen the inferred return is compatible with the bounded class, preserving unrelated metaclass__call__return types. - #3265: Fixed
iter([0])to inferIterator[int]instead ofIterator[Any]by no longer using the genericAnybound fromiter's signature to infer list element types. - #4563: Made unresolvable
__all__state sticky across later mutations, soappend,extend, andremovecalls preserveDunderAllKind::Unresolvableand star imports continue using fallback behavior. - #3569: Improved decorator error messages to detect when a decorated function is missing an injected parameter and report a clearer message instead of a confusing callable type mismatch.
- #1493: Fixed confusing override errors when overriding an overloaded method by improving error messages to show all overload signatures instead of suggesting conflicting parameter names.
- #4686: Fixed
type(protocol_value)to producetype[Protocol]representing the unknown concrete runtime implementation, preventing falseinvalid-argumenterrors when used withisinstance. - And more! #4676, #4684, #263, #3812, #3993
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.3.0-dev.4How 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:
pyrefly check --suppress-errors- Run your code formatter of choice
pyrefly check --remove-unused-ignores- 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, @rchen152, @samwgoldman, @grievejia, @jakevdp, @asukaminato0721, @kinto0, David Tolnay, @connernilsen, @ndmitchell, @DarkNightForge, @cakeni, @nitishagar, @shobhitmehro, @Pager-dot, @tkim602, @NathanTempest, @anishfyi, @mangeshraut712, @jorenham, @alexander-beedie, @Pyxelate, @yangdanny97
Please note: These release notes summarize major updates and features. For brevity, not all individual commits are listed.