From c8f740353b891d8b584507c3ba5e827cdeeb99fe Mon Sep 17 00:00:00 2001 From: Ihar Hrachyshka Date: Tue, 25 Mar 2025 18:49:29 -0400 Subject: [PATCH] chore: enable mypy pydantic plugin (#1788) # What does this PR do? 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 0b34a601c..9eef66672 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 @@ -304,3 +305,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