@@ -31,6 +31,7 @@ basepython =
3131deps =
3232 test: coverage ==4.5.4
3333 test: idna ==2.8
34+ test: typing ==3.7.4.1
3435 test: {py26,py27,py34}: pytest ==4.6.6
3536 test: {py35,py36,py37,py38}: pytest ==5.2.1
3637 test: pytest-cov ==2.8.1
@@ -122,6 +123,74 @@ ignore =
122123application-import-names = deploy
123124
124125
126+ # #
127+ # Mypy static type checking
128+ # #
129+
130+ [testenv:mypy]
131+
132+ description = run Mypy (static type checker)
133+
134+ basepython = python3.7
135+
136+ skip_install = True
137+
138+
139+ deps =
140+ mypy ==0.730
141+
142+
143+ commands =
144+ mypy \
145+ --config-file =" {toxinidir}/tox.ini" \
146+ --cache-dir =" {toxworkdir}/mypy_cache" \
147+ {tty:--pretty:} \
148+ {posargs:src}
149+
150+
151+ [mypy]
152+
153+ # Global settings
154+
155+ no_implicit_optional = True
156+ show_column_numbers = True
157+ show_error_codes = True
158+ strict_optional = True
159+ warn_no_return = True
160+ warn_redundant_casts = True
161+ warn_return_any = True
162+ warn_unused_ignores = True
163+ warn_unreachable = True
164+
165+ # Enable these over time
166+ check_untyped_defs = False
167+ disallow_incomplete_defs = False
168+ disallow_untyped_defs = False
169+
170+ # Disable checks until effected files fully adopt mypy
171+
172+ [mypy-hyperlink._url]
173+ allow_untyped_defs = True
174+
175+ [mypy-hyperlink.test.common]
176+ allow_untyped_defs = True
177+
178+ [mypy-hyperlink.test.test_common]
179+ allow_untyped_defs = True
180+
181+ [mypy-hyperlink.test.test_decoded_url]
182+ allow_untyped_defs = True
183+
184+ [mypy-hyperlink.test.test_scheme_registration]
185+ allow_untyped_defs = True
186+
187+ [mypy-hyperlink.test.test_url]
188+ allow_untyped_defs = True
189+
190+ [mypy-idna]
191+ ignore_missing_imports = True
192+
193+
125194# #
126195# Coverage report
127196# #
0 commit comments