Skip to content

Commit b68d02f

Browse files
committed
update dependency manager pip to uv
1 parent e4a92f5 commit b68d02f

14 files changed

+4134
-21
lines changed

.devcontainer/devcontainer.json

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
{
22
"name": "Multi Agent Custom Automation Engine Solution Accelerator",
3-
"image": "mcr.microsoft.com/devcontainers/javascript-node:20-bullseye",
3+
"image": "mcr.microsoft.com/devcontainers/python:3.11-bullseye",
44
"features": {
5-
"ghcr.io/devcontainers/features/docker-in-docker:2": {
6-
},
5+
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
76
"ghcr.io/azure/azure-dev/azd:latest": {},
8-
"ghcr.io/devcontainers/features/azure-cli:1": {}
7+
"ghcr.io/devcontainers/features/node:1": {},
8+
"ghcr.io/devcontainers/features/azure-cli:1": {},
9+
"ghcr.io/jsburckhardt/devcontainer-features/uv:1": {}
910
},
1011
"customizations": {
1112
"vscode": {
@@ -18,13 +19,30 @@
1819
"ms-azuretools.vscode-bicep",
1920
"ms-azuretools.vscode-docker",
2021
"ms-vscode.js-debug",
21-
"ms-vscode.vscode-node-azure-pack"
22+
"ms-vscode.vscode-node-azure-pack",
23+
"charliermarsh.ruff",
24+
"exiasr.hadolint",
25+
"kevinrose.vsc-python-indent",
26+
"mosapride.zenkaku",
27+
"ms-python.python",
28+
"njpwerner.autodocstring",
29+
"redhat.vscode-yaml",
30+
"shardulm94.trailing-spaces",
31+
"tamasfe.even-better-toml",
32+
"yzhang.markdown-all-in-one",
33+
"ms-vscode.azure-account"
2234
]
2335
}
2436
},
25-
"forwardPorts": [3000, 3100],
26-
"remoteUser": "node",
37+
"postCreateCommand": "bash ./.devcontainer/setupEnv.sh",
38+
"containerEnv": {
39+
"DISPLAY": "dummy",
40+
"PYTHONUNBUFFERED": "True",
41+
"UV_LINK_MODE": "copy",
42+
"UV_PROJECT_ENVIRONMENT": "/home/vscode/.venv"
43+
},
44+
"remoteUser": "vscode",
2745
"hostRequirements": {
2846
"memory": "8gb"
2947
}
30-
}
48+
}

.devcontainer/setupEnv.sh

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,25 @@
11
#!/bin/bash
22

3-
pip install --upgrade pip
3+
cd ./src/backend
4+
uv add -r requirements.txt
45

6+
cd ../frontend
7+
uv add -r requirements.txt
58

6-
(cd ./src/frontend; pip install -r requirements.txt)
9+
cd ..
710

811

9-
(cd ./src/backend; pip install -r requirements.txt)
12+
13+
14+
15+
16+
17+
# pip install --upgrade pip
18+
19+
20+
# (cd ./src/frontend; pip install -r requirements.txt)
21+
22+
23+
# (cd ./src/backend; pip install -r requirements.txt)
1024

1125

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"folders": [
3+
{
4+
"path": "."
5+
},
6+
// {
7+
// "path": "./src/frontend"
8+
// },
9+
// {
10+
// "path": "./src/backend"
11+
// }
12+
]
13+
}

src/backend/.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.11

src/backend/Dockerfile

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,31 @@
11
# Base Python image
2-
FROM python:3.11-slim
2+
FROM mcr.microsoft.com/devcontainers/python:3.11-bullseye AS base
3+
WORKDIR /app
34

5+
FROM base AS builder
6+
COPY --from=ghcr.io/astral-sh/uv:0.6.3 /uv /uvx /bin/
7+
ENV UV_COMPILE_BYTECODE=1 UV_LINK_MODE=copy
8+
9+
WORKDIR /app
10+
COPY uv.lock pyproject.toml /app/
11+
12+
# Install the project's dependencies using the lockfile and settings
13+
RUN --mount=type=cache,target=/root/.cache/uv \
14+
--mount=type=bind,source=uv.lock,target=uv.lock \
15+
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
16+
uv sync --frozen --no-install-project --no-dev
417

518
# Backend app setup
6-
WORKDIR /src/backend
7-
COPY . .
19+
COPY . /app
20+
RUN --mount=type=cache,target=/root/.cache/uv uv sync --frozen --no-dev
21+
22+
FROM base
23+
24+
COPY --from=builder /app /app
25+
COPY --from=builder /bin/uv /bin/uv
26+
27+
ENV PATH="/app/.venv/bin:$PATH"
828
# Install dependencies
9-
RUN pip install --no-cache-dir -r requirements.txt
29+
1030
EXPOSE 8000
11-
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]
31+
CMD ["uv", "run", "uvicorn", "app_kernel:app", "--host", "0.0.0.0", "--port", "8000"]

src/backend/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
## Execute backend API Service
2+
```shell
3+
uv run uvicorn app_kernel:app --port 8000
4+
```

src/backend/pyproject.toml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
[project]
2+
name = "backend"
3+
version = "0.1.0"
4+
description = "Add your description here"
5+
readme = "README.md"
6+
requires-python = ">=3.11"
7+
dependencies = [
8+
"azure-ai-evaluation>=1.5.0",
9+
"azure-ai-inference>=1.0.0b9",
10+
"azure-ai-projects>=1.0.0b9",
11+
"azure-cosmos>=4.9.0",
12+
"azure-identity>=1.21.0",
13+
"azure-monitor-events-extension>=0.1.0",
14+
"azure-monitor-opentelemetry>=1.6.8",
15+
"azure-search-documents>=11.5.2",
16+
"fastapi>=0.115.12",
17+
"openai>=1.75.0",
18+
"opentelemetry-api>=1.31.1",
19+
"opentelemetry-exporter-otlp-proto-grpc>=1.31.1",
20+
"opentelemetry-exporter-otlp-proto-http>=1.31.1",
21+
"opentelemetry-instrumentation-fastapi>=0.52b1",
22+
"opentelemetry-instrumentation-openai>=0.39.2",
23+
"opentelemetry-sdk>=1.31.1",
24+
"pytest>=8.2,<9",
25+
"pytest-asyncio==0.24.0",
26+
"pytest-cov==5.0.0",
27+
"python-dotenv>=1.1.0",
28+
"python-multipart>=0.0.20",
29+
"semantic-kernel>=1.28.1",
30+
"uvicorn>=0.34.2",
31+
]

src/backend/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
fastapi
22
uvicorn
3+
34
azure-cosmos
45
azure-monitor-opentelemetry
56
azure-monitor-events-extension

0 commit comments

Comments
 (0)