Flagsmith / Flagsmith/flagsmith
[Tracking Issue] Remove `type: ignore` comments from Python code
- Dominant language
- Python
- Stars
- 6.6k
- Forks
- 567
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 121
Description
## 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](https://pre-commit.com/#quick-start) 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 (#5138).
## Questions?
If you're unsure about a specific change, feel free to open a discussion or ask in this issue!
🚀 Happy typing! 🚀
Contributor guide
Assessment
This issue has not been assessed yet.