Sourced from pyrefly's releases.
Pyrefly v0.61.1
Full Changelog: https://github.com/facebook/pyrefly/compare/0.61.0...0.61.1
Pyrefly v0.61.0
Status : BETA Release date: April 13, 2026
Pyrefly v0.61.0 bundles 85 commits from 21 contributors.
✨ New & Improved
Area What's new Type Checking - Division, floor division, and modulo operations with a literal zero divisor (e.g., x / 0,y // 0,z % 0) are flagged as errors, catching runtimeZeroDivisionErrorbefore execution. - Multiple inheritance with conflicting__slots__definitions is detected and reported as an error, matching CPython's runtime behavior and preventing layout conflicts. - Protocol members assigned a value without an explicit type annotation (e.g.,x = Nonein aProtocolclass body) are flagged as errors, ensuring protocol members have declared types as required by the typing specification.Language Server - Variables used exclusively within f-string format specifiers (e.g., f"{key:<{max_len}}") are correctly recognized as used, eliminating false positive unused-variable warnings. - The VS Code extension explicitly declares workspace trust capabilities, requiring trusted workspaces to run and allowing machine-overridable scope forlspPathandlspArgumentssettings for improved security.Coverage Reporting - The pyrefly reportcommand now excludes some dunder methods and typing-only constructs from coverage metrics. - Per-module JSON output includes entity counts (n_functions, n_methods, n_function_params, n_method_params, n_classes, n_attrs, n_properties, n_type_ignores) for downstream consumers. - A new--module <name>CLI flag allows overriding the module name in JSON output, supporting callers that need canonical package names instead of filesystem-derived names.Pydantic - Pydantic lax conversion special-cases regex patterns, fixing false positives when passing compiled patterns to Pydantic models. Performance - Fixed a bug in overload evaluation that caused exponential memory consumption and indefinite hangs on code with many overloaded calls.
🐛 bug fixes
We closed 9 bug issues this release 👏
- #3031: Fixed a crash in mypy_primer caused by a variable leak in
LitEnum— types are now deep-forced before storage to prevent leaking vars into the solver.- #2915: Division, floor division, and modulo by literal
0are now flagged as errors, catchingZeroDivisionErrorat static analysis time instead of runtime.- #3009: Fixed false positive unused-variable warnings for variables used exclusively within f-string format specifiers (e.g.,
f"{key:<{max_len}}"). The AST visitor now correctly descends intoformat_specnodes.- #2799: Fixed false positive
[missing-attribute]errors fordict.setdefault(key, []).append(val)on unannotated dicts. Overload resolution now creates fresh partial variables for each overload, preventing incorrect pinning.- #2991: Fixed Pydantic lax-mode rewriting
re.Pattern[str]toPattern[LaxStr]and rejectingre.Pattern[str]. Regex patterns now expand tore.Pattern[T] | Tinstead of recursively widening the inner type.- #2916: Fixed runtime
TypeErrorfrom multiple inheritance with conflicting__slots__(same slot names). Pyrefly now detects and reports this layout conflict during class metadata computation.- #2917: Fixed runtime
TypeErrorfrom multiple inheritance with conflicting__slots__(different slot names). Pyrefly now detects non-empty__slots__in multiple bases and reports the conflict.- #3064: Fixed false positive when using
issubclass()afterisinstance()narrowing with custom metaclasses (e.g., Django'sModelBase). Metaclass instances are now correctly accepted as valid class objects.- #3030: Fixed false positive
LiteralStringtype error inmap(str.strip, ...). Overloads with narrowerself-type annotations are now filtered out during unbound method resolution.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.61.0How to safely upgrade your codebase
... (truncated)
582ad83
Bump Pyrefly version to 0.61.1b71ef04
Bump icu_decimal 2.1.1 -> 2.2.0526415a
Update vendored wasm-bindgen to 0.2.1182335601
Keep specialization errors arising from hints to overloaded calls73b8f63
Use with_snapshot for is_subset_eq on unionsce37688
Take instantiation errors into account in
Subset::with_snapshote2e3874
Add Solver::has_new_instantiation_errors251ccae
Check for key in instantiation_errors before removing
it2d69b92
Reduce code repetition in is_subset_eq union case2f6fa7a
Restore var state after failed Quantified checks in is_subset_eq