Skip to content

Commit 66aa64b

Browse files
committed
build: run mypy via tox
Tox now runs mypy on cloudevents itself, and the samples. Signed-off-by: Hal Blackburn <[email protected]>
1 parent b70ef0a commit 66aa64b

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

requirements/dev.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ pep8-naming
55
flake8-print
66
tox
77
pre-commit
8+
mypy

requirements/mypy.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
mypy
2+
# mypy has the pydantic plugin enabled
3+
pydantic>=2.0.0,<3.0
4+
types-requests
5+
deprecation>=2.0,<3.0

tox.ini

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tox]
2-
envlist = py{38,39,310,311,312},lint
2+
envlist = py{38,39,310,311,312},lint,mypy,mypy-samples-{image,json}
33
skipsdist = True
44

55
[testenv]
@@ -30,3 +30,21 @@ commands =
3030
black --check .
3131
isort -c cloudevents samples
3232
flake8 cloudevents samples --ignore W503,E731 --extend-ignore E203 --max-line-length 88
33+
34+
[testenv:mypy]
35+
basepython = python3.11
36+
deps =
37+
-r{toxinidir}/requirements/mypy.txt
38+
# mypy needs test dependencies to check test modules
39+
-r{toxinidir}/requirements/test.txt
40+
commands = mypy cloudevents
41+
42+
[testenv:mypy-samples-{image,json}]
43+
basepython = python3.11
44+
setenv =
45+
mypy-samples-image: SAMPLE_DIR={toxinidir}/samples/http-image-cloudevents
46+
mypy-samples-json: SAMPLE_DIR={toxinidir}/samples/http-json-cloudevents
47+
deps =
48+
-r{toxinidir}/requirements/mypy.txt
49+
-r{env:SAMPLE_DIR}/requirements.txt
50+
commands = mypy {env:SAMPLE_DIR}

0 commit comments

Comments
 (0)