Skip to main content
Pyrefly LogoPyrefly Logo

Catch bugs before you run your code

$ pip install pyrefly && pyrefly init
  • Improve code quality at your own pace

    Set a preset in the [tool.pyrefly] section of your pyproject.toml to control how many errors you get. More info in the preset docs.

    • preset = "basic"

      Best for newcomers to type checking

      Catch only the most obvious errors and ignore everything else.

    • preset = "default"

      Best for most projects, most of the time

      You annotate where it helps and want those annotations properly checked.

    • preset = "strict"

      Best for libraries and shared code

      Other people depend on your type correctness, so no implicit Any and no missing @override

    Performance Comparison

    Type checking the PyTorch codebase from scratch.Tested using Macbook
    (10 cores: 8 performance + 2 efficiency cores, 32 GB RAM)
    PyreflyCommand: "pyrefly check"
    Pyrefly uses as many threads as possible
    0.0s
    PyrightCommand: "pyright --threads=8"
    8 threads yielded the best performance after testing multiple settings
    0.0s
    MyPyCommand: "dmypy run"
    0.0s

    See Pyrefly in Action