Skip to content

Add pyrefly as a type checker in pre-commit and dev dependencies#387

Merged
patrick-kidger merged 1 commit into
patrick-kidger:mainfrom
lolpack:pyrefly-check
Apr 23, 2026
Merged

Add pyrefly as a type checker in pre-commit and dev dependencies#387
patrick-kidger merged 1 commit into
patrick-kidger:mainfrom
lolpack:pyrefly-check

Conversation

@lolpack

@lolpack lolpack commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds https://github.com/facebook/pyrefly (v0.62.0) as a third type checker alongside pyright and mypy, scoped to test/types/
  • Adds pyrefly to the dev dependency group in pyproject.toml
  • Adds a pyrefly pre-commit hook in .pre-commit-config.yaml

Motivation

Pyrefly is a new Rust-based Python type checker from Meta. Benchmarking against the existing checkers on test/types/ shows significant speed improvements:

Checker Avg (5 runs)
mypy (cold) 5.34s
mypy (warm) 0.41s
pyright 0.48s
pyrefly 0.18s

All existing hooks continue to pass. Pyrefly runs cleanly on test/types/ with no configuration needed.

Test plan

  • uv run pyrefly check test/types/ - 0 errors
  • uv run prek run --all-files - all 11 hooks pass (including new pyrefly hook)
  • Benchmarked 5 cold/warm runs per checker to confirm performance numbers

@patrick-kidger patrick-kidger merged commit 1e79d13 into patrick-kidger:main Apr 23, 2026
2 checks passed
@patrick-kidger

Copy link
Copy Markdown
Owner

Sounds good to me! Thanks for the contribution :)

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.

2 participants