feat: group deps by provider

dependencies are currently installed and listed in an unassociated way with the provider they come from.

From a user POV, associating deps with the specific provider introducing them is crucial in order to eliminate unwanted dependences if using a larger distro like starter.

For example, If I am using starter on a daily basis but then go `llama stack build --distro starter...` and get 15 NEW dependencies, there is currently NO way for me to tell which provider introduced them.

This work fixes the output of the build process and `--print-deps-only`

Signed-off-by: Charlie Doern <cdoern@redhat.com>
This commit is contained in:
Charlie Doern 2025-08-20 13:33:15 -04:00
parent e195ee3091
commit 268766c72e
4 changed files with 214 additions and 82 deletions

View file

@ -230,12 +230,31 @@ def run_stack_build_command(args: argparse.Namespace) -> None:
if args.print_deps_only:
print(f"# Dependencies for {distro_name or args.config or image_name}")
normal_deps, special_deps, external_provider_dependencies = get_provider_dependencies(build_config)
normal_deps += SERVER_DEPENDENCIES
print(f"uv pip install {' '.join(normal_deps)}")
for special_dep in special_deps:
print(f"uv pip install {special_dep}")
for external_dep in external_provider_dependencies:
print(f"uv pip install {external_dep}")
normal_deps["default"] += SERVER_DEPENDENCIES
cprint(
"Please install needed dependencies using the following commands:",
color="yellow",
file=sys.stderr,
)
for prov, deps in normal_deps.items():
if len(deps) == 0:
continue
cprint(f"# Normal Dependencies for {prov}", color="yellow")
cprint(f"uv pip install {' '.join(deps)}", file=sys.stderr)
for prov, deps in special_deps.items():
if len(deps) == 0:
continue
cprint(f"# Special Dependencies for {prov}", color="yellow")
cprint(f"uv pip install {' '.join(deps)}", file=sys.stderr)
for prov, deps in external_provider_dependencies.items():
if len(deps) == 0:
continue
cprint(f"# External Provider Dependencies for {prov}", color="yellow")
cprint(f"uv pip install {' '.join(deps)}", file=sys.stderr)
print()
return
try: