diff --git a/MANIFEST.in b/MANIFEST.in index 7e9bbf313..cd0c97ef2 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,5 +1,7 @@ include README.md include LICENSE include src/confluent_kafka/src/*.[ch] +include src/confluent_kafka/py.typed +include src/confluent_kafka/cimpl.pyi prune tests -prune docs \ No newline at end of file +prune docs diff --git a/Makefile b/Makefile index 3615e2b93..100c0dd14 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,9 @@ all: @echo "Targets:" @echo " clean" @echo " docs" + @echo " mypy" + @echo " style-check" + @echo " style-fix" clean: @@ -14,6 +17,9 @@ clean: docs: $(MAKE) -C docs html +mypy: + python3 -m mypy src/confluent_kafka + style-check: @(tools/style-format.sh \ $$(git ls-tree -r --name-only HEAD | egrep '\.(c|h|py)$$') ) diff --git a/requirements/requirements-tests.txt b/requirements/requirements-tests.txt index 730bd2be5..022c7a8c2 100644 --- a/requirements/requirements-tests.txt +++ b/requirements/requirements-tests.txt @@ -3,6 +3,7 @@ urllib3<3 flake8 mypy types-cachetools +types-requests orjson pytest pytest-timeout diff --git a/tools/source-package-verification.sh b/tools/source-package-verification.sh index 0081d584e..bed6f0d44 100755 --- a/tools/source-package-verification.sh +++ b/tools/source-package-verification.sh @@ -51,6 +51,10 @@ if [[ $OS_NAME == linux && $ARCH == x64 ]]; then # Run these actions and tests only in this case echo "Building documentation ..." flake8 --exclude ./_venv,*_pb2.py,./build + + echo "Running mypy type checking ..." + mypy src/confluent_kafka + pip install -r requirements/requirements-docs.txt make docs diff --git a/tox.ini b/tox.ini index 2f7b43348..a840be054 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = flake8,py37,py38,py39,py310,py311,py312,py313 +envlist = flake8,mypy,py37,py38,py39,py310,py311,py312,py313 [testenv] passenv = @@ -20,6 +20,13 @@ commands = deps = flake8 commands = flake8 +[testenv:mypy] +deps = + mypy + types-cachetools + types-requests +commands = mypy src/confluent_kafka + [pytest] python_files = test_* testpaths = tests