Skip to content

Switch from mypy to Pyrefly #8182

Description

@mhucka

Is your feature request related to a use case or problem?

A number of other projects are switching from mypy to Pyrefly for type checking Python code. We should do the same for Quantumlib projects if possible. Pyrefly is much faster than mypy and has better IDE support.

What solution or approach do you envision?

  1. Use Pyrefly's facility for creating a configuration based on an existing mypy configuration (using Cirq's current mypy configuration).
    • (Added 2026-07-22): make it ignore Jupyter notebook files
  2. Run Pyrefly to find and fix whatever problems it flags (or adjust the config to ignore certain ones deemed low-priority for now)
  3. Add a check/typecheck script (initially a copy of check/mypy) to replace check/mypy. Deprecate check/mypy so developers have an opportunity to switch.
  4. Replace the type check in CI with a Pyrefly-based one

How urgent is this for you?

P2 – needed within two quarters

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/healthFor CI/testing/release process/refactoring/technical debt itemsno QC knowledge neededWant to contribute to Cirq, but don't know quantum computing? This issue is for you.triage/acceptedA consensus emerged that this bug report, feature request, or other action should be worked on

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions