You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like to propose adding Pyrefly for typechecking - it could either be added alongside mypy or migrated entirely. Happy to open the PR, just checking here first to to see if there's interest. For transparency I work on the Pyrefly team, I came across this project while investigating the performance of mypy vs Pyrefly on real repos and it looked like it could be a good fit :)
I did some initial investigation, running locally mypy 2.3.0 vs Pyrefly 1.1.1:
Checker
Cold run
Warm run
mypy strict
9.2 s
0.28 s (.mypy_cache)
Pyrefly
0.6 s
0.32 s
~15× faster cold, and Pyrefly stays sub-second with no separate cache step required
How to make the switch:
Add the dependency to [tool.poetry.group.typing.dependencies]: pyrefly = ">=1.1.1".
Add [tool.pyrefly] config mirroring the existing [tool.mypy] config:
There are some differences between the errors pyrefly catches and what mypy does (38 new errors from what I can see running locally, details below), so we could either ignore them (# pyrefly: ignore [code]) for now or see if there are genuine issues to address. If we opt for removing mypy we could also remove ~30 mypy ignores that pyrefly doesn't complain about.
Wire into CI in .github/workflows/.tests-matrix.yaml, mirroring the mypy job
with a run pyrefly check step. Suggest starting non-blocking, then flipping to
required once you're comfortable.
Error differences - Mypy vs Pyrefly
When I compared pyrefly and mypy output, I found 38 new errors from Pyrefly that aren't flagged by Mypy:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
I'd like to propose adding Pyrefly for typechecking - it could either be added alongside mypy or migrated entirely. Happy to open the PR, just checking here first to to see if there's interest. For transparency I work on the Pyrefly team, I came across this project while investigating the performance of mypy vs Pyrefly on real repos and it looked like it could be a good fit :)
I did some initial investigation, running locally mypy 2.3.0 vs Pyrefly 1.1.1:
strict.mypy_cache)~15× faster cold, and Pyrefly stays sub-second with no separate cache step required
How to make the switch:
Add the dependency to
[tool.poetry.group.typing.dependencies]:pyrefly = ">=1.1.1".Add
[tool.pyrefly]config mirroring the existing[tool.mypy]config:There are some differences between the errors pyrefly catches and what mypy does (38 new errors from what I can see running locally, details below), so we could either ignore them (
# pyrefly: ignore [code]) for now or see if there are genuine issues to address. If we opt for removing mypy we could also remove ~30 mypy ignores that pyrefly doesn't complain about.Wire into CI in .github/workflows/.tests-matrix.yaml, mirroring the mypy job
with a run pyrefly check step. Suggest starting non-blocking, then flipping to
required once you're comfortable.
Error differences - Mypy vs Pyrefly
When I compared pyrefly and mypy output, I found 38 new errors from Pyrefly that aren't flagged by Mypy:
missing-attributewinreg/windll) checked on non-Windows (pyrefly doesn't narrowsys.platform); 5 = descriptor/mock/stdlib-API patternsunbound-namebad-overridebad-assignmentbad-argument-type→Term`, etc.)bad-override-mutable-attributebad-returnunsupported-operation__setitem__(BaseSpec)bad-indexEntryPointsAll reactions