Skip to content

Commit 6291eb9

Browse files
authored
Merge pull request #292 from matysek/lcore-399
LCORE-497, LCORE-498, LCORE-499: Bundle most of ansible, assist-installer, default run.yaml dependencies, with pytorch and libs that depends on it.
2 parents 78bcd6a + ae83068 commit 6291eb9

File tree

7 files changed

+590
-323
lines changed

7 files changed

+590
-323
lines changed

.github/workflows/pylint.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ jobs:
1818
with:
1919
python-version: '3.12'
2020
- name: Install dependencies
21-
run: uv sync
21+
run: uv sync --group llslibdev
2222
- name: Python linter
2323
run: uv run pylint src tests

.github/workflows/pyright.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ jobs:
1818
with:
1919
python-version: '3.12'
2020
- name: Install dependencies
21-
run: uv sync
21+
run: uv sync --group llslibdev
2222
- name: Run Pyright tests
2323
run: uv run pyright src

.github/workflows/unit_tests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
- name: uv version
2525
run: uv --version
2626
- name: Install dependencies
27-
run: uv pip install --python ${{ matrix.python-version }} -e .
27+
run: uv pip install --python ${{ matrix.python-version }} --group llslibdev .
2828
- name: Install pdm # Required for dynamic version test
2929
run: uv pip install pdm
3030
- name: Run unit tests

Containerfile

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# vim: set filetype=dockerfile
2-
FROM registry.access.redhat.com/ubi9/python-312-minimal AS builder
2+
FROM registry.access.redhat.com/ubi9/python-312 AS builder
33

44
ARG APP_ROOT=/app-root
55
ARG LSC_SOURCE_DIR=.
@@ -11,16 +11,21 @@ ENV UV_COMPILE_BYTECODE=0 \
1111

1212
WORKDIR /app-root
1313

14+
# Install gcc - required by polyleven python package on aarch64
15+
# (dependency of autoevals, no pre-built binary wheels for linux on aarch64)
16+
USER root
17+
RUN dnf install -y --nodocs --setopt=keepcache=0 --setopt=tsflags=nodocs gcc
18+
1419
# Install uv package manager
15-
RUN pip3.12 install uv
20+
RUN pip3.12 install "uv==0.8.11"
1621

1722
# Add explicit files and directories
1823
# (avoid accidental inclusion of local directories or env files or credentials)
1924
COPY ${LSC_SOURCE_DIR}/src ./src
2025
COPY ${LSC_SOURCE_DIR}/pyproject.toml ${LSC_SOURCE_DIR}/LICENSE ${LSC_SOURCE_DIR}/README.md ${LSC_SOURCE_DIR}/uv.lock ./
2126

22-
RUN uv sync --locked --no-dev
23-
27+
# Bundle additional dependencies for library mode.
28+
RUN uv sync --locked --no-dev --group llslibdev
2429

2530
# Final image without uv package manager
2631
FROM registry.access.redhat.com/ubi9/python-312-minimal
@@ -42,6 +47,11 @@ COPY --from=builder --chown=1001:1001 /app-root /app-root
4247
# this directory is checked by ecosystem-cert-preflight-checks task in Konflux
4348
COPY --from=builder /app-root/LICENSE /licenses/
4449

50+
# Add uv to final image for derived images to add additional dependencies
51+
# with command:
52+
# $ uv pip install <dependency>
53+
RUN pip3.12 install "uv==0.8.11"
54+
4555
# Add executables from .venv to system PATH
4656
ENV PATH="/app-root/.venv/bin:$PATH"
4757

pyproject.toml

Lines changed: 50 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ requires-python = ">=3.12,<3.14"
2222
readme = "README.md"
2323
license = {file = "LICENSE"}
2424
dependencies = [
25-
"fastapi>=0.115.6",
25+
"fastapi>=0.115.12",
2626
"uvicorn>=0.34.3",
2727
"kubernetes>=30.1.0",
2828
"llama-stack==0.2.17",
@@ -33,11 +33,12 @@ dependencies = [
3333
"starlette>=0.47.1",
3434
"aiohttp>=3.12.14",
3535
"authlib>=1.6.0",
36-
"openai==1.99.1",
37-
"sqlalchemy>=2.0.42",
3836
"email-validator>=2.2.0",
37+
"openai==1.99.9",
38+
"sqlalchemy>=2.0.42",
3939
]
4040

41+
4142
[tool.pyright]
4243
exclude = [
4344
# TODO(lucasagomes): This module was copied from road-core
@@ -61,6 +62,15 @@ lightspeed-stack = "lightspeed_stack:main"
6162
Homepage = "https://github.com/lightspeed-core/lightspeed-stack"
6263
Issues = "https://github.com/lightspeed-core/lightspeed-stack/issues"
6364

65+
# PyTorch has multiple wheel variants for different backends - cpu, gpu, etc.
66+
# By default on pypi.org is the gpu variant. Forces uv to use the cpu variant.
67+
[[tool.uv.index]]
68+
name = "pytorch-cpu"
69+
url = "https://download.pytorch.org/whl/cpu"
70+
explicit = true
71+
[tool.uv.sources]
72+
torch = [{ index = "pytorch-cpu" }]
73+
6474
[dependency-groups]
6575
dev = [
6676
"black>=25.1.0",
@@ -83,23 +93,49 @@ dev = [
8393
"openapi-to-md>=0.1.0b2",
8494
]
8595
llslibdev = [
86-
"fastapi>=0.115.12",
87-
"opentelemetry-sdk>=1.34.0",
88-
"opentelemetry-exporter-otlp>=1.34.0",
89-
"opentelemetry-instrumentation>=0.55b0",
96+
# To check llama-stack API provider dependecies:
97+
#
98+
# $ uv run llama stack list-providers
99+
#
100+
# API agents: inline::meta-reference
101+
"matplotlib>=3.10.0",
102+
"pillow>=11.1.0",
103+
"pandas>=2.2.3",
104+
"scikit-learn>=1.5.2",
105+
"psycopg2-binary>=2.9.10",
106+
# API eval: inline::meta-reference
107+
"tree_sitter>=0.24.0",
108+
"pythainlp>=3.0.10",
109+
"langdetect>=1.0.9",
110+
"emoji>=2.1.0",
111+
"nltk>=3.8.1",
112+
# API inference: remote::gemini
113+
"litellm>=1.75.5.post1",
114+
# API vector_io: inline::faiss
115+
"faiss-cpu>=1.11.0",
116+
# API scoring: inline::basic
117+
"requests>=2.32.4",
118+
# API datasetio: inline::localfs
90119
"aiosqlite>=0.21.0",
91-
"litellm>=1.72.1",
92-
"uvicorn>=0.34.3",
93-
"blobfile>=3.0.0",
120+
# API datasetio: remote::huggingface
94121
"datasets>=3.6.0",
95-
"sqlalchemy>=2.0.41",
96-
"faiss-cpu>=1.11.0",
122+
# API telemetry: inline::meta-reference
123+
"opentelemetry-sdk>=1.34.1",
124+
"opentelemetry-exporter-otlp>=1.34.1",
125+
# API tool_runtime: inline::rag-runtime
126+
"transformers>=4.34.0",
127+
"numpy==2.2.6",
128+
# API tool_runtime: remote::model-context-protocol
97129
"mcp>=1.9.4",
130+
# Other
98131
"autoevals>=0.0.129",
99-
"psutil>=7.0.0",
100-
"torch>=2.7.1",
132+
"torch==2.7.1",
101133
"peft>=0.15.2",
102134
"trl>=0.18.2",
135+
"fire>=0.7.0",
136+
"opentelemetry-instrumentation>=0.55b0",
137+
"blobfile>=3.0.0",
138+
"psutil>=7.0.0",
103139
]
104140

105141
build = [

test.containerfile

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,6 @@ RUN uv -h
2323
# Install from pyproject.toml using uv sync for version consistency
2424
# Note: using --no-install-project since this is llama-stack container, not lightspeed-stack
2525
# Include dev deps for testing (pytest, behave, etc.)
26-
RUN uv sync --locked --no-install-project && \
27-
uv pip install \
28-
opentelemetry-sdk \
29-
opentelemetry-exporter-otlp \
30-
opentelemetry-instrumentation \
31-
aiosqlite \
32-
litellm \
33-
blobfile \
34-
datasets \
35-
sqlalchemy \
36-
faiss-cpu \
37-
mcp \
38-
autoevals \
39-
psutil \
40-
torch \
41-
peft \
42-
trl
26+
RUN uv sync --locked --no-install-project --group dev --group llslibdev
4327

4428
CMD ["uv", "run", "llama", "stack", "run", "run.yaml"]

0 commit comments

Comments
 (0)