File tree Expand file tree Collapse file tree
src/mock_vws/_flask_server Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ dependencies = [
4444 " responses>=0.25.3" ,
4545 " torch>=2.5.1" ,
4646 " torchmetrics>=1.5.1" ,
47+ " torchvision>=0.20.1" ,
4748 " tzdata; sys_platform=='win32'" ,
4849 " vws-auth-tools>=2024.7.12" ,
4950 " werkzeug>=3.1.2" ,
@@ -138,6 +139,11 @@ fallback_version = "0.0.0"
138139# Code to match this is in ``conf.py``.
139140version_scheme = " post-release"
140141
142+ [tool .uv ]
143+ sources.torch = { index = " pytorch-cpu" }
144+ sources.torchvision = { index = " pytorch-cpu" }
145+ index = [ { name = " pytorch-cpu" , url = " https://download.pytorch.org/whl/cpu" , explicit = true } ]
146+
141147[tool .ruff ]
142148line-length = 79
143149lint.select = [
@@ -312,6 +318,9 @@ per_rule_ignores.DEP002 = [
312318 # tzdata is needed on Windows for zoneinfo to work.
313319 # See https://docs.python.org/3/library/zoneinfo.html#data-sources.
314320 " tzdata" ,
321+ # torchvision is used transitively via piq, but must be a direct dependency
322+ # so that tool.uv.sources can route it to the CPU-only PyTorch index.
323+ " torchvision" ,
315324]
316325
317326[tool .pyproject-fmt ]
Original file line number Diff line number Diff line change @@ -12,12 +12,13 @@ COPY --chown=myuser:myuser . /app
1212# See https://pythonspeed.com/articles/activate-virtualenv-dockerfile/
1313# For why we use this method of activating the virtual environment.
1414ENV VIRTUAL_ENV=/app/docker_venvs/.venv
15- RUN python3 -m venv $VIRTUAL_ENV
15+ ENV UV_PROJECT_ENVIRONMENT=/app/docker_venvs/. venv
1616ENV PATH="$VIRTUAL_ENV/bin:$PATH"
1717
1818WORKDIR /app
19- RUN pip install --no-cache-dir uv==0.10.4 && \
20- uv pip install --no-cache-dir --upgrade --editable .
19+ RUN python3 -m venv $VIRTUAL_ENV && \
20+ pip install --no-cache-dir uv==0.10.4 && \
21+ uv sync --no-cache
2122EXPOSE 5000
2223ENTRYPOINT ["python" ]
2324HEALTHCHECK --interval=1s --timeout=10s --start-period=5s --retries=3 CMD ["python" , "/app/src/mock_vws/_flask_server/healthcheck.py" ]
You can’t perform that action at this time.
0 commit comments