Skip to content

Commit c9193ff

Browse files
chore(internal): move mypy configurations to pyproject.toml file
1 parent 125d0c3 commit c9193ff

File tree

2 files changed

+52
-50
lines changed

2 files changed

+52
-50
lines changed

mypy.ini

Lines changed: 0 additions & 50 deletions
This file was deleted.

pyproject.toml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,58 @@ reportOverlappingOverload = false
157157
reportImportCycles = false
158158
reportPrivateUsage = false
159159

160+
[tool.mypy]
161+
pretty = true
162+
show_error_codes = true
163+
164+
# Exclude _files.py because mypy isn't smart enough to apply
165+
# the correct type narrowing and as this is an internal module
166+
# it's fine to just use Pyright.
167+
#
168+
# We also exclude our `tests` as mypy doesn't always infer
169+
# types correctly and Pyright will still catch any type errors.
170+
exclude = ['src/knockapi/_files.py', '_dev/.*.py', 'tests/.*']
171+
172+
strict_equality = true
173+
implicit_reexport = true
174+
check_untyped_defs = true
175+
no_implicit_optional = true
176+
177+
warn_return_any = true
178+
warn_unreachable = true
179+
warn_unused_configs = true
180+
181+
# Turn these options off as it could cause conflicts
182+
# with the Pyright options.
183+
warn_unused_ignores = false
184+
warn_redundant_casts = false
185+
186+
disallow_any_generics = true
187+
disallow_untyped_defs = true
188+
disallow_untyped_calls = true
189+
disallow_subclassing_any = true
190+
disallow_incomplete_defs = true
191+
disallow_untyped_decorators = true
192+
cache_fine_grained = true
193+
194+
# By default, mypy reports an error if you assign a value to the result
195+
# of a function call that doesn't return anything. We do this in our test
196+
# cases:
197+
# ```
198+
# result = ...
199+
# assert result is None
200+
# ```
201+
# Changing this codegen to make mypy happy would increase complexity
202+
# and would not be worth it.
203+
disable_error_code = "func-returns-value,overload-cannot-match"
204+
205+
# https://github.com/python/mypy/issues/12162
206+
[[tool.mypy.overrides]]
207+
module = "black.files.*"
208+
ignore_errors = true
209+
ignore_missing_imports = true
210+
211+
160212
[tool.ruff]
161213
line-length = 120
162214
output-format = "grouped"

0 commit comments

Comments
 (0)