-
Notifications
You must be signed in to change notification settings - Fork 933
Add mypy type checking to CI/CD #2123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
🎉 All Contributor License Agreements have been signed. Ready to merge. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR integrates mypy type checking into the CI pipeline to enforce static type checking across the codebase. The changes add mypy as a new test environment and provide multiple ways to run type checks during development and CI.
Key changes:
- Adds mypy as a new tox test environment with required type stub dependencies
- Integrates mypy checking into the CI verification script
- Includes type checking artifacts (py.typed marker and cimpl.pyi stub file) in the source distribution
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| tox.ini | Adds mypy test environment with type-checking dependencies and command configuration |
| tools/source-package-verification.sh | Integrates mypy type checking into the CI verification workflow for Linux x64 builds |
| Makefile | Adds mypy target for convenient local type checking execution |
| MANIFEST.in | Includes type checking marker file and stub file in source distribution |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| deps = | ||
| mypy | ||
| types-cachetools | ||
| commands = mypy src/confluent_kafka |
Copilot
AI
Nov 6, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The mypy command should include the --strict or explicit configuration flags (e.g., --disallow-untyped-defs, --warn-return-any) to ensure consistent type checking behavior. Without explicit flags, mypy's behavior depends on project configuration files which may not be present, leading to inconsistent results across environments.
| commands = mypy src/confluent_kafka | |
| commands = mypy --strict src/confluent_kafka |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already have config in pyproject.toml
| flake8 --exclude ./_venv,*_pb2.py,./build | ||
|
|
||
| echo "Running mypy type checking ..." | ||
| mypy src/confluent_kafka |
Copilot
AI
Nov 6, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The mypy invocation should match the configuration used in tox.ini. Consider using tox -e mypy instead of calling mypy directly to ensure consistency between local development and CI environments.
| mypy src/confluent_kafka | |
| tox -e mypy |
|





What
Enforces mypy type checking in the CI/CD pipeline to improve code maintainability of the repo
Checklist
References
JIRA: https://confluentinc.atlassian.net/browse/DGS-22076
Test & Review
Open questions / Follow-ups