Skip to content

Conversation

@fangnx
Copy link
Member

@fangnx fangnx commented Nov 6, 2025

What

Enforces mypy type checking in the CI/CD pipeline to improve code maintainability of the repo

Checklist

  • Contains customer facing changes? Including API/behavior changes
  • Did you add sufficient unit test and/or integration test coverage for this PR?
    • If not, please explain why it is not required

References

JIRA: https://confluentinc.atlassian.net/browse/DGS-22076

Test & Review

Open questions / Follow-ups

Copilot AI review requested due to automatic review settings November 6, 2025 21:30
@fangnx fangnx requested review from a team and MSeal as code owners November 6, 2025 21:30
@confluent-cla-assistant
Copy link

🎉 All Contributor License Agreements have been signed. Ready to merge.
Please push an empty commit if you would like to re-run the checks to verify CLA status for all contributors.

Copy link

Copilot AI left a 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
Copy link

Copilot AI Nov 6, 2025

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.

Suggested change
commands = mypy src/confluent_kafka
commands = mypy --strict src/confluent_kafka

Copilot uses AI. Check for mistakes.
Copy link
Member Author

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
Copy link

Copilot AI Nov 6, 2025

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.

Suggested change
mypy src/confluent_kafka
tox -e mypy

Copilot uses AI. Check for mistakes.
@fangnx fangnx changed the title Integrate mypy type checking with CI Integrate mypy type checking with CI/CD Nov 6, 2025
@fangnx fangnx changed the title Integrate mypy type checking with CI/CD Add mypy type checking to CI/CD Nov 6, 2025
@sonarqube-confluent
Copy link

Quality Gate passed Quality Gate passed

Issues
0 New issues
0 Fixed issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarQube

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants