Skip to content

Conversation

@rchen152
Copy link
Contributor

This PR switches the type checker for helion from pyright to pyrefly. Benefits of switching:

  • Faster local type checking: in testing on my machine, a full check with pyright takes about 25s, while a full check with pyrefly takes <2s [1].
  • Faster CI: the pre-commit step of lint.yml currently takes about 30s to run [2]; a run on this PR took only 16s [3].
  • Fewer error suppressions: helion previously needed 405 # pyright: ignore directives; only 340 # pyrefly: ignore directives are needed.

The bulk of this PR is a mechanical removal of pyright suppressions and addition of pyrefly suppressions. The interesting changes are:

  • rchen152@1528287 changes the type checker from pyright to pyrefly.
  • rchen152@b718906 adds some type annotations to help pyrefly and removes some typing.cast calls that are no longer needed.
  • rchen152@a085515 removes some search paths that pyright was using (?) that pyrefly can't find.

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 17, 2025
Copy link
Contributor

@oulgen oulgen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also update agents.md


- repo: https://github.com/RobertCraigie/pyright-python
rev: v1.1.407
- repo: https://github.com/facebook/pyrefly-pre-commit
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we use the pyrefly with the version in the config? i think @lolpack added something?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried switching to the second option here that's supposed to let you specify the version, but I couldn't get it to work. Pyrefly starts producing a lot of import errors (on torch, triton, etc.) that suggest it's no longer able to find dependencies.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I opened an issue against pyrefly-pre-commit: facebook/pyrefly-pre-commit#7.

@oulgen oulgen merged commit d97c978 into pytorch:main Nov 18, 2025
16 checks passed
@rchen152
Copy link
Contributor Author

Woohoo! @oulgen thanks for the speedy review

@rchen152 rchen152 deleted the pyrefly branch November 18, 2025 00:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants