Skip to content

build: Adopt uv as the project package manager - #503

Open
kunaaaalcodes wants to merge 1 commit into
spotify:masterfrom
kunaaaalcodes:build/adopt-uv-package-manager
Open

build: Adopt uv as the project package manager#503
kunaaaalcodes wants to merge 1 commit into
spotify:masterfrom
kunaaaalcodes:build/adopt-uv-package-manager

Conversation

@kunaaaalcodes

@kunaaaalcodes kunaaaalcodes commented Aug 6, 2026

Copy link
Copy Markdown

Closes #469

Overview

This PR completes the migration to uv as the project's single dependency management tool.

While parts of the project had already adopted uv (uv.lock and the type-check-python workflow), the rest of the repository still relied on pip, requirements.txt, and tox. This resulted in duplicated configuration, inconsistent developer workflows, and non-reproducible dependency installation.

This change standardizes dependency management across local development, CI, and documentation.


What's Changed

Dependency Management

  • Added PEP 735 dependency groups:
    • dev for development tools (e.g. ruff)
    • docs for documentation tooling (sphinx, mkdocs, pybind11-stubgen, etc.)
  • Added an explicit coverage dependency to the test extras.
  • Moved pytest configuration from tox.ini to pyproject.toml.
  • Replaced cibuildwheel's test-requires requirements file with explicit packages.
  • Regenerated and verified uv.lock using:
    • uv lock --check
    • uv sync --locked

CI

Updated all Python workflows to use uv.

  • Replaced pip install with uv sync --locked.
  • Replaced direct tool execution with uv run.
  • Updated:
    • lint-python
    • prime-*-build-caches
    • run-tests
    • run-tests-in-parallel
    • run-tests-with-address-sanitizer
    • deploy-docs

Optional dependencies (such as TensorFlow and google-cloud-storage) continue to be installed using uv pip install so they remain outside the lock file.

Documentation

Updated CONTRIBUTING.md to use the new workflow.

  • pip3 install pybind11 toxuv sync --all-extras --dev
  • toxuv run pytest

The testing, documentation, style, ccache, and troubleshooting sections were updated accordingly.

Cleanup

Removed legacy dependency management files:

  • tox.ini
  • requirements.txt
  • test-requirements.txt
  • dev-requirements.txt
  • docs-requirements.txt

Also:

  • Added uv.lock to MANIFEST.in
  • Removed the obsolete .tox/ entry from .gitignore

Notable Fix

Regenerating uv.lock exposed a compatibility issue with Python 3.14.

The previous lock file pinned numpy==2.2.5, which has no pre-built wheels for Python 3.14 and would trigger a source build during CI.

The lock file now pins an appropriate NumPy version for each supported Python release, ensuring wheel-based installation across the CI matrix.


Result

After this PR:

  • uv is the single dependency manager.
  • pyproject.toml is the single source of truth.
  • uv.lock provides fully reproducible installations.
  • Local development, CI, and documentation all use the same workflow.
  • Dependency installation is faster and deterministic.

Testing

Verified locally:

uv lock --check
uv sync --locked --all-extras --dev

Tested with:

  • Python 3.10
  • Python 3.12
  • Python 3.14

Also verified:

  • Documentation installation (--group docs)
  • GitHub workflow YAML validity
  • CI linting, type checking, and test execution

Note

The build-wheels workflow intentionally continues installing
cibuildwheel via pip, since it manages its own isolated build
environments and is outside the scope of this PR.

Problem

The project uses pip and tox for installing dependencies and running
tests, while uv is already used for the lock file and type-check job,
leading to inconsistent tooling and slow dependency resolution.

Solution

Replace pip invocations with uv across all CI workflow jobs and in
the docs deployment workflow. Update CONTRIBUTING.md to document
uv-based setup and test running. Replace tox with uv, consolidating
all dependencies into pyproject.toml (test extras, dev and docs
dependency groups) and removing tox.ini and the requirements files.
Regenerate uv.lock so all supported Python versions install
pre-built wheels.
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.

build: Adopt uv as the project package manager

1 participant