Skip to content

Migrate to uv: one-command install (uv sync) + CI smoke test#1349

Merged
CorentinJ merged 9 commits intoCorentinJ:masterfrom
bhadraagada:master
Sep 23, 2025
Merged

Migrate to uv: one-command install (uv sync) + CI smoke test#1349
CorentinJ merged 9 commits intoCorentinJ:masterfrom
bhadraagada:master

Conversation

@bhadraagada
Copy link
Contributor

Summary

This PR migrates the project from pip-based dependency management to uv, enabling a one-command install experience and adding CI with smoke tests. Users can now install all dependencies, including PyTorch, with a single uv sync --extra cpu command.

What's Changed

One-command install with uv

  • Added pyproject.toml: Migrated all dependencies from requirements.txt to modern Python packaging standards
  • PyTorch extras: CPU-only PyTorch available via --extra cpu flag
  • Platform-aware resolution: Configured for Windows and Linux compatibility
  • Locked dependencies: uv.lock ensures reproducible installs

CI with smoke tests

  • Added .github/workflows/ci.yml: Uses official astral-sh/setup-uv action
  • Smoke tests: tests/test_ci_smoke.py validates core imports (numpy, librosa, soundfile, torch) and project modules (encoder, synthesizer, vocoder)
  • System dependencies: Installs libsndfile1 for audio library support
  • Manual triggers: Added workflow_dispatch for on-demand CI runs

Updated documentation

  • README: Added "Install with uv" section with simple CPU/GPU instructions
  • Git ignore: Added .venv/ and .pytest_cache/ to avoid committing local artifacts

Installation comparison

Before (multi-step):

# Install PyTorch manually first
pip install torch --index-url https://download.pytorch.org/whl/cpu
pip install -r requirements.txt

After (one command):

# Install uv once
curl -LsSf https://astral.sh/uv/install.sh | sh

# Install everything
uv sync --extra cpu

Technical details

  • Python compatibility: Maintains support for Python ≥3.7 as specified in original README
  • Dependency pins: Preserves exact versions from requirements.txt for stability
  • Cross-platform: Works on Windows (dev) and Linux (CI) with platform-specific wheel selection
  • PyTorch integration: Uses uv's index feature to fetch CPU wheels from PyTorch's official index

Testing

  • Local Windows: uv sync --extra cpu + uv run pytest -q → 2 passed
  • CI Ubuntu: All steps pass including system dependency installation and smoke tests

Files changed

  • pyproject.toml - uv project configuration with dependencies and PyTorch extras
  • .github/workflows/ci.yml - CI workflow using uv
  • tests/test_ci_smoke.py - Import validation tests
  • README.md - Added uv installation instructions
  • .gitignore - Ignore local virtual environment

Migration path for users

Existing users can continue using pip install -r requirements.txt. New users get the streamlined uv sync experience. No breaking changes to functionality.


Addresses: Request for uv migration with trivial install and CI unit tests

@CorentinJ
Copy link
Owner

Thank you, I will be reviewing in the following days

@CorentinJ
Copy link
Owner

One thing: remove the requirements file, this needs to be a complete replacement. I don't want users to keep using pip or conda

@bhadraagada
Copy link
Contributor Author

I've updated that

@CorentinJ
Copy link
Owner

  • I believe you hadn't set a mechanism for selecting cuda for torch, I did that
  • I updated the python, numpy and sci packages versions because on numpy 1.20.* there would not be any prebuilt binaries and I didn't want users to have to build on windows

lmk if all is good on your end. I'll also update the readme with the new instructions

@CorentinJ
Copy link
Owner

Haven't had a reply from you, will merge

@CorentinJ CorentinJ merged commit 8a4584f into CorentinJ:master Sep 23, 2025
1 check 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.

2 participants