Skip to content

feat: move to uv from pip#275

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

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

Conversation

@viraatc
Copy link
Copy Markdown
Collaborator

@viraatc viraatc commented Apr 10, 2026

What does this PR do?

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 and others added 13 commits April 9, 2026 17:12
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>
@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 ✍️ ✅

…to README examples

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

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.

viraatc and others added 2 commits April 9, 2026 17:38
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

- 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>
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.

@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.

- 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>
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.

language: python
additional_dependencies: ["uv==0.7.6"]
pass_filenames: false
files: ^pyproject\.toml$
Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

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

The new uv-lock-check hook only runs when pyproject.toml changes (files: ^pyproject\.toml$). If uv.lock is modified (or accidentally corrupted) without a pyproject.toml change, this check won’t run and an inconsistent lockfile could still be committed. Consider widening the files selector to also trigger on uv.lock changes (or remove the selector so it always runs when relevant).

Suggested change
files: ^pyproject\.toml$
files: ^(pyproject\.toml|uv\.lock)$

Copilot uses AI. Check for mistakes.
Comment on lines 1 to +3
[build-system]
requires = ["setuptools==78.1.1", "wheel==0.46.3"]
build-backend = "setuptools.build_meta"
requires = ["uv_build==0.7.6"]
build-backend = "uv_build"
Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

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

Switching the build backend to uv_build changes how sdists/wheels are produced, but the CI workflows only run uv sync + pytest and don’t exercise the packaging path. To catch packaging regressions early, consider adding a CI step that builds the distribution artifacts and performs a minimal smoke test (e.g., install the built wheel and import/run the CLI).

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.

2 participants