snesbitt Claude Opus 4.7 commited on
Commit
b7cc7d5
Β·
1 Parent(s): 6c2d894

Switch to PyPI rustmatrix wheels (v2.1.1)

Browse files

rustmatrix is now on PyPI with pre-built manylinux/macOS/Windows ABI3
wheels. Drop the Rust build stage from the Dockerfile (was cloning the
repo and building with maturin) and install directly from PyPI instead.
Also removes the uv.sources path override from pyproject.toml.

Build time drops by ~3-4 minutes on HF.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

Files changed (2) hide show
  1. Dockerfile +7 -28
  2. backend/pyproject.toml +1 -6
Dockerfile CHANGED
@@ -2,10 +2,9 @@
2
  #
3
  # Hugging Face Space Docker build for myPSD.
4
  #
5
- # Three stages:
6
- # 1. node:20-alpine β†’ compile the Vite React SPA
7
- # 2. rust:1.82-slim β†’ clone rustmatrix at v1.0.1 and build a Python wheel
8
- # 3. python:3.11-slim β†’ install the wheel + FastAPI, copy the SPA, run uvicorn
9
  #
10
  # HF Spaces routes external traffic to whatever port the container listens
11
  # on via `app_port` in README.md β€” we use 7860 (the HF default).
@@ -21,38 +20,18 @@ COPY frontend/ ./
21
  RUN npx vite build --outDir dist --emptyOutDir
22
 
23
 
24
- # ---------- stage 2: build the rustmatrix wheel ----------
25
- FROM rust:1.82-slim AS rustbuild
26
-
27
- RUN apt-get update && apt-get install -y --no-install-recommends \
28
- python3 python3-pip python3-venv python3-dev \
29
- build-essential pkg-config git \
30
- && rm -rf /var/lib/apt/lists/*
31
-
32
- RUN python3 -m pip install --break-system-packages "maturin==1.7.*"
33
-
34
- WORKDIR /src
35
- # Pin to the stable release so HF deploys are reproducible.
36
- ARG RUSTMATRIX_REF=v1.0.1
37
- RUN git clone --depth 1 --branch ${RUSTMATRIX_REF} \
38
- https://github.com/swnesbitt/rustmatrix.git .
39
- RUN maturin build --release --out /wheels -i python3
40
-
41
-
42
- # ---------- stage 3: runtime ----------
43
  FROM python:3.11-slim
44
 
45
  WORKDIR /app
46
 
47
- COPY --from=rustbuild /wheels /wheels
48
- RUN pip install --no-cache-dir /wheels/*.whl \
49
- && pip install --no-cache-dir \
50
  "fastapi>=0.110" \
51
  "uvicorn[standard]>=0.27" \
52
  "pydantic>=2.6" \
53
  "numpy>=1.23" \
54
- "scipy>=1.10" \
55
- && rm -rf /wheels
56
 
57
  # HF Spaces runs the container as uid 1000 with /tmp as the only writable
58
  # directory by default.
 
2
  #
3
  # Hugging Face Space Docker build for myPSD.
4
  #
5
+ # Two stages:
6
+ # 1. node:20-alpine β†’ compile the Vite React SPA
7
+ # 2. python:3.11-slim β†’ install rustmatrix from PyPI + FastAPI, run uvicorn
 
8
  #
9
  # HF Spaces routes external traffic to whatever port the container listens
10
  # on via `app_port` in README.md β€” we use 7860 (the HF default).
 
20
  RUN npx vite build --outDir dist --emptyOutDir
21
 
22
 
23
+ # ---------- stage 2: runtime ----------
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  FROM python:3.11-slim
25
 
26
  WORKDIR /app
27
 
28
+ RUN pip install --no-cache-dir \
29
+ "rustmatrix>=2.1.1" \
 
30
  "fastapi>=0.110" \
31
  "uvicorn[standard]>=0.27" \
32
  "pydantic>=2.6" \
33
  "numpy>=1.23" \
34
+ "scipy>=1.10"
 
35
 
36
  # HF Spaces runs the container as uid 1000 with /tmp as the only writable
37
  # directory by default.
backend/pyproject.toml CHANGED
@@ -4,7 +4,7 @@ version = "2.0.0"
4
  description = "FastAPI backend for myPSD β€” polarimetric radar PSD explorer"
5
  requires-python = ">=3.10"
6
  dependencies = [
7
- "rustmatrix>=1.0.1",
8
  "fastapi>=0.110",
9
  "uvicorn[standard]>=0.27",
10
  "pydantic>=2.6",
@@ -12,11 +12,6 @@ dependencies = [
12
  "scipy>=1.10",
13
  ]
14
 
15
- [tool.uv.sources]
16
- # rustmatrix is not on PyPI yet β€” build from the sibling checkout.
17
- # The Dockerfile builds a wheel directly and installs that instead.
18
- rustmatrix = { path = "../../Radar/rustmatrix", editable = true }
19
-
20
  [project.optional-dependencies]
21
  dev = [
22
  "pytest>=8.0",
 
4
  description = "FastAPI backend for myPSD β€” polarimetric radar PSD explorer"
5
  requires-python = ">=3.10"
6
  dependencies = [
7
+ "rustmatrix>=2.1.1",
8
  "fastapi>=0.110",
9
  "uvicorn[standard]>=0.27",
10
  "pydantic>=2.6",
 
12
  "scipy>=1.10",
13
  ]
14
 
 
 
 
 
 
15
  [project.optional-dependencies]
16
  dev = [
17
  "pytest>=8.0",