Skip to content

ci: migrate from pip to uv for faster installs#1431

Merged
hudson-ai merged 3 commits intomainfrom
ci/uv-install
Mar 17, 2026
Merged

ci: migrate from pip to uv for faster installs#1431
hudson-ai merged 3 commits intomainfrom
ci/uv-install

Conversation

@hudson-ai
Copy link
Collaborator

Motivation

Dependency installation is a significant bottleneck in our CI pipelines. Looking at recent runs of the pull_request workflow:

  • CPU integration tests spend ~200s installing deps out of ~300s total (65% of wall time)
  • Windows unit tests spend 50–110s on installs (38–63% of wall time)
  • Even Linux/macOS unit tests spend ~20s (17–29%)

uv is a drop-in replacement for pip that's 10–100× faster at dependency resolution and installation. Conservatively, this should cut install times by 5–10×, saving minutes per CI run — especially on the heavier workflows (cpu_tests, gpu_tests, notebooks).

Changes

Replace pip install with uv pip install --system across all 8 CI workflows that install Python packages:

  • Add astral-sh/setup-uv@v5 step to all jobs
  • Replace all pip install / python -m pip installuv pip install --system
  • Remove now-unnecessary pip install --upgrade pip steps
  • Use uv build instead of python -m pip install build && python -m build in pypi_upload

No changes to pyproject.toml, the build backend (still setuptools), or test configuration. The --system flag tells uv to install into the system Python rather than creating a venv, matching the existing CI behavior.

Affected workflows

Workflow Install time (before) % of total
call_cpu_tests ~200s 65%
call_gpu_tests similar similar
pull_request (unit_tests, Windows) 50–110s 38–63%
pull_request (unit_tests, Linux/macOS) 11–22s 17–29%
code_quality light
ci_docs moderate
ci_credentials moderate
notebook_tests moderate
pypi_upload light

What this doesn't do (yet)

This PR only swaps the installer. A natural follow-up would be adding uv lock to generate a uv.lock file for fully reproducible CI environments with pinned transitive dependencies.

hudson-ai and others added 2 commits March 17, 2026 09:29
- Replace all pip install calls with uv pip install --system
- Add astral-sh/setup-uv@v5 step to all workflows
- Remove unnecessary pip upgrade steps
- Use uv build instead of python -m build in pypi_upload

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The code_quality jobs didn't have setup-python, so they used the
system Python on ubuntu-latest which has PEP 668 restrictions that
block --system installs.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@codecov-commenter
Copy link

codecov-commenter commented Mar 17, 2026

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 60.34%. Comparing base (376121b) to head (3c1e837).
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #1431       +/-   ##
===========================================
+ Coverage   42.56%   60.34%   +17.77%     
===========================================
  Files          62       62               
  Lines        5248     5248               
===========================================
+ Hits         2234     3167      +933     
+ Misses       3014     2081      -933     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@hudson-ai
Copy link
Collaborator Author

Measured speedups from PR gate run

Comparing the latest PR gate run (uv) against the most recent main run (pip):

CPU integration tests

Job pip uv Speedup
cpu_tests (3.10) 204s 56s 3.6×
cpu_tests (3.14) 174s 75s 2.3×

Unit tests — Windows (biggest absolute wins)

Job pip uv Speedup
Win 3.14 110s 21s 5.2×
Win 3.10 92s 25s 3.7×
Win 3.12 59s 19s 3.1×
Win 3.11 54s 22s 2.5×
Win 3.13 53s 17s 3.1×

Unit tests — Linux

Job pip uv Speedup
Linux 3.10 20s 3s 6.7×
Linux 3.11 19s 3s 6.3×
Linux 3.12 21s 3s
Linux 3.13 20s 5s
Linux 3.14 22s 3s 7.3×

Unit tests — macOS

Job pip uv Speedup
macOS 3.10 11s 4s 2.8×
macOS 3.11 17s 7s 2.4×
macOS 3.12 13s 3s 4.3×
macOS 3.13 13s 3s 4.3×
macOS 3.14 15s 3s

All 17 jobs passed ✅

@hudson-ai
Copy link
Collaborator Author

ci_linux results

Compared the ci/uv-install run against the latest main run. 37/38 jobs passed (one pre-existing ONNX segfault on Python 3.10, unrelated).

Per-job install speedups

CPU tests: install time dropped from ~175–228s to 73–91s (2.0–2.7×)
GPU tests: install time dropped from ~790–880s to 660–700s (~1.2×, dominated by CUDA setup)

Wall-time impact

Since these jobs are parallelized, what matters is the critical path:

Critical path job pip (total) uv (total) Wall time saved
Longest GPU job ~1040s ~885s ~2.5 min
Longest CPU job ~600s ~500s ~1.5 min

The biggest impact is on the PR gate workflow, where install time is a larger fraction of total job time — especially on Windows (up to 5× faster installs, see previous comment).

@hudson-ai hudson-ai requested review from Copilot and riedgar-ms and removed request for Copilot March 17, 2026 17:15
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
Copy link
Collaborator

Choose a reason for hiding this comment

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

If this is shared amongst all builds, perhaps make it a variable?

Copy link
Collaborator

@riedgar-ms riedgar-ms left a comment

Choose a reason for hiding this comment

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

Fine with me

Address review feedback: use a single PYTHON_VERSION env var
instead of repeating '3.12' in each job.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@hudson-ai hudson-ai merged commit c4df5d3 into main Mar 17, 2026
25 checks passed
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.

3 participants