#26304·scipy

TYP: reduce pyrefly suppressions (116 inline ignores, blanket bad-override in stats)

Author: tschmCreated Sep 29, 2026Updated Oct 1, 2026

rhiza

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:

  1. 116 inline ignores outside tests/. The most common codes are missing-attribute (35), union-attr (17), bad-assignment (12) and unbound-name (6). 45 are still mypy-style # type: ignore comments (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.
  2. A blanket bad-override = "ignore" for scipy/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: ignore comments 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-attribute and union-attr are usually fixable with narrowing.
  • Track the stats bad-override count. 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/.