Skip to content

Commit 59ee7e9

Browse files
committed
pip -> uv, CI and deploy updated accordingly
1 parent feb00fa commit 59ee7e9

18 files changed

+3201
-233
lines changed

.github/workflows/docs.yml

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,13 @@ jobs:
3131
- name: Checkout repository
3232
uses: actions/checkout@v4
3333

34-
- name: Set up Python
35-
uses: actions/setup-python@v5
34+
- name: Set up uv
35+
uses: astral-sh/setup-uv@v5
3636
with:
37-
python-version: '3.12'
38-
39-
- name: Cache pip dependencies
40-
uses: actions/cache@v4
41-
with:
42-
key: mkdocs-${{ hashFiles('mkdocs.yml') }}
43-
path: ~/.cache/pip
44-
restore-keys: mkdocs-
37+
enable-cache: true
4538

4639
- name: Install MkDocs
47-
run: pip install mkdocs-material mkdocs-mermaid2-plugin mkdocs-swagger-ui-tag
40+
run: uv tool install mkdocs-material --with mkdocs-mermaid2-plugin --with mkdocs-swagger-ui-tag
4841

4942
- name: Download OpenAPI spec
5043
run: |

.github/workflows/mypy.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,21 @@ jobs:
1313
runs-on: ubuntu-latest
1414
steps:
1515
- uses: actions/checkout@v4
16-
- name: Set up Python
17-
uses: actions/setup-python@v4
16+
17+
- name: Set up uv
18+
uses: astral-sh/setup-uv@v5
1819
with:
19-
python-version: '3.12'
20+
enable-cache: true
21+
cache-dependency-glob: "backend/uv.lock"
22+
2023
- name: Install dependencies
2124
run: |
22-
python -m pip install --upgrade pip
23-
pip install mypy
24-
pip install -r backend/requirements.txt
25-
pip install -r backend/requirements-dev.txt
25+
cd backend
26+
uv sync --frozen
27+
2628
- name: Run mypy
2729
env:
2830
SECRET_KEY: ${{ secrets.TEST_SECRET_KEY }}
2931
run: |
3032
cd backend
31-
mypy --config-file pyproject.toml .
33+
uv run mypy --config-file pyproject.toml .

.github/workflows/ruff.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,14 @@ jobs:
1313
runs-on: ubuntu-latest
1414
steps:
1515
- uses: actions/checkout@v4
16-
- name: Set up Python
17-
uses: actions/setup-python@v4
16+
17+
- name: Set up uv
18+
uses: astral-sh/setup-uv@v5
1819
with:
19-
python-version: '3.12'
20-
- name: Install dependencies
21-
run: |
22-
python -m pip install --upgrade pip
23-
pip install ruff
20+
enable-cache: true
21+
cache-dependency-glob: "backend/uv.lock"
22+
2423
- name: Run ruff
25-
run: ruff check backend/ --config backend/pyproject.toml
24+
run: |
25+
cd backend
26+
uv run ruff check . --config pyproject.toml

.github/workflows/security.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,15 @@ jobs:
1313
runs-on: ubuntu-latest
1414
steps:
1515
- uses: actions/checkout@v4
16-
- name: Set up Python
17-
uses: actions/setup-python@v4
16+
17+
- name: Set up uv
18+
uses: astral-sh/setup-uv@v5
1819
with:
19-
python-version: '3.12'
20-
- name: Install dependencies
21-
run: |
22-
python -m pip install --upgrade pip
23-
pip install bandit safety
20+
enable-cache: true
21+
cache-dependency-glob: "backend/uv.lock"
22+
23+
- name: Install bandit
24+
run: uv tool install bandit
25+
2426
- name: Run bandit
25-
run: bandit -r backend/ -x backend/tests/ -ll
27+
run: bandit -r backend/ -x backend/tests/ -ll

.github/workflows/tests.yml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ jobs:
130130
docker compose -f docker-compose.ci.yaml logs
131131
exit 1
132132
)
133-
133+
134134
echo "Services started. Waiting for stabilization..."
135135
sleep 45
136136
@@ -145,7 +145,7 @@ jobs:
145145
146146
echo "Checking backend logs:"
147147
docker compose -f docker-compose.ci.yaml logs backend || echo "backend not found"
148-
148+
149149
# Explicitly check for containers that have exited
150150
if docker compose -f docker-compose.ci.yaml ps | grep -q 'Exit'; then
151151
echo "::error::One or more containers have exited unexpectedly. See logs above."
@@ -171,18 +171,16 @@ jobs:
171171
kubectl get roles -n default
172172
kubectl get rolebindings -n default
173173
174-
- name: Set up Python for Tests
175-
uses: actions/setup-python@v4
174+
- name: Set up uv
175+
uses: astral-sh/setup-uv@v5
176176
with:
177-
python-version: '3.12'
177+
enable-cache: true
178+
cache-dependency-glob: "backend/uv.lock"
178179

179180
- name: Install Python test dependencies
180181
run: |
181-
sudo apt-get update
182-
sudo apt-get install -y python3 python3-pip
183182
cd backend
184-
pip3 install -r requirements.txt
185-
pip3 install -r requirements-dev.txt
183+
uv sync --frozen
186184
187185
- name: Run backend tests with coverage
188186
timeout-minutes: 5
@@ -202,7 +200,7 @@ jobs:
202200
echo "Using BACKEND_BASE_URL=$BACKEND_BASE_URL"
203201
echo "Using SCHEMA_SUBJECT_PREFIX=$SCHEMA_SUBJECT_PREFIX"
204202
echo "MongoDB connection will use default CI credentials"
205-
python -m pytest tests/integration tests/unit -v --cov=app --cov-branch --cov-report=xml --cov-report=term --cov-report=term-missing
203+
uv run pytest tests/integration tests/unit -v --cov=app --cov-branch --cov-report=xml --cov-report=term --cov-report=term-missing
206204
207205
- name: Upload coverage to Codecov
208206
uses: codecov/codecov-action@v5

backend/Dockerfile

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@ RUN apt-get update && apt-get upgrade -y liblzma-dev liblzma5 xz-utils && \
66
apt-get install -y libsnappy-dev && \
77
rm -rf /var/lib/apt/lists/*
88

9-
## Remove kubectl from runtime image: rely on Python client only
9+
# Install uv
10+
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
1011

11-
# Install Python dependencies
12-
COPY requirements.txt .
13-
RUN pip install --no-cache-dir --upgrade pip setuptools>=70.0.0 wheel
14-
RUN pip install --no-cache-dir -r requirements.txt
12+
# Copy dependency files
13+
COPY pyproject.toml uv.lock ./
14+
15+
# Install Python dependencies (production only, no dev deps)
16+
RUN uv sync --frozen --no-dev
1517

1618
# Copy application files and configuration
1719
COPY ./app /app/app
@@ -33,7 +35,7 @@ CMD bash -c "\
3335
# Use kubeconfig if present, but do not block startup\
3436
if [ -f /app/kubeconfig.yaml ]; then export KUBECONFIG=/app/kubeconfig.yaml; fi && \
3537
WEB_CONCURRENCY=${WEB_CONCURRENCY:-4} WEB_THREADS=${WEB_THREADS:-1} WEB_TIMEOUT=${WEB_TIMEOUT:-60} \
36-
gunicorn app.main:app \
38+
uv run gunicorn app.main:app \
3739
-k uvicorn.workers.UvicornWorker \
3840
--bind 0.0.0.0:443 \
3941
--workers ${WEB_CONCURRENCY} \

backend/Dockerfile.test

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,14 @@ RUN apt-get update && apt-get install -y \
99
curl \
1010
&& rm -rf /var/lib/apt/lists/*
1111

12-
# Copy requirements
13-
COPY requirements.txt requirements-dev.txt ./
12+
# Install uv
13+
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
1414

15-
# Install Python dependencies
16-
RUN pip install --no-cache-dir -r requirements.txt -r requirements-dev.txt
15+
# Copy dependency files
16+
COPY pyproject.toml uv.lock ./
17+
18+
# Install Python dependencies (including dev deps for testing)
19+
RUN uv sync --frozen
1720

1821
# Copy application code
1922
COPY . .
@@ -22,4 +25,4 @@ COPY . .
2225
ENV PYTHONPATH=/app
2326

2427
# Default command runs all tests
25-
CMD ["pytest", "-v", "--tb=short"]
28+
CMD ["uv", "run", "pytest", "-v", "--tb=short"]

backend/pyproject.toml

Lines changed: 172 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,175 @@
1+
[project]
2+
name = "integr8scode"
3+
version = "0.1.0"
4+
description = "Run Python scripts online in isolated Kubernetes pods"
5+
requires-python = ">=3.12"
6+
dependencies = [
7+
"aiohappyeyeballs==2.6.1",
8+
"aiohttp==3.13.2",
9+
"aiosignal==1.4.0",
10+
"aiosmtplib==3.0.2",
11+
"annotated-doc==0.0.4",
12+
"annotated-types==0.7.0",
13+
"anyio==4.9.0",
14+
"asgiref==3.9.1",
15+
"async-timeout==5.0.1",
16+
"attrs==25.3.0",
17+
"avro-python3==1.10.2",
18+
"backoff==2.2.1",
19+
"blinker==1.8.2",
20+
"Brotli==1.2.0",
21+
"cachetools==6.2.0",
22+
"certifi==2024.8.30",
23+
"charset-normalizer==3.4.0",
24+
"click==8.1.7",
25+
"ConfigArgParse==1.7.1",
26+
"confluent-kafka==2.6.1",
27+
"contourpy==1.3.3",
28+
"cycler==0.12.1",
29+
"Deprecated==1.2.14",
30+
"dishka==1.6.0",
31+
"dnspython==2.7.0",
32+
"durationpy==0.9",
33+
"email_validator==2.2.0",
34+
"exceptiongroup==1.2.2",
35+
"fastapi==0.124.0",
36+
"fastavro==1.12.1",
37+
"fonttools==4.59.2",
38+
"frozenlist==1.7.0",
39+
"google-auth==1.6.3",
40+
"googleapis-common-protos==1.70.0",
41+
"greenlet==3.1.1",
42+
"grpcio==1.74.0",
43+
"gunicorn==23.0.0",
44+
"h11==0.16.0",
45+
"httpcore==1.0.9",
46+
"httpx==0.28.1",
47+
"idna==3.10",
48+
"importlib-metadata==6.11.0",
49+
"importlib_resources==6.4.5",
50+
"itsdangerous==2.2.0",
51+
"Jinja2==3.1.6",
52+
"kiwisolver==1.4.9",
53+
"kubernetes==31.0.0",
54+
"limits==3.13.0",
55+
"markdown-it-py==3.0.0",
56+
"MarkupSafe==3.0.2",
57+
"mdurl==0.1.2",
58+
"motor==3.6.0",
59+
"msgpack==1.1.0",
60+
"multidict==6.6.3",
61+
"oauthlib==3.2.2",
62+
"opentelemetry-api==1.22.0",
63+
"opentelemetry-exporter-otlp==1.22.0",
64+
"opentelemetry-exporter-otlp-proto-common==1.22.0",
65+
"opentelemetry-exporter-otlp-proto-grpc==1.22.0",
66+
"opentelemetry-exporter-otlp-proto-http==1.22.0",
67+
"opentelemetry-exporter-prometheus==0.43b0",
68+
"opentelemetry-instrumentation==0.43b0",
69+
"opentelemetry-instrumentation-asgi==0.43b0",
70+
"opentelemetry-instrumentation-fastapi==0.43b0",
71+
"opentelemetry-instrumentation-httpx==0.43b0",
72+
"opentelemetry-instrumentation-logging==0.43b0",
73+
"opentelemetry-instrumentation-pymongo==0.43b0",
74+
"opentelemetry-instrumentation-redis==0.43b0",
75+
"opentelemetry-propagator-b3==1.22.0",
76+
"opentelemetry-proto==1.22.0",
77+
"opentelemetry-sdk==1.22.0",
78+
"opentelemetry-semantic-conventions==0.43b0",
79+
"opentelemetry-util-http==0.43b0",
80+
"packaging==24.1",
81+
"passlib==1.7.4",
82+
"pathspec==0.12.1",
83+
"prometheus-fastapi-instrumentator==7.0.0",
84+
"prometheus_client==0.21.0",
85+
"propcache==0.3.2",
86+
"protobuf==4.25.8",
87+
"psutil==6.1.0",
88+
"pyasn1==0.6.1",
89+
"pyasn1_modules==0.4.1",
90+
"pydantic==2.9.2",
91+
"pydantic-avro==0.7.1",
92+
"pydantic-settings==2.5.2",
93+
"pydantic_core==2.23.4",
94+
"Pygments==2.19.2",
95+
"PyJWT==2.9.0",
96+
"pymongo==4.9.2",
97+
"pyparsing==3.2.3",
98+
"python-dateutil==2.9.0.post0",
99+
"python-dotenv==1.0.1",
100+
"python-json-logger==2.0.7",
101+
"python-multipart==0.0.18",
102+
"PyYAML==6.0.2",
103+
"pyzmq==26.2.0",
104+
"redis==5.2.1",
105+
"regex==2025.8.29",
106+
"requests==2.32.3",
107+
"requests-oauthlib==2.0.0",
108+
"rich==13.9.4",
109+
"rsa==4.9",
110+
"setuptools==80.9.0",
111+
"six==1.16.0",
112+
"slowapi==0.1.9",
113+
"sniffio==1.3.1",
114+
"sortedcontainers==2.4.0",
115+
"sse-starlette==2.2.1",
116+
"starlette==0.49.1",
117+
"tiktoken==0.11.0",
118+
"tomli==2.0.2",
119+
"typing_extensions==4.12.2",
120+
"urllib3==2.6.0",
121+
"uvicorn==0.34.2",
122+
"websocket-client==1.8.0",
123+
"Werkzeug==3.0.4",
124+
"wrapt==1.16.0",
125+
"yarl==1.20.1",
126+
"zipp==3.20.2",
127+
]
128+
129+
[project.optional-dependencies]
130+
dev = [
131+
"coverage==7.6.2",
132+
"hypothesis==6.103.4",
133+
"iniconfig==2.0.0",
134+
"matplotlib==3.9.2",
135+
"mypy==1.17.1",
136+
"mypy_extensions==1.1.0",
137+
"pipdeptree==2.23.4",
138+
"pluggy==1.5.0",
139+
"pytest==8.3.3",
140+
"pytest-asyncio==0.24.0",
141+
"pytest-cov==5.0.0",
142+
"pytest-xdist==3.6.1",
143+
"ruff==0.12.7",
144+
"types-cachetools==6.2.0.20250827",
145+
"types-confluent-kafka==1.3.6",
146+
]
147+
1148
[build-system]
2-
requires = ["setuptools>=65.5.1", "wheel"]
3-
build-backend = "setuptools.build_meta"
149+
requires = ["hatchling"]
150+
build-backend = "hatchling.build"
151+
152+
[tool.hatch.build.targets.wheel]
153+
packages = ["app", "workers"]
154+
155+
[dependency-groups]
156+
dev = [
157+
"coverage==7.6.2",
158+
"hypothesis==6.103.4",
159+
"iniconfig==2.0.0",
160+
"matplotlib==3.9.2",
161+
"mypy==1.17.1",
162+
"mypy_extensions==1.1.0",
163+
"pipdeptree==2.23.4",
164+
"pluggy==1.5.0",
165+
"pytest==8.3.3",
166+
"pytest-asyncio==0.24.0",
167+
"pytest-cov==5.0.0",
168+
"pytest-xdist==3.6.1",
169+
"ruff==0.12.7",
170+
"types-cachetools==6.2.0.20250827",
171+
"types-confluent-kafka==1.3.6",
172+
]
4173

5174
# Ruff configuration
6175
[tool.ruff]
@@ -59,4 +228,4 @@ log_cli = false
59228
log_cli_level = "ERROR"
60229
log_capture = true
61230
log_level = "ERROR"
62-
addopts = "-n 4 --dist loadfile --tb=short -q --no-header -q"
231+
addopts = "-n 4 --dist loadfile --tb=short -q --no-header -q"

0 commit comments

Comments
 (0)