From 70375376e2f364ed511c5fbcd70a8f51193fa45b Mon Sep 17 00:00:00 2001 From: Ihar Hrachyshka Date: Tue, 25 Mar 2025 18:30:48 -0400 Subject: [PATCH] chore: enable mypy pydantic plugin Since the project heavily relies on pydantic models, it's probably wise to enable the plugin to avoid some potential spurious violation warnings the further we expand mypy coverage for the code base. It should be generally risk-free to enable the plugin for the repo. Some info on what plugin brings to the table: https://docs.pydantic.dev/latest/integrations/mypy/#mypy-plugin-capabilities Signed-off-by: Ihar Hrachyshka --- pyproject.toml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index f7125b724..7c38e1617 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -152,6 +152,7 @@ ignore = [ [tool.mypy] mypy_path = ["llama_stack"] packages = ["llama_stack"] +plugins = ['pydantic.mypy'] disable_error_code = [] warn_return_any = true # # honor excludes by not following there through imports @@ -303,3 +304,8 @@ exclude = [ # packages that lack typing annotations, do not have stubs, or are unavailable. module = ["yaml", "fire"] ignore_missing_imports = true + +[tool.pydantic-mypy] +init_forbid_extra = true +init_typed = true +warn_required_dynamic_aliases = true