Skip to content

feat: move to uv from pip#275

Open
viraatc wants to merge 23 commits intomainfrom
feat/viraatc-uv
Open

feat: move to uv from pip#275
viraatc wants to merge 23 commits intomainfrom
feat/viraatc-uv

Conversation

@viraatc
Copy link
Copy Markdown
Collaborator

@viraatc viraatc commented Apr 10, 2026

What does this PR do?

close #274

Type of change

  • Bug fix
  • New feature
  • Documentation update
  • Refactor/cleanup

Related issues

Testing

  • Tests added/updated
  • All tests pass locally
  • Manual testing completed

Checklist

  • Code follows project style
  • Pre-commit hooks pass
  • Documentation updated (if needed)

@viraatc viraatc requested review from a team and Copilot April 10, 2026 00:33
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 10, 2026

MLCommons CLA bot All contributors have signed the MLCommons CLA ✍️ ✅

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request migrates the project's dependency management and build system from setuptools and pip to uv. Key changes include updating the pyproject.toml to use uv_build, adding a uv-lock-check pre-commit hook, and revising the README and AGENTS documentation to prioritize uv-based workflows while maintaining backward compatibility for pip. The Dockerfile has also been updated to use uv for faster, reproducible builds. Feedback identifies a critical issue in the Dockerfile where the virtual environment may be shadowed by volume mounts and a pathing error in the build exclusion list within pyproject.toml.

Comment thread scripts/Dockerfile.dev
Comment thread pyproject.toml Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Migrates the project’s Python dependency/build tooling from pip/setuptools-centric workflows to uv, updating local developer setup, Docker dev image, and CI pipelines accordingly.

Changes:

  • Switch pyproject.toml build backend to uv_build and add tool.uv configuration for platform environments and build packaging rules.
  • Update developer workflows and docs (README/AGENTS) to use uv sync / uv run and add a pre-commit hook to enforce uv.lock freshness.
  • Update GitHub Actions to use astral-sh/setup-uv and run tests/audits/pre-commit via uv.

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
scripts/Dockerfile.dev Installs uv in the dev container and uses uv sync for dev/test dependencies.
README.md Documents uv as the default dependency manager and adds a pip+venv fallback section.
pyproject.toml Moves build backend to uv_build and configures uv build/data/exclude behavior.
AGENTS.md Updates common commands and dependency guidance to use uv.
.python-version Adds a Python version file intended for tool/CI alignment.
.pre-commit-config.yaml Adds a uv lock --check hook to keep uv.lock in sync.
.github/workflows/test.yml Runs tests and dependency audit via uv.
.github/workflows/pre-commit.yml Runs pre-commit via uv.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread scripts/Dockerfile.dev Outdated
Comment thread README.md Outdated
Comment thread .pre-commit-config.yaml Outdated
Comment thread .github/workflows/test.yml Outdated
Comment thread pyproject.toml Outdated
Comment thread pyproject.toml Outdated
Comment thread .python-version Outdated
Comment thread .github/workflows/pre-commit.yml
Copilot AI review requested due to automatic review settings April 10, 2026 00:40
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 9 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pyproject.toml
Comment thread .github/workflows/test.yml
Comment thread .github/workflows/pre-commit.yml
Comment thread README.md Outdated
Comment thread AGENTS.md Outdated
Copy link
Copy Markdown
Collaborator Author

@viraatc viraatc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Council — Multi-AI Code Review

Reviewed by: Codex + Claude | Depth: thorough (3001 lines)

Found 5 issues across 4 files.

Comment thread scripts/Dockerfile.dev Outdated
Comment thread pyproject.toml Outdated
Comment thread .pre-commit-config.yaml Outdated
Comment thread scripts/Dockerfile.dev Outdated
Comment thread .github/workflows/test.yml Outdated
@viraatc
Copy link
Copy Markdown
Collaborator Author

viraatc commented Apr 10, 2026

Review Council — Multi-AI Code Review

Reviewed by: Codex + Claude | Depth: thorough (3001 lines, 9 files)

Found 5 issues across 4 files.

🔴 Must Fix (critical)

Issues that will cause build failures or incorrect behavior in production.

# File Line Category Reviewer(s) Summary
1 scripts/Dockerfile.dev 27 bug Codex Missing COPY README.mduv_build needs it for metadata, Docker build fails

🟡 Should Fix (medium)

Real issues that trigger under specific conditions or diverge from project policy.

# File Line Category Reviewer(s) Summary
2 pyproject.toml 16 bug Claude data key may install templates to data scheme instead of package dir — verify with uv build && unzip -l dist/*.whl
3 .pre-commit-config.yaml 70 bug Claude additional_dependencies: [uv] unpinned — should be ["uv==0.7.6"] per project policy

🔵 Consider (low)

Valid improvements that could be follow-ups.

# File Line Category Reviewer(s) Summary
4 scripts/Dockerfile.dev 26 design Claude Misleading "layer caching" comment — COPY src/ busts the cache; consider --no-install-project split
5 .github/workflows/test.yml 21 design Claude Implicit uv sync via uv run — explicit step improves CI diagnostics

Note: 6 issues from the Claude reviewer were dropped during verification — they referenced files not changed in this PR (schema.py, init.py, test_cli.py, test_benchmark_command.py, main.py). All remaining issues were verified against HEAD source files.

Copilot AI review requested due to automatic review settings April 10, 2026 05:55
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 9 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .pre-commit-config.yaml Outdated
Comment thread pyproject.toml
viraatc and others added 14 commits April 15, 2026 14:50
Supply chain hardening via uv lockfile with cryptographic hashes
for all direct and transitive dependencies. Covers build backend
swap, CI workflows, Dockerfile, and pre-commit enforcement.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
8-task plan covering build backend, lockfile, CI workflows,
Dockerfile, pre-commit hook, and AGENTS.md updates.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Swap build-system to uv_build, remove [tool.setuptools] sections,
add [tool.uv] config with platform-restricted environments
(Linux + macOS, x86_64 + arm64).
Pin Python 3.12 for uv auto-selection. Generated lockfile with
cryptographic hashes for all direct and transitive dependencies
across Linux + macOS (x86_64 + arm64). Also fix index-url field name
(default-index is not valid in [tool.uv] for uv 0.9.28).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace setup-python + pip install with setup-uv + uv run --frozen.
Lockfile hashes are now enforced in CI.
Use uv binary from official image, uv sync --frozen for
hash-verified installs, improved Docker layer caching.
Runs uv lock --check when pyproject.toml changes, fails if
lockfile is stale.
Add uv sync/run commands alongside existing pip instructions.
Document uv add for dependency management.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Show both uv (recommended) and pip+venv installation options
in README. Remove internal planning documents from branch.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…to README examples

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
viraatc and others added 9 commits April 15, 2026 14:52
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- 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>
- Dockerfile.dev: add COPY README.md (uv_build needs it for metadata),
  split uv sync with --no-install-project for proper Docker layer caching
- pyproject.toml: remove redundant data key (uv_build includes
  VCS-tracked files automatically; data key installs to data scheme)
- .pre-commit-config.yaml: pin uv==0.7.6 in additional_dependencies
- test.yml: add explicit uv sync steps for better CI diagnostics

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Widen uv-lock-check pre-commit files selector to also trigger on
  uv.lock changes
- Add wheel build + smoke test CI job to catch packaging regressions

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- CONTRIBUTING.md: uv as primary setup, pip+venv in <details>
- docs/DEVELOPMENT.md: uv commands for setup, testing, debugging,
  package management
- docs/LOCAL_TESTING.md: uv run prefix on all commands
- docs/CLIENT_PERFORMANCE_TUNING.md: uv run prefix on python -m commands
- docs/CLI_QUICK_REFERENCE.md: add note about uv run prefix
- docs/sphinx/README.md: uv sync for sphinx deps, update CI example

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- docs/*/DESIGN.md: uv run prefix on python -m commands
- examples/*/README.md: uv run prefix on all inference-endpoint,
  python, and pip commands
- src/inference_endpoint/openai/Readme.md: uv pip install
- src/inference_endpoint/profiling/README.md: uv run prefix on
  pytest and python commands
- tests/datasets/Readme.md: uv run prefix on commands

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Lockfile regenerated to reflect dependencies added/bumped on main:
- hypothesis==6.151.10 (new test dep for schema fuzz tests)
- pillow 12.1.1 → 12.2.0
- pytest 9.0.2 → 9.0.3

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 16, 2026 00:02
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 29 out of 30 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

wget https://raw.githubusercontent.com/openai/openai-openapi/498c71ddf6f1c45b983f972ccabca795da211a3e/openapi.yaml
pip install datamodel-code-generator
uv pip install datamodel-code-generator
datamodel-codegen --input-file-type openapi --input openapi.yaml --output openai_types_gen.py --output-model-type pydantic_v2.BaseModel
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The instructions switch to uv pip install ... but then invoke datamodel-codegen without either activating the environment or prefixing the command with uv run. As written, this can fail with command not found for users following the uv workflow. Update the command invocation (or explicitly note that a venv must be activated) so the steps are self-contained and consistent.

Suggested change
datamodel-codegen --input-file-type openapi --input openapi.yaml --output openai_types_gen.py --output-model-type pydantic_v2.BaseModel
uv run datamodel-codegen --input-file-type openapi --input openapi.yaml --output openai_types_gen.py --output-model-type pydantic_v2.BaseModel

Copilot uses AI. Check for mistakes.
@@ -315,7 +315,7 @@ have already been applied by this point. This matters because:
### Startup

```python
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fenced block is marked as python, but it contains a shell command (uv run python -m ... with line continuations). Change the code fence language to bash/plain to avoid misleading syntax highlighting and copy/paste confusion.

Suggested change
```python
```bash

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Move to uv

2 participants