Skip to content

A programming framework for agentic AI

Add mypy config to pyproject.toml (#1543)

Jack Gerrits8ece258c5462
diff --git a/pyproject.toml b/pyproject.toml
index 18038a16f..e2161fb84 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -49,3 +49,35 @@ unfixable = ["F401"]
[tool.ruff.mccabe]
# Unlike Flake8, default to a complexity level of 10.
max-complexity = 10
+
+[tool.mypy]
+
+strict = true
+python_version = "3.8"
+ignore_missing_imports = true
+install_types = true
+non_interactive = true
+plugins = [
+ "pydantic.mypy"
+]
+
+# remove after all files in the repo are fixed
+follow_imports = "silent"
+
+# from https://blog.wolt.com/engineering/2021/09/30/professional-grade-mypy-configuration/
+disallow_untyped_defs = true
+no_implicit_optional = true
+check_untyped_defs = true
+warn_return_any = true
+show_error_codes = true
+warn_unused_ignores = true
+
+disallow_incomplete_defs = true
+disallow_untyped_decorators = true
+disallow_any_unimported = true
+
+exclude = [
+ # This file needs to be either upgraded or removed and therefore should be
+ # ignore from type checking for now
+ "math_utils\\.py$",
+]
diff --git a/setup.py b/setup.py
index e3300d790..9e955a088 100644
--- a/setup.py
+++ b/setup.py
@@ -20,7 +20,8 @@ install_requires = [
"flaml",
"python-dotenv",
"tiktoken",
- "pydantic>=1.10,<3", # could be both V1 and V2
+ # Disallowing 2.6.0 can be removed when this is fixed https://github.com/pydantic/pydantic/issues/8705
+ "pydantic>=1.10,<3,!=2.6.0", # could be both V1 and V2
"docker",
]