From 58c3c45f19bce09df07500fb8b34c6028d21aa95 Mon Sep 17 00:00:00 2001 From: Xi Yan Date: Thu, 24 Oct 2024 23:05:26 -0700 Subject: [PATCH] workaround list templates command --- llama_stack/cli/stack/build.py | 6 ++++++ setup.py | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/llama_stack/cli/stack/build.py b/llama_stack/cli/stack/build.py index 26aa35e16..8e24c8bfa 100644 --- a/llama_stack/cli/stack/build.py +++ b/llama_stack/cli/stack/build.py @@ -16,6 +16,12 @@ TEMPLATES_PATH = ( Path(os.path.relpath(__file__)).parent.parent.parent.parent / "distributions" ) +# build.yaml templates exist in the llama-stack/distributions while wheel installs llama-stack/llama_stack +# we copied the distributions folder to llama-stack/llama_stack/cli/distributions for wheel builds, +# so we need to check both locations +if not TEMPLATES_PATH.exists(): + TEMPLATES_PATH = Path(os.path.relpath(__file__)).parent.parent / "distributions" + @lru_cache() def available_templates_specs() -> List[BuildConfig]: diff --git a/setup.py b/setup.py index 78ceb145e..9a678892d 100644 --- a/setup.py +++ b/setup.py @@ -29,7 +29,11 @@ setup( long_description=open("README.md").read(), long_description_content_type="text/markdown", url="https://github.com/meta-llama/llama-stack", - packages=find_packages(), + # workaround to include distributions/*/build.yaml files in the package + # https://stackoverflow.com/questions/62550952/including-package-data-python-from-top-level-when-package-is-in-subdirectory + packages=find_packages() + ["llama_stack.cli.distributions"], + package_dir={"llama_stack.cli.distributions": "distributions"}, + package_data={"llama_stack.cli.distributions": ["distributions/*/build.yaml"]}, classifiers=[ "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3",