Skip to content

Commit 90beb39

Browse files
chore(internal): move mypy configurations to pyproject.toml file
1 parent 89d6a5d commit 90beb39

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
@@ -165,6 +165,58 @@ reportOverlappingOverload = false
165165
reportImportCycles = false
166166
reportPrivateUsage = false
167167

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

0 commit comments

Comments
 (0)