Files
Pygentic-AI/MIGRATION_UV.md
Francis Secada a11e0c65fe refactor: migrate to uv + pyproject.toml dependency management
BREAKING CHANGE: Removed pip-style requirements files

Migration Details:
- Removed core_requirements.{in,txt} and dev_requirements.in
- Consolidated all dependencies into pyproject.toml
- Added platform markers for Windows-specific packages:
  - pywin32>=311 (sys_platform == 'win32')
  - win32-setctime>=1.2.0 (sys_platform == 'win32')
  - hypercorn (Windows ASGI server)
  - gunicorn (Unix WSGI server)

CI/CD Changes:
- Updated .github/workflows/test.yml to use 'uv sync --group test'
- Simplified installation: no more manual pip install steps
- Uses 'uv run pytest' for test execution with PYTHONPATH

Benefits:
-  Fixes pywin32 installation failure on Ubuntu CI runners
-  Single source of truth for dependencies (pyproject.toml)
-  Faster resolution with uv lockfile
-  Modern Python packaging (PEP 621)
-  Proper dependency groups (dev, test)
-  Platform-aware installation

New Workflow:
- Production: uv sync
- With tests: uv sync --group test
- With dev tools: uv sync --group dev
- All groups: uv sync --all-groups

Added MIGRATION_UV.md with full migration guide for developers.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-04 16:07:14 -05:00

100 lines
2.1 KiB
Markdown

# Migration to uv + pyproject.toml
**Date**: 2026-02-04
**Status**: ✅ Completed
## What Changed
Migrated from pip-style `requirements.txt`/`requirements.in` files to modern `uv` + `pyproject.toml` dependency management.
## Old Approach (Deprecated)
```bash
# Old way - DO NOT USE
uv pip install -r core_requirements.txt
uv pip install -r dev_requirements.txt
```
## New Approach (Current)
```bash
# Production dependencies
uv sync
# With test dependencies
uv sync --group test
# With development dependencies
uv sync --group dev
# All groups
uv sync --all-groups
```
## Files Removed
-`core_requirements.in`
-`core_requirements.txt`
-`dev_requirements.in`
## Files Updated
-`pyproject.toml` - All dependencies now defined here
-`.github/workflows/test.yml` - CI uses `uv sync --group test`
## Platform-Specific Dependencies
The following dependencies are now properly marked with platform markers:
### Windows Only
- `pywin32>=311` (sys_platform == 'win32')
- `win32-setctime>=1.2.0` (sys_platform == 'win32')
- `hypercorn>=0.18.0` (sys_platform == 'win32')
### Unix Only
- `gunicorn>=25.0.1` (sys_platform != 'win32')
This fixes the CI installation failure where `pywin32` was being installed on Ubuntu runners.
## Benefits
1. **Single source of truth**: All dependencies in `pyproject.toml`
2. **Platform awareness**: Proper platform markers prevent installation failures
3. **Faster resolution**: `uv` lockfile (`uv.lock`) ensures reproducible installs
4. **Modern tooling**: Aligned with Python packaging standards (PEP 621)
5. **Dependency groups**: Separate dev/test dependencies cleanly
## For Developers
### First Time Setup
```bash
# Install uv if not already installed
curl -LsSf https://astral.sh/uv/install.sh | sh
# Clone and setup
git clone <repo>
cd strategiq
uv sync --all-groups
```
### Running Tests
```bash
uv run pytest
```
### Adding Dependencies
```bash
# Add to [project] dependencies in pyproject.toml
# Then sync
uv sync
```
## CI/CD
GitHub Actions now uses:
```yaml
- name: Install dependencies
run: uv sync --group test
- name: Run tests
run: uv run pytest --cov=src
```
No more manual pip install steps!