mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-07-21 20:18:52 +00:00
refactor: restructure resolver logic and improve type safety (#1323)
# What does this PR do? - Modularized `resolve_impls` by extracting helper functions for validation, sorting, and instantiation. - Improved readability by introducing `validate_and_prepare_providers`, `sort_providers_by_dependency`, and `instantiate_providers`. - Enhanced type safety with explicit type hints (`Tuple`, `Dict`, `Set`, etc.). - Fixed potential issues with provider module imports and added error handling. - Updated `pyproject.toml` to enforce type checking on `resolver.py` using `mypy`. Signed-off-by: Sébastien Han <seb@redhat.com> - [//]: # (If resolving an issue, uncomment and update the line below) [//]: # (Closes #[issue-number]) ## Test Plan Run the server. [//]: # (## Documentation) Signed-off-by: Sébastien Han <seb@redhat.com>
This commit is contained in:
parent
cae6c00d8a
commit
f86154dff5
2 changed files with 119 additions and 84 deletions
|
@ -75,11 +75,7 @@ docs = [
|
|||
"sphinxcontrib.mermaid",
|
||||
"tomli",
|
||||
]
|
||||
codegen = [
|
||||
"rich",
|
||||
"pydantic",
|
||||
"jinja2",
|
||||
]
|
||||
codegen = ["rich", "pydantic", "jinja2"]
|
||||
|
||||
[project.urls]
|
||||
Homepage = "https://github.com/meta-llama/llama-stack"
|
||||
|
@ -163,3 +159,7 @@ exclude = [
|
|||
# packages that lack typing annotations, do not have stubs, or are unavailable.
|
||||
module = ["yaml", "fire"]
|
||||
ignore_missing_imports = true
|
||||
|
||||
[[tool.mypy.overrides]]
|
||||
module = "llama_stack.distribution.resolver"
|
||||
follow_imports = "normal" # This will force type checking on this module
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue