devel and torch dependencies optional

This commit is contained in:
phact 2025-09-12 13:02:56 -04:00
parent 57f893b622
commit 463bb48222
4 changed files with 23 additions and 12 deletions

View file

@ -33,7 +33,7 @@ jobs:
run: uv python install 3.13
- name: Install dependencies
run: uv sync
run: uv sync --group dev
- name: Run integration tests
env:

View file

@ -18,7 +18,7 @@ WORKDIR /app
# Copy Python dependencies
COPY pyproject.toml uv.lock ./
RUN uv sync
RUN uv sync --extra torch-cu128
# Copy sample document and warmup script for docling
COPY documents/warmup_ocr.pdf ./

View file

@ -118,7 +118,7 @@ install: install-be install-fe
install-be:
@echo "📦 Installing backend dependencies..."
uv sync
uv sync --extra torch-cu128
install-fe:
@echo "📦 Installing frontend dependencies..."
@ -184,6 +184,8 @@ test-integration:
# CI-friendly integration test target: brings up infra, waits, runs tests, tears down
test-ci:
@set -e; \
echo "📦 Installing test dependencies..."; \
uv sync --group dev; \
echo "🚀 Starting infra (OpenSearch + Dashboards + Langflow)"; \
make infra; \
echo "⏳ Waiting for OpenSearch..."; \

View file

@ -18,7 +18,6 @@ dependencies = [
"pyjwt>=2.8.0",
"python-multipart>=0.0.20",
"starlette>=0.47.1",
"torch>=2.7.1",
"uvicorn>=0.35.0",
"boto3>=1.35.0",
"psutil>=7.0.0",
@ -27,12 +26,15 @@ dependencies = [
"python-dotenv>=1.0.0",
"textual-fspicker>=0.6.0",
"structlog>=25.4.0",
"pytest>=8.0.0",
"pytest-asyncio>=0.21.0",
"pytest-mock>=3.12.0",
"pytest-cov>=4.0.0",
]
[project.optional-dependencies]
torch = ["torch", "torchvision"]
torch-cu128 = ["torch", "torchvision"]
[dependency-groups]
dev = ["pytest>=8", "pytest-asyncio>=0.21.0", "pytest-mock>=3.12.0", "pytest-cov>=4.0.0"]
[project.scripts]
openrag = "tui.main:run_tui"
@ -41,13 +43,20 @@ package = true
[tool.uv.sources]
torch = [
{ index = "pytorch-cu128", marker = "sys_platform == 'linux' and platform_machine == 'x86_64'" },
{ index = "pytorch-cu128", extra = "torch-cu128" },
{ index = "pytorch-cpu", extra = "torch" }
]
torchvision = [
{ index = "pytorch-cu128", marker = "sys_platform == 'linux' and platform_machine == 'x86_64'" },
{ index = "pytorch-cu128", extra = "torch-cu128" },
{ index = "pytorch-cpu", extra = "torch" }
]
[[tool.uv.index]]
name = "pytorch-cu128"
url = "https://download.pytorch.org/whl/cu128"
name = "pytorch-cu128"
url = "https://download.pytorch.org/whl/cu128"
explicit = true
[[tool.uv.index]]
name = "pytorch-cpu"
url = "https://download.pytorch.org/whl/cpu"
explicit = true