Skip to content

Commit dd342eb

Browse files
authored
Add mypy config to pyproject.toml (microsoft#1543)
* Add mypy config to pyproject.toml * put back follow_imports * ignore math utils
1 parent cb921e1 commit dd342eb

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

pyproject.toml

+32
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,35 @@ unfixable = ["F401"]
4949
[tool.ruff.mccabe]
5050
# Unlike Flake8, default to a complexity level of 10.
5151
max-complexity = 10
52+
53+
[tool.mypy]
54+
55+
strict = true
56+
python_version = "3.8"
57+
ignore_missing_imports = true
58+
install_types = true
59+
non_interactive = true
60+
plugins = [
61+
"pydantic.mypy"
62+
]
63+
64+
# remove after all files in the repo are fixed
65+
follow_imports = "silent"
66+
67+
# from https://blog.wolt.com/engineering/2021/09/30/professional-grade-mypy-configuration/
68+
disallow_untyped_defs = true
69+
no_implicit_optional = true
70+
check_untyped_defs = true
71+
warn_return_any = true
72+
show_error_codes = true
73+
warn_unused_ignores = true
74+
75+
disallow_incomplete_defs = true
76+
disallow_untyped_decorators = true
77+
disallow_any_unimported = true
78+
79+
exclude = [
80+
# This file needs to be either upgraded or removed and therefore should be
81+
# ignore from type checking for now
82+
"math_utils\\.py$",
83+
]

setup.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
"flaml",
2121
"python-dotenv",
2222
"tiktoken",
23-
"pydantic>=1.10,<3", # could be both V1 and V2
23+
# Disallowing 2.6.0 can be removed when this is fixed https://github.com/pydantic/pydantic/issues/8705
24+
"pydantic>=1.10,<3,!=2.6.0", # could be both V1 and V2
2425
"docker",
2526
]
2627

0 commit comments

Comments
 (0)