Skip to content

[CI]: Use Pyright instead of MyPy for Type Checking #1061

@CyanVoxel

Description

@CyanVoxel

Checklist

  • I am using an up-to-date version.
  • I have read the documentation.
  • I have searched existing issues.

Description

This has been discussed privately for a while or mentioned here and there, but I wanted to establish a coordinated intention to replace MyPy with Pyright as the project's static type checker. As the project has grown, MyPy has suffered from worsening performance that's impacted development and slowed down the CI workflows.

Solution

Pyright is a more performant option, which also provides several improved checks that MyPy does not offer. The pyproject.toml has already included rules for Pyright that has been continuously tweaked over the past few months to suit the needs of the project.

The reason why there hasn't been a switch so far (besides dialing the Pyright rules) is because much of the existing codebase does not adhere to the new rules yet and would require substantial refactoring. Much of the codebase has already been undergoing these sorts of refactors, and new code has been loosely enforcing these rules for quite a while now.

ANY REFACTORS SHOULD NOT BE MADE IN BULK and should instead be made in small PRs targeting specific files or small related groups of files. Large refactors are significantly more likely to cause conflicts with other open PRs and take significantly longer to review.

Alternatives

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: CIContinuous Integration / workflowsType: EnhancementNew feature or requestType: RefactorCode that needs to be restructured or cleaned up

    Type

    Projects

    Status

    🚧 In progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions