Skip to content

Commit 545938f

Browse files
chore(internal): move mypy configurations to pyproject.toml file
1 parent 2546094 commit 545938f

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

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

0 commit comments

Comments
 (0)