Skip to content

Commit 560d242

Browse files
chore: sync downstream changes to midstream main
Signed-off-by: Nathan Weinberg <nweinber@redhat.com>
1 parent 5061e56 commit 560d242

File tree

11 files changed

+115
-59
lines changed

11 files changed

+115
-59
lines changed

.github/workflows/redhat-distro-container-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
5252
with:
5353
context: .
54-
file: redhat-distribution/Containerfile
54+
file: distribution/Containerfile
5555
platforms: ${{ matrix.platform }}
5656
push: ${{ github.event_name == 'push' }}
5757
tags: ${{ env.IMAGE_NAME }}:${{ github.sha }},${{ env.IMAGE_NAME }}:latest

.pre-commit-config.yaml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
exclude: 'build/'
2+
3+
default_language_version:
4+
python: python3.12
5+
6+
repos:
7+
- repo: https://github.com/pre-commit/pre-commit-hooks
8+
rev: v5.0.0 # Latest stable version
9+
hooks:
10+
- id: check-merge-conflict
11+
args: ['--assume-in-merge']
12+
- id: trailing-whitespace
13+
exclude: '\.py$' # Exclude Python files as Ruff already handles them
14+
- id: check-added-large-files
15+
args: ['--maxkb=1000']
16+
- id: end-of-file-fixer
17+
exclude: '^(.*\.svg)$'
18+
- id: no-commit-to-branch
19+
- id: check-yaml
20+
args: ["--unsafe"]
21+
- id: detect-private-key
22+
- id: requirements-txt-fixer
23+
- id: mixed-line-ending
24+
args: [--fix=lf] # Forces to replace line ending by LF (line feed)
25+
- id: check-executables-have-shebangs
26+
- id: check-json
27+
- id: check-shebang-scripts-are-executable
28+
- id: check-symlinks
29+
- id: check-toml
30+
31+
- repo: https://github.com/astral-sh/ruff-pre-commit
32+
rev: v0.9.4
33+
hooks:
34+
- id: ruff
35+
args: [ --fix ]
36+
- id: ruff-format
37+
38+
- repo: local
39+
hooks:
40+
- id: pkg-gen
41+
name: Distribution Build
42+
entry: ./distribution/build.py
43+
language: python
44+
pass_filenames: false
45+
require_serial: true
46+
always_run: true
47+
files: ^distribution/.*$
48+
additional_dependencies:
49+
- llama-stack==0.2.18

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ The Containerfile is auto-generated from a template. To generate it:
1515
1. Make sure you have the `llama` CLI tool installed
1616
2. Run the build script from root of this git repo:
1717
```bash
18-
./redhat-distribution/build.py
18+
./distribution/build.py
1919
```
2020

2121
This will:
@@ -25,7 +25,7 @@ This will:
2525

2626
## Editing the Containerfile
2727

28-
The Containerfile is auto-generated from a template. To edit it, you can modify the template in `redhat-distribution/Containerfile.in` and run the build script again.
28+
The Containerfile is auto-generated from a template. To edit it, you can modify the template in `distribution/Containerfile.in` and run the build script again.
2929
NEVER edit the generated `Containerfile` manually.
3030

3131
## Building the Container Image
@@ -35,7 +35,7 @@ Once the Containerfile is generated, you can build the image using either Podman
3535
### Using Podman build image for x86_64
3636

3737
```bash
38-
podman build --platform linux/amd64 -f redhat-distribution/Containerfile -t rh .
38+
podman build --platform linux/amd64 -f distribution/Containerfile -t rh .
3939
```
4040

4141
## Notes
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# WARNING: This file is auto-generated. Do not modify it manually.
2-
# Generated by: redhat-distribution/build.py
2+
# Generated by: distribution/build.py
33

44
FROM registry.access.redhat.com/ubi9/python-312@sha256:95ec8d3ee9f875da011639213fd254256c29bc58861ac0b11f290a291fa04435
55
WORKDIR /opt/app-root
@@ -17,7 +17,7 @@ RUN pip install \
1717
llama_stack_provider_lmeval==0.1.7 \
1818
llama_stack_provider_trustyai_fms==0.1.2 \
1919
matplotlib \
20-
mcp \
20+
mcp>=1.8.1 \
2121
nltk \
2222
numpy \
2323
openai \
@@ -40,9 +40,9 @@ RUN pip install \
4040
uvicorn
4141
RUN pip install --index-url https://download.pytorch.org/whl/cpu torch torchvision
4242
RUN pip install --no-deps sentence-transformers
43-
RUN pip install --no-cache llama-stack==0.2.14
43+
RUN pip install --no-cache llama-stack==0.2.18
4444
RUN mkdir -p ${HOME}/.llama/providers.d ${HOME}/.cache
45-
COPY redhat-distribution/run.yaml ${APP_ROOT}/run.yaml
46-
COPY redhat-distribution/providers.d/ ${HOME}/.llama/providers.d/
45+
COPY distribution/run.yaml ${APP_ROOT}/run.yaml
46+
COPY distribution/providers.d/ ${HOME}/.llama/providers.d/
4747

48-
ENTRYPOINT ["python", "-m", "llama_stack.distribution.server.server", "--config", "/opt/app-root/run.yaml"]
48+
ENTRYPOINT ["python", "-m", "llama_stack.core.server.server", "/opt/app-root/run.yaml"]
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ WORKDIR /opt/app-root
33

44
RUN pip install sqlalchemy # somehow sqlalchemy[asyncio] is not sufficient
55
{dependencies}
6-
RUN pip install --no-cache llama-stack==0.2.14
6+
RUN pip install --no-cache llama-stack==0.2.18
77
RUN mkdir -p ${{HOME}}/.llama/providers.d ${{HOME}}/.cache
8-
COPY redhat-distribution/run.yaml ${{APP_ROOT}}/run.yaml
9-
COPY redhat-distribution/providers.d/ ${{HOME}}/.llama/providers.d/
8+
COPY distribution/run.yaml ${{APP_ROOT}}/run.yaml
9+
COPY distribution/providers.d/ ${{HOME}}/.llama/providers.d/
1010

11-
ENTRYPOINT ["python", "-m", "llama_stack.distribution.server.server", "--config", "/opt/app-root/run.yaml"]
11+
ENTRYPOINT ["python", "-m", "llama_stack.core.server.server", "/opt/app-root/run.yaml"]
Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
# This source code is licensed under the terms described in the LICENSE file in
66
# the root directory of this source tree.
77

8-
# Usage: ./redhat-distribution/build.py
8+
# Usage: ./distribution/build.py
99

1010
import shutil
1111
import subprocess
1212
import sys
1313
from pathlib import Path
1414

1515
BASE_REQUIREMENTS = [
16-
"llama-stack==0.2.14",
16+
"llama-stack==0.2.18",
1717
]
1818

1919

@@ -59,9 +59,11 @@ def check_llama_stack_version():
5959

6060
def get_dependencies():
6161
"""Execute the llama stack build command and capture dependencies."""
62-
cmd = "llama stack build --config redhat-distribution/build.yaml --print-deps-only"
62+
cmd = "llama stack build --config distribution/build.yaml --print-deps-only"
6363
try:
64-
result = subprocess.run(cmd, shell=True, capture_output=True, text=True, check=True)
64+
result = subprocess.run(
65+
cmd, shell=True, capture_output=True, text=True, check=True
66+
)
6567
# Categorize and sort different types of pip install commands
6668
standard_deps = []
6769
torch_deps = []
@@ -74,7 +76,9 @@ def get_dependencies():
7476
parts = line.replace("uv ", "RUN ", 1).split(" ", 3)
7577
if len(parts) >= 4: # We have packages to sort
7678
cmd_parts = parts[:3] # "RUN pip install"
77-
packages = sorted(set(parts[3].split())) # Sort the package names and remove duplicates
79+
packages = sorted(
80+
set(parts[3].split())
81+
) # Sort the package names and remove duplicates
7882

7983
# Determine command type and format accordingly
8084
if "--index-url" in line:
@@ -104,13 +108,14 @@ def get_dependencies():
104108
except subprocess.CalledProcessError as e:
105109
print(f"Error executing command: {e}")
106110
print(f"Command output: {e.output}")
111+
print(f"Command stderr: {e.stderr}")
107112
sys.exit(1)
108113

109114

110115
def generate_containerfile(dependencies):
111116
"""Generate Containerfile from template with dependencies."""
112-
template_path = Path("redhat-distribution/Containerfile.in")
113-
output_path = Path("redhat-distribution/Containerfile")
117+
template_path = Path("distribution/Containerfile.in")
118+
output_path = Path("distribution/Containerfile")
114119

115120
if not template_path.exists():
116121
print(f"Error: Template file {template_path} not found")
@@ -121,10 +126,12 @@ def generate_containerfile(dependencies):
121126
template_content = f.read()
122127

123128
# Add warning message at the top
124-
warning = "# WARNING: This file is auto-generated. Do not modify it manually.\n# Generated by: redhat-distribution/build.py\n\n"
129+
warning = "# WARNING: This file is auto-generated. Do not modify it manually.\n# Generated by: distribution/build.py\n\n"
125130

126131
# Process template using string formatting
127-
containerfile_content = warning + template_content.format(dependencies=dependencies.rstrip())
132+
containerfile_content = warning + template_content.format(
133+
dependencies=dependencies.rstrip()
134+
)
128135

129136
# Write output
130137
with open(output_path, "w") as f:

distribution/build.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
version: 2
2+
distribution_spec:
3+
description: Red Hat distribution of Llama Stack
4+
providers:
5+
inference:
6+
- provider_type: remote::vllm
7+
- provider_type: inline::sentence-transformers
8+
vector_io:
9+
- provider_type: inline::milvus
10+
safety:
11+
- provider_type: remote::trustyai_fms
12+
agents:
13+
- provider_type: inline::meta-reference
14+
eval:
15+
- provider_type: remote::trustyai_lmeval
16+
datasetio:
17+
- provider_type: remote::huggingface
18+
- provider_type: inline::localfs
19+
scoring:
20+
- provider_type: inline::basic
21+
- provider_type: inline::llm-as-judge
22+
- provider_type: inline::braintrust
23+
telemetry:
24+
- provider_type: inline::meta-reference
25+
tool_runtime:
26+
- provider_type: remote::brave-search
27+
- provider_type: remote::tavily-search
28+
- provider_type: inline::rag-runtime
29+
- provider_type: remote::model-context-protocol
30+
container_image: registry.redhat.io/ubi9/python-311:9.6-1749631027
31+
additional_pip_packages:
32+
- aiosqlite
33+
- sqlalchemy[asyncio]
34+
image_type: container
35+
image_name: llama-stack-rh
36+
external_providers_dir: distribution/providers.d

redhat-distribution/providers.d/remote/eval/trustyai_lmeval.yaml renamed to distribution/providers.d/remote/eval/trustyai_lmeval.yaml

File renamed without changes.

redhat-distribution/providers.d/remote/safety/trustyai_fms.yaml renamed to distribution/providers.d/remote/safety/trustyai_fms.yaml

File renamed without changes.

0 commit comments

Comments
 (0)