Skip to content

Commit a27daa1

Browse files
chore(internal): move mypy configurations to pyproject.toml file
1 parent 5c7b05b commit a27daa1

2 files changed

Lines changed: 53 additions & 50 deletions

File tree

mypy.ini

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

pyproject.toml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,59 @@ filterwarnings = [
135135
"error"
136136
]
137137

138+
[tool.mypy]
139+
pretty = true
140+
show_error_codes = true
141+
142+
# Exclude _files.py because mypy isn't smart enough to apply
143+
# the correct type narrowing and as this is an internal module
144+
# it's fine to just use Pyright.
145+
#
146+
# We also exclude our `tests` as mypy doesn't always infer
147+
# types correctly and Pyright will still catch any type errors.
148+
exclude = ['src/llama_stack_client/_files.py', '_dev/.*.py', 'tests/.*']
149+
150+
strict_equality = true
151+
implicit_reexport = true
152+
check_untyped_defs = true
153+
no_implicit_optional = true
154+
155+
warn_return_any = true
156+
warn_unreachable = true
157+
warn_unused_configs = true
158+
159+
# Turn these options off as it could cause conflicts
160+
# with the Pyright options.
161+
warn_unused_ignores = false
162+
warn_redundant_casts = false
163+
164+
disallow_any_generics = true
165+
disallow_untyped_defs = true
166+
disallow_untyped_calls = true
167+
disallow_subclassing_any = true
168+
disallow_incomplete_defs = true
169+
disallow_untyped_decorators = true
170+
cache_fine_grained = true
171+
172+
# By default, mypy reports an error if you assign a value to the result
173+
# of a function call that doesn't return anything. We do this in our test
174+
# cases:
175+
# ```
176+
# result = ...
177+
# assert result is None
178+
# ```
179+
# Changing this codegen to make mypy happy would increase complexity
180+
# and would not be worth it.
181+
disable_error_code = "func-returns-value,overload-cannot-match"
182+
183+
# https://github.com/python/mypy/issues/12162
184+
185+
[[tool.mypy.overrides]]
186+
module = "black.files.*"
187+
ignore_errors = true
188+
ignore_missing_imports = true
189+
190+
138191
[tool.ruff]
139192
line-length = 120
140193
output-format = "grouped"

0 commit comments

Comments
 (0)