mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-03 09:53:45 +00:00
fix(mypy): add type stubs and fix typing issues (#3938)
Adds type stubs and fixes mypy errors for better type coverage. Changes: - Added type_checking dependency group with type stubs (torchtune, trl, etc.) - Added lm-format-enforcer to pre-commit hook - Created HFAutoModel Protocol for type-safe HuggingFace model handling - Added mypy.overrides for untyped libraries (torchtune, fairscale, etc.) - Fixed type issues in post-training providers, databricks, and api_recorder Note: ~1,200 errors remain in excluded files (see pyproject.toml exclude list). --------- Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
parent
1d385b5b75
commit
94b0592240
12 changed files with 487 additions and 68 deletions
|
|
@ -72,6 +72,12 @@ dev = [
|
|||
"black",
|
||||
"ruff",
|
||||
"mypy",
|
||||
"pre-commit",
|
||||
"ruamel.yaml", # needed for openapi generator
|
||||
]
|
||||
# Type checking dependencies - includes type stubs and optional runtime dependencies
|
||||
# needed for complete mypy coverage across all optional features
|
||||
type_checking = [
|
||||
"types-requests",
|
||||
"types-setuptools",
|
||||
"types-jsonschema",
|
||||
|
|
@ -79,8 +85,25 @@ dev = [
|
|||
"types-psutil",
|
||||
"types-tqdm",
|
||||
"boto3-stubs[s3]",
|
||||
"pre-commit",
|
||||
"ruamel.yaml", # needed for openapi generator
|
||||
"streamlit",
|
||||
"streamlit-option-menu",
|
||||
"pandas",
|
||||
"anthropic",
|
||||
"databricks-sdk",
|
||||
"fairscale",
|
||||
"torchtune",
|
||||
"trl",
|
||||
"peft",
|
||||
"datasets",
|
||||
"together",
|
||||
"nest-asyncio",
|
||||
"pymongo",
|
||||
"torchvision",
|
||||
"sqlite-vec",
|
||||
"faiss-cpu",
|
||||
"lm-format-enforcer",
|
||||
"mcp",
|
||||
"ollama",
|
||||
]
|
||||
# These are the dependencies required for running unit tests.
|
||||
unit = [
|
||||
|
|
@ -322,7 +345,17 @@ exclude = [
|
|||
|
||||
[[tool.mypy.overrides]]
|
||||
# packages that lack typing annotations, do not have stubs, or are unavailable.
|
||||
module = ["yaml", "fire"]
|
||||
module = [
|
||||
"yaml",
|
||||
"fire",
|
||||
"torchtune.*",
|
||||
"fairscale.*",
|
||||
"torchvision.*",
|
||||
"datasets",
|
||||
"nest_asyncio",
|
||||
"streamlit_option_menu",
|
||||
"lmformatenforcer.*",
|
||||
]
|
||||
ignore_missing_imports = true
|
||||
|
||||
[tool.pydantic-mypy]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue