Skip to content

Commit 0d5842e

Browse files
committed
chore: add mypy to the build
1 parent 491cab3 commit 0d5842e

File tree

4 files changed

+240
-3
lines changed

4 files changed

+240
-3
lines changed

.github/workflows/testing.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
- name: Code check
4242
run: tox -e ${TOX_VENV}
4343
env:
44-
TOX_VENV: black,pep8
44+
TOX_VENV: black,pep8,mypy
4545

4646
test:
4747
needs: [validate]

mypy.ini

Lines changed: 226 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,226 @@
1+
[mypy]
2+
3+
# For details on each flag, please see the mypy documentation at:
4+
# https://mypy.readthedocs.io/en/stable/config_file.html#config-file
5+
6+
# Note: The order of flags listed here should match the order used in mypy's
7+
# documentation to make it easier to find the documentation for each flag.
8+
9+
# Import Discovery
10+
ignore_missing_imports = false
11+
12+
# Disallow dynamic typing
13+
disallow_any_unimported = true
14+
disallow_any_expr = false
15+
disallow_any_decorated = true
16+
disallow_any_explicit = true
17+
disallow_any_generics = true
18+
disallow_subclassing_any = true
19+
20+
# Untyped definitions and calls
21+
disallow_untyped_calls = true
22+
disallow_untyped_defs = true
23+
disallow_incomplete_defs = true
24+
check_untyped_defs = true
25+
disallow_untyped_decorators = true
26+
27+
# None and Optional handling
28+
implicit_optional = false
29+
strict_optional = true
30+
31+
# Configuring warnings
32+
warn_redundant_casts = true
33+
warn_unused_ignores = true
34+
warn_no_return = true
35+
warn_return_any = true
36+
warn_unreachable = true
37+
38+
# Miscellaneous strictness flags
39+
allow_untyped_globals = false
40+
allow_redefinition = false
41+
local_partial_types = true
42+
implicit_reexport = false
43+
strict_concatenate = true
44+
strict_equality = true
45+
strict = true
46+
47+
# Configuring error messages
48+
show_error_context = true
49+
show_column_numbers = true
50+
hide_error_codes = false
51+
pretty = true
52+
color_output = true
53+
error_summary = true
54+
show_absolute_path = true
55+
56+
# Miscellaneous
57+
warn_unused_configs = true
58+
verbosity = 0
59+
60+
# FIXME: As type annotations are introduced, please remove the appropriate
61+
# ignore_errors flag below. New modules should NOT be added here!
62+
63+
[mypy-kazoo.client]
64+
ignore_errors = true
65+
66+
[mypy-kazoo.exceptions]
67+
ignore_errors = true
68+
69+
[mypy-kazoo.handlers.eventlet]
70+
ignore_errors = true
71+
72+
[mypy-kazoo.handlers.gevent]
73+
ignore_errors = true
74+
75+
[mypy-kazoo.handlers.threading]
76+
ignore_errors = true
77+
78+
[mypy-kazoo.handlers.utils]
79+
ignore_errors = true
80+
81+
[mypy-kazoo.hosts]
82+
ignore_errors = true
83+
84+
[mypy-kazoo.interfaces]
85+
ignore_errors = true
86+
87+
[mypy-kazoo.loggingsupport]
88+
ignore_errors = true
89+
90+
[mypy-kazoo.protocol.connection]
91+
ignore_errors = true
92+
93+
[mypy-kazoo.protocol.paths]
94+
ignore_errors = true
95+
96+
[mypy-kazoo.protocol.serialization]
97+
ignore_errors = true
98+
99+
[mypy-kazoo.protocol.states]
100+
ignore_errors = true
101+
102+
[mypy-kazoo.recipe.barrier]
103+
ignore_errors = true
104+
105+
[mypy-kazoo.recipe.cache]
106+
ignore_errors = true
107+
108+
[mypy-kazoo.recipe.counter]
109+
ignore_errors = true
110+
111+
[mypy-kazoo.recipe.election]
112+
ignore_errors = true
113+
114+
[mypy-kazoo.recipe.lease]
115+
ignore_errors = true
116+
117+
[mypy-kazoo.recipe.lock]
118+
ignore_errors = true
119+
120+
[mypy-kazoo.recipe.partitioner]
121+
ignore_errors = true
122+
123+
[mypy-kazoo.recipe.party]
124+
ignore_errors = true
125+
126+
[mypy-kazoo.recipe.queue]
127+
ignore_errors = true
128+
129+
[mypy-kazoo.recipe.watchers]
130+
ignore_errors = true
131+
132+
[mypy-kazoo.retry]
133+
ignore_errors = true
134+
135+
[mypy-kazoo.security]
136+
ignore_errors = true
137+
138+
[mypy-kazoo.testing.common]
139+
ignore_errors = true
140+
141+
[mypy-kazoo.testing.harness]
142+
ignore_errors = true
143+
144+
[mypy-kazoo.tests.conftest]
145+
ignore_errors = true
146+
147+
[mypy-kazoo.tests.test__connection]
148+
ignore_errors = true
149+
150+
[mypy-kazoo.tests.test_barrier]
151+
ignore_errors = true
152+
153+
[mypy-kazoo.tests.test_build]
154+
ignore_errors = true
155+
156+
[mypy-kazoo.tests.test_cache]
157+
ignore_errors = true
158+
159+
[mypy-kazoo.tests.test_client]
160+
ignore_errors = true
161+
162+
[mypy-kazoo.tests.test_counter]
163+
ignore_errors = true
164+
165+
[mypy-kazoo.tests.test_election]
166+
ignore_errors = true
167+
168+
[mypy-kazoo.tests.test_eventlet_handler]
169+
ignore_errors = true
170+
171+
[mypy-kazoo.tests.test_exceptions]
172+
ignore_errors = true
173+
174+
[mypy-kazoo.tests.test_gevent_handler]
175+
ignore_errors = true
176+
177+
[mypy-kazoo.tests.test_hosts]
178+
ignore_errors = true
179+
180+
[mypy-kazoo.tests.test_interrupt]
181+
ignore_errors = true
182+
183+
[mypy-kazoo.tests.test_lease]
184+
ignore_errors = true
185+
186+
[mypy-kazoo.tests.test_lock]
187+
ignore_errors = true
188+
189+
[mypy-kazoo.tests.test_partitioner]
190+
ignore_errors = true
191+
192+
[mypy-kazoo.tests.test_party]
193+
ignore_errors = true
194+
195+
[mypy-kazoo.tests.test_paths]
196+
ignore_errors = true
197+
198+
[mypy-kazoo.tests.test_queue]
199+
ignore_errors = true
200+
201+
[mypy-kazoo.tests.test_retry]
202+
ignore_errors = true
203+
204+
[mypy-kazoo.tests.test_sasl]
205+
ignore_errors = true
206+
207+
[mypy-kazoo.tests.test_security]
208+
ignore_errors = true
209+
210+
[mypy-kazoo.tests.test_selectors_select]
211+
ignore_errors = true
212+
213+
[mypy-kazoo.tests.test_threading_handler]
214+
ignore_errors = true
215+
216+
[mypy-kazoo.tests.test_utils]
217+
ignore_errors = true
218+
219+
[mypy-kazoo.tests.test_watchers]
220+
ignore_errors = true
221+
222+
[mypy-kazoo.tests.util]
223+
ignore_errors = true
224+
225+
[mypy-kazoo.version]
226+
ignore_errors = true

setup.cfg

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,14 @@ sasl =
7373
docs =
7474
Sphinx>=1.2.2
7575

76+
typing =
77+
mypy>=0.991
78+
7679
alldeps =
7780
%(dev)s
7881
%(eventlet)s
7982
%(gevent)s
8083
%(sasl)s
8184
%(docs)s
82-
85+
%(typing)s
8386

tox.ini

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ requires=
44
virtualenv>=20.7.2
55
skip_missing_interpreters=True
66
envlist =
7-
pep8,black,
7+
pep8,black,mypy,
88
gevent,eventlet,sasl,
99
docs,
1010
pypy3
@@ -59,3 +59,11 @@ deps =
5959
usedevelop = True
6060
commands = black --check {posargs: {toxinidir}/kazoo {toxinidir}/kazoo}
6161

62+
[testenv:mypy]
63+
basepython = python3
64+
extras = alldeps
65+
deps =
66+
mypy
67+
mypy: types-mock
68+
usedevelop = True
69+
commands = mypy --config-file {toxinidir}/mypy.ini {toxinidir}/kazoo

0 commit comments

Comments
 (0)