mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-06-28 02:53:30 +00:00
Add --print-deps-only for computing dependencies
This commit is contained in:
parent
da46d98a63
commit
216cde5ee8
2 changed files with 28 additions and 11 deletions
|
@ -22,7 +22,12 @@ from termcolor import cprint
|
|||
|
||||
from llama_stack.cli.table import print_table
|
||||
|
||||
from llama_stack.distribution.build import build_image, ImageType
|
||||
from llama_stack.distribution.build import (
|
||||
build_image,
|
||||
get_provider_dependencies,
|
||||
ImageType,
|
||||
SERVER_DEPENDENCIES,
|
||||
)
|
||||
from llama_stack.distribution.datatypes import (
|
||||
BuildConfig,
|
||||
DistributionSpec,
|
||||
|
@ -35,7 +40,6 @@ from llama_stack.distribution.utils.config_dirs import DISTRIBS_BASE_DIR
|
|||
from llama_stack.distribution.utils.dynamic import instantiate_class_type
|
||||
from llama_stack.providers.datatypes import Api
|
||||
|
||||
|
||||
TEMPLATES_PATH = Path(__file__).parent.parent.parent / "templates"
|
||||
|
||||
|
||||
|
@ -78,14 +82,7 @@ def run_stack_build_command(
|
|||
color="red",
|
||||
)
|
||||
return
|
||||
_run_stack_build_command_from_build_config(
|
||||
build_config,
|
||||
image_name=image_name,
|
||||
template_name=args.template,
|
||||
)
|
||||
return
|
||||
|
||||
if not args.config and not args.template:
|
||||
elif not args.config and not args.template:
|
||||
name = prompt(
|
||||
"> Enter a name for your Llama Stack (e.g. my-local-stack): ",
|
||||
validator=Validator.from_callable(
|
||||
|
@ -180,8 +177,22 @@ def run_stack_build_command(
|
|||
)
|
||||
return
|
||||
|
||||
if args.print_deps_only:
|
||||
print(f"# Dependencies for {args.template or args.config or image_name}")
|
||||
normal_deps, special_deps = get_provider_dependencies(
|
||||
build_config.distribution_spec.providers
|
||||
)
|
||||
normal_deps += SERVER_DEPENDENCIES
|
||||
print(f"pip install {' '.join(normal_deps)}")
|
||||
for special_dep in special_deps:
|
||||
print(f"pip install {special_dep}")
|
||||
return
|
||||
|
||||
_run_stack_build_command_from_build_config(
|
||||
build_config, image_name=image_name, config_path=args.config
|
||||
build_config,
|
||||
image_name=image_name,
|
||||
config_path=args.config,
|
||||
template_name=args.template,
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -63,6 +63,12 @@ environment is active, you must specify a name.
|
|||
),
|
||||
default=None,
|
||||
)
|
||||
self.parser.add_argument(
|
||||
"--print-deps-only",
|
||||
default=False,
|
||||
action="store_true",
|
||||
help="Print the dependencies for the stack only, without building the stack",
|
||||
)
|
||||
|
||||
def _run_stack_build_command(self, args: argparse.Namespace) -> None:
|
||||
# always keep implementation completely silo-ed away from CLI so CLI
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue