mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-10-04 12:07:34 +00:00
feat: llama stack show
`llama stack show` prints all required pip dependencies. It does this by using the `module` in the provider spec as the installation directory and gets all deps using the new `pyproject.toml`, providers can be installed as a package using the dependencies in the pyproject Signed-off-by: Charlie Doern <cdoern@redhat.com>
This commit is contained in:
parent
41431d8bdd
commit
3186cca09f
6 changed files with 396 additions and 5 deletions
|
@ -6,6 +6,8 @@
|
|||
|
||||
import importlib.resources
|
||||
import sys
|
||||
import tomllib
|
||||
from pathlib import Path
|
||||
|
||||
from pydantic import BaseModel
|
||||
from termcolor import cprint
|
||||
|
@ -72,8 +74,13 @@ def get_provider_dependencies(
|
|||
external_provider_deps.append(provider_spec.module)
|
||||
else:
|
||||
external_provider_deps.extend(provider_spec.module)
|
||||
if hasattr(provider_spec, "pip_packages"):
|
||||
deps.extend(provider_spec.pip_packages)
|
||||
|
||||
pyproject = Path(provider_spec.module.replace(".", "/")) / "pyproject.toml"
|
||||
with open(pyproject, "rb") as f:
|
||||
data = tomllib.load(f)
|
||||
|
||||
dependencies = data.get("project", {}).get("dependencies", [])
|
||||
deps.extend(dependencies)
|
||||
if hasattr(provider_spec, "container_image") and provider_spec.container_image:
|
||||
raise ValueError("A stack's dependencies cannot have a container image")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue