Skip to content

Commit 4bed238

Browse files
viraatcclaude
andcommitted
fix: address all PR review comments from Gemini and Copilot
- Dockerfile.dev: set UV_PROJECT_ENVIRONMENT=/opt/venv to avoid volume mount shadowing .venv, add /opt/venv/bin to PATH, create dir with correct ownership - pyproject.toml: pin uv_build==0.7.6 (exact version), fix build exclude path to inference_endpoint/evaluation/livecodebench/_server.py - .python-version: pin to 3.12.11 for reproducibility - CI workflows: add python-version-file to setup-uv in both test.yml and pre-commit.yml - .pre-commit-config.yaml: use language: python with additional_dependencies: [uv] for uv-lock-check hook - README.md: add uv installation instructions and uv run usage note - AGENTS.md: clarify build-system requires also pinned to exact versions Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 9d913f9 commit 4bed238

8 files changed

Lines changed: 21 additions & 9 deletions

File tree

.github/workflows/pre-commit.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ jobs:
1616

1717
- name: Install uv
1818
uses: astral-sh/setup-uv@e58605a9b6da7c637471fab8847a5e5a6b8df081 # v5
19+
with:
20+
python-version-file: .python-version
1921

2022
- name: Install dependencies
2123
run: uv sync --frozen --extra dev

.github/workflows/test.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ jobs:
1414

1515
- name: Install uv
1616
uses: astral-sh/setup-uv@e58605a9b6da7c637471fab8847a5e5a6b8df081 # v5
17+
with:
18+
python-version-file: .python-version
1719

1820
- name: Run tests
1921
run: uv run --frozen --extra test pytest -xv -m "not slow and not performance" --cov=src --cov-report=xml --cov-report=html
@@ -33,6 +35,8 @@ jobs:
3335

3436
- name: Install uv
3537
uses: astral-sh/setup-uv@e58605a9b6da7c637471fab8847a5e5a6b8df081 # v5
38+
with:
39+
python-version-file: .python-version
3640

3741
- name: Audit dependencies for known vulnerabilities
3842
run: uv run --frozen --extra dev --extra test --extra performance pip-audit

.pre-commit-config.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ repos:
6666
- id: uv-lock-check
6767
name: Check uv.lock is up-to-date
6868
entry: uv lock --check
69-
language: system
69+
language: python
70+
additional_dependencies: [uv]
7071
pass_filenames: false
7172
files: ^pyproject\.toml$

.python-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.12
1+
3.12.11

AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,5 +359,5 @@ Known failure modes when AI tools generate code for this project. Reference thes
359359

360360
### Dependency & Environment
361361

362-
- **Adding new dependencies without justification**: AI may `pip install` or add imports for packages not in `pyproject.toml`. Any new dependency must be justified, added to the correct optional group, and pinned to an exact version (`==`). After adding a dependency, run `pip-audit` (included in `dev` extras) to verify it has no known vulnerabilities. When adding dependencies, use `uv add <package>==<version>` to update both `pyproject.toml` and `uv.lock` atomically, then run `uv run pip-audit` to check for vulnerabilities.
362+
- **Adding new dependencies without justification**: AI may `pip install` or add imports for packages not in `pyproject.toml`. Any new runtime, dev, or test dependency must be justified, added to the correct optional group, and pinned to an exact version (`==`). After adding a dependency, run `pip-audit` (included in `dev` extras) to verify it has no known vulnerabilities. When adding dependencies, use `uv add <package>==<version>` to update both `pyproject.toml` and `uv.lock` atomically, then run `uv run pip-audit` to check for vulnerabilities. Note: `[build-system] requires` is also pinned to exact versions for reproducibility.
363363
- **Using `requests`/`aiohttp` for HTTP**: This project has its own HTTP client (`endpoint_client/http.py`) using `httptools`. AI defaults to `requests` or `aiohttp` — these should not appear in production code (test dependencies are fine).

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ git clone https://github.com/mlcommons/endpoints.git
1515
cd endpoints
1616
```
1717

18-
This project uses [uv](https://docs.astral.sh/uv/) for dependency management. All dependencies are pinned in `uv.lock`.
18+
This project uses [uv](https://docs.astral.sh/uv/) for dependency management. All dependencies are pinned in `uv.lock`. Install uv first: `curl -LsSf https://astral.sh/uv/install.sh | sh` (see [uv installation docs](https://docs.astral.sh/uv/getting-started/installation/) for other methods).
1919

2020
```bash
2121
# Install dependencies
@@ -24,6 +24,9 @@ uv sync
2424
# For development (includes linting, testing, and type-checking tools)
2525
uv sync --extra dev --extra test
2626
uv run pre-commit install
27+
28+
# Run project commands with `uv run ...`, or activate the venv directly:
29+
# source .venv/bin/activate
2730
```
2831

2932
<details>

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[build-system]
2-
requires = ["uv_build>=0.7.6,<0.8"]
2+
requires = ["uv_build==0.7.6"]
33
build-backend = "uv_build"
44

55
[tool.uv]
@@ -14,7 +14,7 @@ environments = [
1414
[tool.uv-build]
1515
module-root = "src"
1616
data = {"inference_endpoint" = ["config/templates/*.yaml"]}
17-
exclude = ["evaluation/livecodebench/_server.py"]
17+
exclude = ["inference_endpoint/evaluation/livecodebench/_server.py"]
1818

1919
[project]
2020
name = "inference-endpoint"

scripts/Dockerfile.dev

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ COPY --from=ghcr.io/astral-sh/uv:0.7.6 /uv /uvx /bin/
1212
ENV PYTHONUNBUFFERED=1 \
1313
PYTHONDONTWRITEBYTECODE=1 \
1414
UV_COMPILE_BYTECODE=1 \
15-
UV_LINK_MODE=copy
15+
UV_LINK_MODE=copy \
16+
UV_PROJECT_ENVIRONMENT=/opt/venv
1617

1718
# Install system dependencies
1819
RUN apt-get update && \
@@ -34,8 +35,9 @@ RUN if ! getent group ${GROUP_ID}; then \
3435
groupadd -g ${GROUP_ID} appuser; \
3536
fi && \
3637
useradd -u ${USER_ID} -g ${GROUP_ID} --create-home --shell /bin/bash appuser --no-log-init && \
37-
chown -R ${USER_ID}:${GROUP_ID} /mnt/inference-endpoint
38+
chown -R ${USER_ID}:${GROUP_ID} /mnt/inference-endpoint && \
39+
mkdir -p /opt/venv && chown ${USER_ID}:${GROUP_ID} /opt/venv
3840
USER appuser
39-
ENV PATH="/home/appuser/.local/bin:$PATH"
41+
ENV PATH="/opt/venv/bin:/home/appuser/.local/bin:$PATH"
4042

4143
RUN uv sync --frozen --extra dev --extra test

0 commit comments

Comments
 (0)