mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-08-09 19:58:29 +00:00
add flag
This commit is contained in:
parent
7c7e13734d
commit
d79190f7ff
4 changed files with 16 additions and 7 deletions
|
@ -182,6 +182,7 @@ def run_stack_build_command(args: argparse.Namespace) -> None:
|
|||
image_name=image_name,
|
||||
config_path=args.config,
|
||||
template_name=args.template,
|
||||
system_install=args.system_install,
|
||||
)
|
||||
|
||||
|
||||
|
@ -246,6 +247,7 @@ def _run_stack_build_command_from_build_config(
|
|||
image_name: Optional[str] = None,
|
||||
template_name: Optional[str] = None,
|
||||
config_path: Optional[str] = None,
|
||||
system_install: bool = False,
|
||||
) -> None:
|
||||
if build_config.image_type == ImageType.container.value:
|
||||
if template_name:
|
||||
|
@ -274,6 +276,7 @@ def _run_stack_build_command_from_build_config(
|
|||
build_file_path,
|
||||
image_name,
|
||||
template_or_config=template_name or config_path,
|
||||
system_install=system_install,
|
||||
)
|
||||
if return_code != 0:
|
||||
return
|
||||
|
|
|
@ -67,6 +67,12 @@ the build. If not specified, currently active Conda environment will be used if
|
|||
action="store_true",
|
||||
help="Print the dependencies for the stack only, without building the stack",
|
||||
)
|
||||
self.parser.add_argument(
|
||||
"--system-install",
|
||||
default=False,
|
||||
action="store_true",
|
||||
help="Install the dependencies in the same system Python environment. Used when image-type is venv. By default, a new virtual environment will be created.",
|
||||
)
|
||||
|
||||
def _run_stack_build_command(self, args: argparse.Namespace) -> None:
|
||||
# always keep implementation completely silo-ed away from CLI so CLI
|
||||
|
|
|
@ -96,6 +96,7 @@ def build_image(
|
|||
build_file_path: Path,
|
||||
image_name: str,
|
||||
template_or_config: str,
|
||||
system_install: bool = False,
|
||||
):
|
||||
container_base = build_config.distribution_spec.container_image or "python:3.10-slim"
|
||||
|
||||
|
@ -122,7 +123,6 @@ def build_image(
|
|||
" ".join(normal_deps),
|
||||
]
|
||||
elif build_config.image_type == ImageType.venv.value:
|
||||
system_install = True
|
||||
script = str(importlib.resources.files("llama_stack") / "distribution/build_venv.sh")
|
||||
args = [
|
||||
script,
|
||||
|
|
|
@ -29,7 +29,7 @@ if [ "$#" -lt 3 ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
special_pip_deps="$3"
|
||||
special_pip_deps="$4"
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
|
@ -38,7 +38,7 @@ env_name="llamastack-$build_name"
|
|||
pip_dependencies="$2"
|
||||
|
||||
# whether we want to install dependencies in current system python environment
|
||||
system_install="$4"
|
||||
system_install="$3"
|
||||
|
||||
# Define color codes
|
||||
RED='\033[0;31m'
|
||||
|
@ -75,10 +75,10 @@ pre_run_checks() {
|
|||
run() {
|
||||
local env_name="$1"
|
||||
local pip_dependencies="$2"
|
||||
local special_pip_deps="$3"
|
||||
local system_install="$4"
|
||||
local system_install="$3"
|
||||
local special_pip_deps="$4"
|
||||
|
||||
if [ "$SYSTEM_INSTALL" = true ]; then
|
||||
if [ "$system_install" = "True" ]; then
|
||||
echo "Installing dependencies in system Python environment"
|
||||
else
|
||||
echo "Using virtual environment $env_name"
|
||||
|
@ -147,4 +147,4 @@ run() {
|
|||
}
|
||||
|
||||
pre_run_checks "$env_name"
|
||||
run "$env_name" "$pip_dependencies" "$special_pip_deps"
|
||||
run "$env_name" "$pip_dependencies" "$system_install" "$special_pip_deps"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue