Skip to content

Migrate from pip/setuptools to uv for dependency management#483

Open
halfguru wants to merge 2 commits into
ECCC-MSC:masterfrom
halfguru:migrate-to-uv
Open

Migrate from pip/setuptools to uv for dependency management#483
halfguru wants to merge 2 commits into
ECCC-MSC:masterfrom
halfguru:migrate-to-uv

Conversation

@halfguru

@halfguru halfguru commented Mar 25, 2026

Copy link
Copy Markdown

Summary

This PR migrates msc-pygeoapi from pip/setuptools to uv for dependency management, following modern Python packaging standards (PEP 621).

Motivation

  • Performance: uv is significantly faster, especially with cached packages
  • Modern standards: pyproject.toml as single source of truth
  • Developer experience: Cleaner dependency management, better resolution
  • Industry adoption: Widely adopted by major projects (pytest, requests, flask)

Installation Time Comparison

Scenario Time
pip (cold cache) 65s
pip (warm cache) 33s
uv (cold cache) 42s
uv (warm cache) <1s

uv with warm cache is 33x faster than pip with warm cache.

Changes

  • Add pyproject.toml with project metadata, dependencies, and dev dependencies
  • Keep minimal setup.py for Debian packaging compatibility (debuild)
  • Update CI workflow to use astral-sh/setup-uv@v7
  • Consolidate flake8 check into main workflow (3 parallel jobs: lint, test, debian)
  • Update Dockerfile to use uv pip install --system and Docker buildx
  • Update deploy/nightly/deploy-nightly.sh to use pip install . (modern standard)
  • Update documentation (README.md, docker/README.md)
  • Remove requirements.txt, requirements-dev.txt, requirements-oracle.txt

Dependency Versions

All 58 common dependencies resolve to identical versions. Minor additions in uv:

  • coverage and pytest-cov added to dev dependencies for better test coverage

Backward Compatibility

  • ✅ Debian packaging maintained via minimal setup.py
  • ✅ All existing functionality preserved
  • ✅ Same package versions (no breaking changes)
  • ✅ Docker builds work identically

Tests Performed

  • ✅ Unit tests: 9/9 passed
  • ✅ Linting: No errors
  • ✅ Docker build: Successful
  • ✅ Docker buildx: Successful
  • ✅ Dependency version comparison: Identical

Notes

  • gdal is not included in pyproject.toml dependencies - it must be installed via system packages (apt install python3-gdal or libgdal-dev + pip) due to build requirements.

@halfguru halfguru force-pushed the migrate-to-uv branch 3 times, most recently from 4453d45 to 37a0e17 Compare March 25, 2026 10:39
- Add pyproject.toml with project metadata and dependencies
- Keep minimal setup.py for Debian packaging compatibility
- Update CI workflow to use astral-sh/setup-uv
- Consolidate flake8 check into main workflow (3 parallel jobs)
- Update Dockerfile to use uv pip install --system
- Update deployment script to use pip install . (modern standard)
- Update documentation (README, docker/README.md)
- Remove requirements*.txt files (deps now in pyproject.toml)
- Note: gdal not in pyproject.toml (installed via system packages)
@tomkralidis tomkralidis self-requested a review March 25, 2026 15:12
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.

1 participant