Skip to content

[Tracking Issue] Remove type: ignore comments from Python code #5138

@khvn26

Description

@khvn26

Background

As part of #5111 and #5119, we introduced mypy type checking to our CI pipeline. We now have ~5000 type: ignore comments scattered throughout the codebase that need to be properly addressed.

The goal of this issue is to track the gradual removal of these type: ignore comments by improving type coverage while maintaining correctness.

How you can help

We welcome contributions from the community! To ensure smooth collaboration and manageable reviews, please follow these guidelines when submitting PRs:

Reference this issue

In your PR description, reference this issue (#5138) so we can track overall progress.

Scope your PRs

Avoid submitting a massive PR that removes hundreds of type: ignore comments at once. Instead, focus on a specific module, feature, or component.

Keep PRs meaningful

Each PR should aim to properly type the affected code, not just remove the type: ignore comments blindly.

Follow example PRs

#5126 is a good example of a well-scoped PR that fixes mypy exclusions.

Run tests

Ensure that your changes pass mypy, unit tests, and linters. Use the following tools:

  • make test to run the test suite.
  • make typecheck to run mypy.
  • pre-commit install to run the linters automatically for your commits. Refer to pre-commit quickstart guide for installation instructions.

How to get started

  • Find a type: ignore comment in the codebase (search for # type: ignore).
    • Tip: a # type: ignore[no-untyped-def] comment is the most common one, and usually the most straightforward to fix — it denotes missing typing annotations.
  • Analyse why it was added (e.g., missing annotations, incompatible types).
  • Properly fix the typing issue rather than just removing the comment.
  • Verify your changes by running pre-commit and make test.
  • Open a PR referencing this issue ([Tracking Issue] Remove type: ignore comments from Python code #5138).

Questions?

If you're unsure about a specific change, feel free to open a discussion or ask in this issue!

🚀 Happy typing! 🚀

Sub-issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    apiIssue related to the REST APIimprovementImprovement to the existing platformpythonPull requests that update Python code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions