From d0ec5c3d3ae0aa81ec3810e6fe935314eaec5a49 Mon Sep 17 00:00:00 2001 From: Charlie Doern Date: Mon, 7 Jul 2025 18:39:39 -0400 Subject: [PATCH] fix: print proper template path upon build (#2642) # What does this PR do? Rather than pointing to a dir in `llama_stack/templates` (the repo directory) we should point to `$BUILD_DIR/IMAGE_NAME-run.yaml` (`~/.llama/distributions/IMAGE_NAME/IMAGE_NAME-run.yaml`) currently we are printing: ``` You can find the newly-built template here: /Users/charliedoern/projects/Documents/llama-stack/llama_stack/templates/starter/run.yaml You can run the new Llama Stack distro via: llama stack run /Users/charliedoern/projects/Documents/llama-stack/llama_stack/templates/starter/run.yaml --image-type venv ``` but should be printing things like: ``` You can find the newly-built template here: /Users/charliedoern/.llama/distributions/starter/starter-run.yaml You can run the new Llama Stack distro via: llama stack run /Users/charliedoern/.llama/distributions/starter/starter-run.yaml --image-type venv ``` Signed-off-by: Charlie Doern --- llama_stack/cli/stack/_build.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/llama_stack/cli/stack/_build.py b/llama_stack/cli/stack/_build.py index 7ade6f17a..5d88b1d82 100644 --- a/llama_stack/cli/stack/_build.py +++ b/llama_stack/cli/stack/_build.py @@ -403,15 +403,16 @@ def _run_stack_build_command_from_build_config( if template_name: # copy run.yaml from template to build_dir instead of generating it again template_path = importlib.resources.files("llama_stack") / f"templates/{template_name}/run.yaml" + run_config_file = build_dir / f"{template_name}-run.yaml" + with importlib.resources.as_file(template_path) as path: - run_config_file = build_dir / f"{template_name}-run.yaml" shutil.copy(path, run_config_file) cprint("Build Successful!", color="green", file=sys.stderr) - cprint(f"You can find the newly-built template here: {template_path}", color="blue", file=sys.stderr) + cprint(f"You can find the newly-built template here: {run_config_file}", color="blue", file=sys.stderr) cprint( "You can run the new Llama Stack distro via: " - + colored(f"llama stack run {template_path} --image-type {build_config.image_type}", "blue"), + + colored(f"llama stack run {run_config_file} --image-type {build_config.image_type}", "blue"), color="green", file=sys.stderr, )