From f1df1ad4eab45f4ac9a28d7027e08a76582405d3 Mon Sep 17 00:00:00 2001 From: Ihar Hrachyshka Date: Mon, 27 Jan 2025 17:26:02 +0000 Subject: [PATCH] mypy: Enable pydantic plugin This may help us avoid some spurious mypy warnings when it gets confused by pydantic magick. It may also catch some additional typing violations in pydantic model definitions that are not recognized by stock mypy. See details about the plugin and what it provides at: https://docs.pydantic.dev/latest/integrations/mypy/ Note: this change also enables all strict checks for the plugin. Fortunately, the code tree didn't have anything to adjust to adopt these. Signed-off-by: Ihar Hrachyshka --- pyproject.toml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index a44813210c..43d9042548 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -181,6 +181,7 @@ from-first = true known-local-folder = ["tuning"] [tool.mypy] +plugins = ['pydantic.mypy'] mypy_path = ["src"] packages = ["instructlab", "tests"] disable_error_code = [] @@ -228,6 +229,11 @@ module = [ ] ignore_missing_imports = true +[tool.pydantic-mypy] +init_forbid_extra = true +init_typed = true +warn_required_dynamic_aliases = true + [tool.coverage.run] branch = false relative_files = true