TYP: reduce pyrefly suppressions (116 inline ignores, blanket bad-override in stats)
Author: tschmCreated Sep 29, 2026Updated Oct 1, 2026
pyrefly check (1.1.1, pyrefly.toml) is clean on main: 0 errors, but 128 suppressed. The clean result rests on two kinds of suppression:
- 116 inline ignores outside
tests/. The most common codes aremissing-attribute(35),union-attr(17),bad-assignment(12) andunbound-name(6). 45 are still mypy-style# type: ignorecomments (some with mypy codes such as[assignment]and[attr-defined]), and 76 are# pyrefly: ignore. The mypy-style ones may be leftovers from before the switch to pyrefly. - A blanket
bad-override = "ignore"forscipy/stats/**(pyrefly.toml, sub-config). The comment there counts about 960 such errors, mostly from Liskov violations in the distribution classes.
tests/ is also excluded entirely (project-excludes = ["scipy/*/tests/**"]).
Proposal
- Check which mypy-style
# type: ignorecomments are still needed, remove the stale ones, and convert the rest to# pyrefly: ignore[...]with pyrefly's error codes. - Work through the inline ignores one subpackage at a time.
missing-attributeandunion-attrare usually fixable with narrowing. - Track the
statsbad-overridecount. Once it's small, narrow the sub-config from the whole package to the files that still need it.
Done when no mypy-style ignores remain, the inline ignore count is going down, and the stats bad-override suppression covers specific files rather than the whole package.
Related: #21614 (typing roadmap).
Subcategory: type safety (8 → 9). Found by a repo quality scan; counts from pyrefly check and grep -rE '#\s*(pyrefly|type): *ignore' scipy --include='*.py', excluding tests/.
Source: scipy/scipy