Skip to content

chore: faster and stricter mypy - #2968

Open
henryiii wants to merge 2 commits into
pypa:mainfrom
henryiii:henryiii/chore/mypyspeed
Open

chore: faster and stricter mypy#2968
henryiii wants to merge 2 commits into
pypa:mainfrom
henryiii:henryiii/chore/mypyspeed

Conversation

@henryiii

@henryiii henryiii commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

I'm not sure it's possible to reuse a wheel in pyodide, but it was a logical bug anyway.

馃 AI text below 馃

Two mypy changes:

  • native_parser = true, which makes mypy about 26% faster from a cold cache.
  • More error codes, including possibly-undefined and exhaustive-match, plus fixes for everything they report.

Two of the fixes are real bugs:

  • Pyodide set built_wheel instead of repaired_wheel when it reused a compatible wheel, so the test step failed with a NameError.
  • The OCI container read loop had no EOF guard, so it looped forever if the container shell exited.

bashlex has no stubs, so no-any-unimported is disabled for cibuildwheel.bashlex_eval only.

This makes mypy around 26% faster from a cold cache.

Signed-off-by: Henry Schreiner <henryfs@princeton.edu>
Turn on possibly-undefined, exhaustive-match, and other strict flags, and
fix what they report. Two real bugs: pyodide never set `repaired_wheel`
when it reused a compatible wheel, so the test step failed with a
NameError; the OCI shell read loop spun forever if the shell exited.

Assisted-by: ClaudeCode:claude-opus-5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant