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 <ihar.hrachyshka@gmail.com>
This commit is contained in:
Ihar Hrachyshka 2025-03-25 18:49:29 -04:00 committed by GitHub
parent 2f38851751
commit c8f740353b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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