Repository navigation
Releases
pants-pyrefly 1.2.1
Pins Pyrefly 1.5.0 and makes it the default. No plugin code changes: the goals, [pyrefly] options, and skip_pyrefly field behave as before. Every version pinned in 1.2.0 is still pinned; to stay on the old default, set [pyrefly].version = "1.4.1".
- The default pinned Pyrefly is now 1.5.0 (was 1.4.1); 1.4.1 stays pinned. The newer Pyrefly changes what some builds report (see the Pyrefly 1.5.0 release notes):
- Warnings are printed by default, e.g. uses of deprecated APIs,
redundant-cast, andunnecessary-type-conversion. They do not change the exit code, sopants checkpasses or fails as before, andpants pyrefly-update-baselineandpants pyrefly-suppressignore them. To hide them, set[pyrefly].min_severity = "error". - Annotations look up names in the enclosing class body first, and uninitialized names and illegal circular references in annotations are now reported, which can surface errors 1.4.1 did not report.
unreachablenow defaults to the new IDE-onlyhintseverity (waswarn), so it no longer appears inpants checkoutput unless configured as"warn"or"error".
- Warnings are printed by default, e.g. uses of deprecated APIs,
pants-pyrefly 1.2.0
Adds support for Python 3.15 projects and makes Pyrefly 1.4.1 the default. No breaking changes: the goals, [pyrefly] options, and skip_pyrefly field behave as before, and every version pinned in 1.1.1 is still pinned. To stay on the old default, set [pyrefly].version = "1.4.0".
- Python 3.15 projects are supported on Pants 2.31 and newer, once
"3.15"is added to[python].interpreter_versions_universe(no Pants release includes it yet). The compatibility suite now checks aCPython==3.15.*project. On Pants 2.27–2.30, the pex that Pants bundles cannot run on Python 3.15, so Pants fails before Pyrefly runs. - The
[pyrefly].interpreter_constraintsfallback, used only for a target with no interpreter constraints of its own, is nowCPython>=3.9,<3.16(was<3.15). - The default pinned Pyrefly is now 1.4.1 (was 1.4.0); 1.4.0 stays pinned. The release notes list changes only to
pyrefly coverage(see the Pyrefly 1.4.1 release notes), sopants checkshould report the same errors, butpants pyrefly-coveragecan report a different percentage: results are now the same on every run, functions and classes excluded with@type_check_onlyor@no_type_checkare no longer counted as untyped variables, and a variable assigned an explicitly parameterized constructor call (x = set[int]()) counts as typed.
pants-pyrefly 1.1.1
Pins Pyrefly 1.4.0 and makes it the default. No plugin code changes: the goals, [pyrefly] options, and skip_pyrefly field behave as before. Every version pinned in 1.1.0 is still pinned; to stay on the old default, set [pyrefly].version = "1.3.2".
- The default pinned Pyrefly is now 1.4.0 (was 1.3.2). The newer Pyrefly changes what some builds report (see the Pyrefly 1.4.0 release notes):
- Stricter checks on by default can surface errors 1.3.2 did not report, e.g. TypeVar bounds and constraints are now enforced when the expected type contains
Any, and@propertygetters with extra required parameters are flagged. Many false positives are also fixed, so some# pyrefly: ignorecomments and baseline entries may become unused. - Renamed error kind.
incompatible-overload-residualis nowincompatible-overload-argument. Pyrefly keeps the old name as a deprecated alias. --typeshed-pathreplaces the bundled typeshed instead of overlaying it. This matters only if you pass it through[pyrefly].args.- New opt-in error kinds (
unknown-attribute-access,unknown-return-type,untyped-function-decorator,uninitialized-instance-variable, and others) are off unless you enable them in[errors].
- Stricter checks on by default can surface errors 1.3.2 did not report, e.g. TypeVar bounds and constraints are now enforced when the expected type contains
pants-pyrefly 1.1.0
pants check no longer rebuilds the third-party venv on every Pyrefly run, which on a large lockfile was most of its time. Pyrefly now gets one config for every file it loads. Every stable Pyrefly from 1.1.1 is pinned, and the default is now 1.3.2. No breaking changes: the goals, [pyrefly] options, and skip_pyrefly field behave as before. Some diagnostics can change, from the newer default Pyrefly and from the config handling; the entries below say when.
-
Every stable Pyrefly from 1.1.1 up to the default is now pinned: 1.1.1, 1.2.0, 1.2.1, 1.3.0, 1.3.1, and 1.3.2. Select any of them with just
[pyrefly].version = "..."; noknown_versionsoverride is needed. Existingversion = "1.1.1"or"1.2.0"pins keep working after upgrading the plugin. (The 1.0.0 entry's advice to pin1.1.1did not actually work on 1.0.0, which pinned only 1.2.0; it works as of this release.) See Supported Pyrefly versions for the policy. -
The default pinned Pyrefly is now 1.3.2 (was 1.2.0). No plugin behavior changes, but the newer Pyrefly changes what some builds report:
- Renamed error kind. The dataclass-field-assigned-an-inconsistent-data-descriptor error that 1.2.0 reported as
bad-class-definitionisbad-dataclass-descriptorin 1.3. Anything that names the old kind stops matching it under 1.3.x: 1.2.0-era baseline entries,# pyrefly: ignore[bad-class-definition]comments (including onespants pyrefly-suppresswrote),[pyrefly].only, and[errors]settings in your Pyrefly config. Under the no-configbasicpreset, 1.3.2 does not report this error at all. - New diagnostics can surface errors 1.2.0 did not report, e.g. invalid literal regular expressions (
regex). Which ones fire depends on your config:regexis reported when a Pyrefly config file is in effect, but not under thebasicpreset. Invalidmock.patchtargets are reported as warnings (missing-attribute-patch-target), which the defaulterrorseverity hides. Open-type match exhaustiveness (non-exhaustive-match-open-type) is off unless you enable it in[errors]. The summary line now also counts hidden warnings (INFO 2 errors (… 1 warning not shown)). - Compact baseline format.
pants pyrefly-update-baselinenow writes entries withpath,column,name,concise_description, andseverity, and dropsline,stop_line,stop_column,code, anddescription, so regenerating a committed baseline rewrites the whole file once. 1.3.x still honors existing full-format baselines, except entries for the renamed kind above. The change is one-way: a baseline written by 1.3.x does not suppress anything under older Pyrefly, so regenerate it after pinning back. # type: ignore[<code>]comments carrying another tool's codes (e.g. a MyPy code) still suppress everything on the line, as before. 1.3 adds# type: ignore[pyrefly:<code>]for targeted suppression.
- Renamed error kind. The dataclass-field-assigned-an-inconsistent-data-descriptor error that 1.2.0 reported as
-
Removed Pyrefly versions now fail with a reason. A version is removed from the pins only deliberately, with the reason recorded in
DENYLISTED_VERSIONS(insubsystems.py) and a CHANGELOG note. Selecting one with[pyrefly].versionfails withDenylistedPyreflyVersion: Pyrefly X is not supported by pants-pyrefly: <reason>. Set [pyrefly].version to a supported release (<default>).instead of Pants's genericUnknownVersion. Supplying your own[pyrefly].known_versionsentry for it still works. The denylist is empty in this release. -
Fixed: Pyrefly 1.3's baseline flags in
[pyrefly].args.--error-stale-baselinenow works. Before, every partition received the whole merged baseline. Inside a partition's sandbox, entries for files checked by other partitions point at paths that do not exist, so Pyrefly reported them as stale.checkthen failed every partition even when nothing was stale, and also failed when checking a subset such aspants check src/a::. Each partition now gets only the entries for its own files. A truly stale entry fails only the partition that checks its file. Entries for deleted files are still reported as stale, once per run, by the first partition, so a subset run can fail on them too. Without the flag, the same errors are gated as before; an entry only ever matched errors in its own file.- Known limitation: baseline entries are keyed by path only. A file checked by several partitions (e.g.
parametrizeover interpreter constraints) with an error in only some of them keeps failing--error-stale-baseline. Use an inline# pyrefly: ignore[<error-kind>]for such errors. See the README. pants pyrefly-update-baselineignores--error-stale-baseline. Before, it failed with exit code 2, because Pyrefly rejects the flag alongside--update-baseline.--prune-baselinenow fails fast.checkandpyrefly-update-baselineexit with aPyreflyArgsErrorthat namespants pyrefly-update-baseline ::. Before,checkpassed and the baseline file was silently left unchanged, because Pyrefly pruned a temporary copy in the sandbox;pyrefly-update-baselinefailed with exit code 2. Whencheckfails on stale entries, Pyrefly's "rerun with--prune-baseline" hint now says to runpants pyrefly-update-baseline ::instead. The README now warns that update-baseline rewrites the whole file from only the targets given, so a subset run drops all other entries.
-
Missing-import hints now name your real source roots. Pyrefly's
Looked in these locationshint listed the plugin's internal sandbox directories, e.g.Search path override (from command line): ["__pyrefly_root_0", "__pyrefly_root_1"]. It now lists the source roots they stand for, e.g.[".", "src/python"](.is the build root), in every[pyrefly].output_format, with or without--color=always. The same applies to thedescriptionfield of baselines written bypants pyrefly-update-baselineunder Pyrefly older than 1.3, which also recorded the absolute sandbox path and so changed on every regeneration; regenerate such a baseline once to clean it up. Gating is unaffected, since Pyrefly does not match baseline entries ondescription. Only the internal names the plugin generated for that run are rewritten, and only as whole path segments, so user code or messages that merely contain such a name are left alone. -
Fixed: every Pyrefly run rebuilt the third-party venv. Pyrefly finds your third-party packages through a venv that Pants keeps in its shared
pex_rootnamed cache. The plugin did not mount that cache into Pyrefly's sandbox, so each Pyrefly process (checkand thepyrefly-*goals that read your third-party packages) rebuilt the whole venv before Pyrefly started, even when nothing had changed. The rebuild time grows with the size of the resolve; with a large lockfile it was most of the timepants checkspent. The venv is now built once and reused, as it is for Pants' own Python tools. A CI runner that starts with an empty named-caches directory still builds it once per run.Because the venv now lives outside the sandbox, the plugin also passes your discovered config (
pyrefly.toml, orpyproject.tomlwith[tool.pyrefly];pyrefly.tomlwins if both exist, as in Pyrefly) to Pyrefly as--config, as it already did for[pyrefly].config. Pyrefly then uses that one config for your code and your third-party packages, aspyrefly checkdoes in project mode and as Pyrefly's Bazel and Buck integrations do, so third-party packages are still analyzed with your config. A discovered config now behaves exactly like one set with[pyrefly].config, which changes three edge cases:disable-project-excludes-heuristics = trueis now honored: files Pants passes in undervenv/,node_modules/or__pycache__/directories are checked, instead of skipped with aSkipping include patternwarning.- A config that fails to parse is a fatal error, instead of Pyrefly printing the parse error and checking with defaults.
- A third-party package that ships its own
pyrefly.tomlor[tool.pyrefly]is analyzed with your config instead of its own.
A
--configor-cin[pyrefly].argsstill replaces the plugin's, since Pyrefly rejects a repeated--config.If the plugin finds no config to pass (no root
pyrefly.tomlor[tool.pyrefly], orconfig_discovery = falsewithout[pyrefly].config), it passes a generated one holding what Pyrefly uses when it finds none,preset = "basic". Pyrefly no longer searches for a config per file, so no config outside your repo applies: before, a Pyrefly, mypy or pyright config in a directory above Pants' sandbox could apply to your files, and one above Pants' cache (such as your home directory) to third-party packages. Visible changes for projects without a config:- Third-party packages that ship a
mypy.iniorpyrightconfig.jsonare analyzed with thebasicpreset instead of a config Pyrefly converted from theirs, so code that uses them can report errors it did not before. Pyrefly's warnings about converting those files (e.g.Invalid search-path: .../site-packages/<package>/...) are gone. - Pyrefly's "No
pyrefly.tomlfound — using presetbasic" notice no longer appears. Runpants pyrefly-initto create a config. pants pyrefly-dump-configshows the generated config (preset = "basic", at__pyrefly_config.tomlin the sandbox) instead of Pyrefly's default configuration.
-
Releases are now gated on a Pyrefly compatibility suite (
build-support/ci/compat_test.sh, run by.github/workflows/compat.ymlfor every supported version). It drives real Pants runs ofcheck,pyrefly-update-baseline, andpyrefly-suppresswith only--pyrefly-versionset, and asserts that the requested Pyrefly binary is the one that ran. It also runs the default Pyrefly on the latest patch of every supported Pants minor: 2.27.1, 2.28.1, 2.29.1, 2.30.2, 2.31.0, 2.32.1,...
pants-pyrefly 1.0.0
First stable release. No breaking changes from 0.5.0 — the goals, [pyrefly] options, and skip_pyrefly field all behave as they did; the bump declares the surface stable rather than changing it. See Stability for what the compatibility promise now covers and what stays an implementation detail.
- Pants 2.33 is supported. The consumption smoke-test matrix now covers 2.27, 2.31, 2.32, and 2.33, so the version-conditional rules-API shim is verified on the current Pants line.
- The default pinned Pyrefly is now 1.2.0 (was 1.1.1). Pin the old one with
[pyrefly].version = "1.1.1"if a new Pyrefly release changes what your build reports. - Documented how import resolution actually works as of 0.5.0: the README described only the 0.4.0 nearest-root dedup, which
checkandpyrefly-suppressno longer use — they re-stage each source root into an isolated sibling directory instead. The diagnostic goals (pyrefly-coverage,pyrefly-dump-config,pyrefly-lsp-config) still pass nearest-root-deduped real source roots.
pants-pyrefly 0.5.0
- Nested source roots no longer produce spurious duplicate-module errors, even when the ancestor root is one that a file genuinely roots at (e.g. the build root
.when a top-levelscripts/ortools/package lives there).checknow re-stages each source root's files into an isolated, non-nesting synthetic directory before invoking Pyrefly and passes--disable-search-path-heuristics, so every file is reachable under exactly one module identity regardless of how[source] root_patternsnest or how the dependency graph is shaped. This generalizes the 0.4.0 nearest-root dedup, which could only drop an ancestor root that no file needed — it could not fix a repo where first-party code roots at both an ancestor and a descendant (the common.-plus-src/pythonlayout), leaving those errors to a baseline. Pyrefly's synthetic output paths are mapped back to real repo paths in diagnostics, thepants pyrefly-update-baselinefile, andpants pyrefly-suppressedits. pants pyrefly-update-baselineandpants pyrefly-suppressre-stage the same way, so a regenerated baseline no longer records the spurious errors andsuppressno longer inserts# pyrefly: ignorecomments for them.
pants-pyrefly 0.4.0
- Nested/overlapping Pants source roots are now deduplicated before being passed to Pyrefly as
--search-path(applies tocheck, the goals, andpants pyrefly-lsp-config). Previously, a repo with bothsrcandsrc/pythonin[source] root_patternsmade every module under the nested root reachable under two names (pkg.modandpython.pkg.mod), which Pyrefly reported as spurious duplicate-module / "not assignable to itself" errors. The plugin now emits only each file's nearest source root; a redundant ancestor root is dropped, and a genuine layout collision (first-party code living directly under both an ancestor and a nested root) is surfaced as a warning. - New advanced option
[pyrefly].exclude_source_rootsto force-drop specific source roots from the search path, for the rare case the automatic dedup should keep one but you don't want it.
pants-pyrefly 0.3.0
pants pyrefly-initbootstraps a Pyrefly config for the repo (wrapspyrefly init), migrating an existing MyPy or Pyright configuration when one is found.--pyrefly-init-migrate-from=<auto|mypy|pyright>selects the source. It refuses to overwrite an existing config.pants pyrefly-dump-configprints the effective Pyrefly configuration Pants assembles for the targeted sources (first-partysearch-paths, the resolved interpreter, and the config file in effect) by running Pyrefly'sdump-configsubcommand. Diagnostic only — it does not type-check.- Pyrefly version pins (
default_known_versions) are now generated bybuild-support/bin/generate_known_versions.pyinstead of being hand-edited: it fetches each asset's published.sha256and size from the GitHub release. Bump with--version <new> --write; CI runs--checkto fail if the committed pins drift from the release.
pants-pyrefly 0.2.0
pants pyrefly-suppressinserts inline# pyrefly: ignorecomments for the current errors in the targeted sources (wraps Pyrefly'ssuppress);--pyrefly-suppress-remove-unusedstrips stale ones. The inline-comment alternative to the baseline for incremental adoption.- Lowered the published wheel's floor to
Requires-Python: >=3.11(was>=3.12), so one wheel installs into every supported Pants — 2.27 (CPython 3.11) through 2.32 (CPython 3.14) — and added per-version Python trove classifiers (3.11–3.14). - Added a MyPy→Pyrefly migration guide (
docs/migrating-from-mypy.md). - CI now runs a consumption smoke-test matrix across Pants 2.27/2.31/2.32 (proving the version shim on every line), plus tests for lsp-config pyproject protection,
[pyrefly].only, and the tool-failure exit path.
pants-pyrefly 0.1.0
Initial release.
- Run Pyrefly (default
1.1.1) as a Python type checker in the Pantscheckgoal. - Download the official prebuilt Pyrefly binary per platform (macOS arm64/x86_64, Linux arm64/x86_64 musl), pinned by SHA256.
- First-party import resolution via
--search-path, third-party resolution via a materialized requirements venv (--python-interpreter-path). [pyrefly]subsystem options (skip,args,output_format,extra_type_stubs,config,config_discovery,version, …) and a per-targetskip_pyreflyfield.extra_type_stubsinjects stub-only packages into the environment Pyrefly inspects; an explicit[pyrefly].configpath is passed through to Pyrefly via--config.- The list of files to check is passed to Pyrefly via an argfile, so large targets never hit OS command-line length limits.
- Incremental adoption:
[pyrefly].baselinemakescheckreport only errors new since the baseline, and thepants pyrefly-update-baselinegoal records/refreshes that baseline file. pants pyrefly-lsp-configwrites Pants's source roots intopyrefly.tomlassearch-path, so the Pyrefly editor/LSP resolves first-party imports the way Pants does.- Triage controls
[pyrefly].min_severityand[pyrefly].only; andchecknow flags a Pyrefly tool failure (an exit code other than 0/1) distinctly from ordinary type errors. pants pyrefly-coveragereports overall type coverage (% of typable symbols typed), with an optional--pyrefly-coverage-fail-underthreshold to ratchet/gate it.- Supports Pants
2.27–2.32from a single codebase, via version-conditional imports for the rules-API change at 2.29 (coarsened_targets→resolve_coarsened_targets) and theCheckSubsystem.default_process_cache_scopeaddition at 2.32. Verified on 2.27 and 2.32. - The published wheel is pure-Python (
Requires-Python: >=3.12) and carries nopantsbuild.pantsdependency (Pants provides itself at runtime, and is no longer on PyPI). It installs into any Pants on CPython 3.12+ (Pants 2.27, on CPython 3.11, uses the from-source install). Verified end-to-end via aplugins=["… @ file://…whl"]install.