-
Notifications
You must be signed in to change notification settings - Fork 27
Migrate dependency management to pyproject.toml with uv #172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Update all documentation and scripts to use `uv` instead of `pip` for installing dependencies. This provides significant performance improvements and better dependency resolution. Changes: - Update CLAUDE.md local development setup instructions - Update README.md installation steps - Update DEVELOPMENT.md dependency installation - Update CONTRIBUTING.md setup instructions - Update vagrant/provision.sh to use uv - Add uv 0.9.18 to .tool-versions Note: Dockerfile and GitHub Actions workflows already use uv. Refs #171
…ect.toml Complete migration from pip-tools workflow to modern uv-based dependency management: - Replace requirements/main.in, dev.in, production.in with pyproject.toml - Use PEP 735 dependency-groups for dev and production dependencies - Generate uv.lock as universal lock file (102 packages) - Auto-generate requirements.txt for Heroku compatibility - Centralize tool configurations (ruff, coverage, isort) in pyproject.toml - Use Hatchling as build backend - Update all tooling (Taskfile, toast.yml, Dockerfile, CI/CD) - Update documentation (CLAUDE.md, README.md, DEVELOPMENT.md, CONTRIBUTING.md) New workflow: - `uv lock` - Update lock file - `uv sync` - Install dependencies - `task dependencies:export` - Generate requirements.txt Benefits: - Single source of truth (pyproject.toml) - Faster dependency resolution with uv - Modern Python packaging standards (PEP 621, PEP 735) - Simplified dependency management commands Fixes #171
The tests were failing because uv sync creates a virtual environment but the test command was using the system Python. Using 'uv run' ensures the tests run in the correct virtual environment with all dependencies installed.
Django 6.0 was inadvertently installed due to missing version constraints in pyproject.toml. This pins Django to 5.2.x series (latest: 5.2.9) and Wagtail to 7.2.x for compatibility. Changes: - pyproject.toml: Add Django>=5.2.0,<5.3 constraint - pyproject.toml: Add wagtail>=7.2.0,<7.3 constraint - uv.lock: Regenerated with Django 5.2.9 - requirements.txt: Regenerated with Django 5.2.9 - requirements-dev.txt: Regenerated with Django 5.2.9 All 33 tests pass with Django 5.2.9.
…ibility - Create requirements/main.txt with base dependencies (no dev, no production groups) - Create requirements/production.txt with production-specific dependencies (psycopg) - Update requirements.txt to reference both files (-r requirements/main.txt -r requirements/production.txt) This maintains Heroku compatibility while using the modern pyproject.toml + uv workflow. The requirements files are auto-generated from uv.lock using: - uv export --no-dev --no-group production -o requirements/main.txt - uv export --only-group production -o requirements/production.txt 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
- Add README.md to COPY command (required by Hatchling build backend) - Add --no-install-project flag to uv sync to install only dependencies without installing the pythonie package itself at this stage This fixes the Docker build errors: - "OSError: Readme file does not exist: README.md" - "ValueError: Unable to determine which files to ship inside the wheel" 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
567a21b to
7ff27a6
Compare
| - name: Set Up Python 3.13 | ||
| uses: actions/setup-python@v2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you consider setup-uv action instead of setup-python? It can install Python versions just fine, and yields a cleaner result in overall config in my experience.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these exports still necessary? I tried to check how they are being used after uv migration but I couldn't catch the usecase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @ulgens,
I haven't checked if Heroku supports uv yet, but the main idea was to keep full compatibility with Heroku and the requirements files. This ensures the deployment pipeline continues to work as expected without any changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it, thank you.
Checking Heroku docs now and it seems they already have the uv support in place: https://devcenter.heroku.com/changelog-items/3238 I also checked
- Which version they support: https://github.com/heroku/buildpacks-python/blob/main/requirements/uv.txt 0.9.18 at time of this comment, a release from 3 weeks ago, not bad.
- Do they support a custom version definition, but couldn't find anything about it.
Description
Complete migration from the legacy pip-tools workflow using
requirements/*.infiles to a modern Python packaging approach usingpyproject.tomlwithuvfor dependency management.This migration consolidates all dependency declarations into a single source of truth (
pyproject.toml) following PEP 621 (project metadata) and PEP 735 (dependency groups) standards.Type of Change
Key Changes
Structure
requirements/main.in,requirements/dev.in,requirements/production.in→pyproject.tomluv.lockas universal lock file (102 packages resolved)requirements.txtfor Heroku deployment compatibilitypyproject.tomlNew Workflow
Files Modified
pyproject.toml- New single source of truthuv.lock- Universal lock fileTaskfile.yaml- Updated dependency management taskstoast.yml- Updated Docker-based dependency tasksDockerfile- Useuv syncinstead of pip install.github/workflows/test.yml- Updated CI to use uvCLAUDE.md,README.md,DEVELOPMENT.md,CONTRIBUTING.md- Updated documentationFiles Removed
requirements/main.in,requirements/dev.in,requirements/production.inrequirements/main.txt,requirements/dev.txt,requirements/production.txtrequirements/directory (now empty)pythonie/setup.py(replaced by pyproject.toml)Benefits
pyproject.tomlHow to Test
Local Setup
Docker Setup
Expected Results
Testing Performed
Checklist
Migration Impact
Developers
CI/CD
Deployment (Heroku)
References
Note: This is a significant infrastructure change, but maintains full backward compatibility for deployment while modernizing the development workflow.