strat-gameplay-webapp/backend/app/models
Cal Corum 9a9018aab4 CLAUDE: Migrate backend to UV package management
Migrated from pip to UV (v0.9.7) for faster, more reliable package management.

## Changes

### Package Management
- Created `pyproject.toml` with project metadata and dependencies
- Generated `uv.lock` for reproducible builds (198KB)
- Migrated all dependencies from requirements.txt:
  - Production: 20 packages (FastAPI, SQLAlchemy, Pydantic, etc.)
  - Development: 6 packages (pytest, black, mypy, flake8)
- Virtual environment moved from `venv/` to `.venv/` (UV default)

### Dockerfile Updates
- Updated base image: python:3.11-slim → python:3.13-slim
- Added UV installation via official image copy
- Development stage: Uses `uv sync --frozen` for all deps
- Production stage: Uses `uv sync --frozen --no-dev` for prod only
- Commands now use `uv run` prefix for auto-activation
- Set UV environment variables:
  - UV_LINK_MODE=copy (for Docker compatibility)
  - UV_COMPILE_BYTECODE=1 (performance)
  - UV_PYTHON_DOWNLOADS=never (use system Python)

### Code Fixes
- Fixed Pydantic model circular import in `app/models/game_models.py`
  - Added runtime import of PositionRating at end of file
  - Called `model_rebuild()` on LineupPlayerState and GameState
  - Resolves "not fully defined" errors in tests

### Documentation
- Updated `backend/CLAUDE.md` with UV usage:
  - Package management section with UV commands
  - Updated all code examples to use `uv run`
  - Daily development workflow now uses UV
  - Added dependency management guide (add/remove/update)
  - Updated virtual environment location (.venv/)

### Project Files
- Added `.python-version` (3.13) for UV Python version tracking
- Removed UV template files (main.py, README.md)
- Kept existing .gitignore (already includes venv/ and .venv/)

## Testing
-  All imports work correctly
-  55/55 game model tests passing
-  500+ unit tests passing (same as before migration)
-  Test failures are pre-existing (not UV-related)

## Benefits
- 10-100x faster dependency resolution
- 2-3x faster installation
- Better dependency conflict resolution
- Single tool for everything (replaces pip, pip-tools, virtualenv)
- Reproducible builds with uv.lock

## Migration Path for Team
```bash
# One-time: Install UV
curl -LsSf https://astral.sh/uv/install.sh | sh

# In project
cd backend
uv sync  # Creates .venv and installs everything

# Daily usage
uv run python -m app.main
uv run pytest tests/ -v
```

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-04 08:52:11 -06:00
..
__init__.py CLAUDE: Implement player models and optimize database queries 2025-10-28 14:08:56 -05:00
CLAUDE.md CLAUDE: Refactor ManualOutcomeSubmission to use PlayOutcome enum + comprehensive documentation 2025-10-31 16:03:54 -05:00
db_models.py CLAUDE: Implement Phase 3A - X-Check data models and enums 2025-11-01 15:32:09 -05:00
game_models.py CLAUDE: Migrate backend to UV package management 2025-11-04 08:52:11 -06:00
player_model_info.md CLAUDE: Reorganize Week 6 documentation and separate player model specifications 2025-10-25 23:48:57 -05:00
player_models.py CLAUDE: Implement Phase 3A - X-Check data models and enums 2025-11-01 15:32:09 -05:00
roster_models.py CLAUDE: Implement polymorphic RosterLink for both PD and SBA leagues 2025-10-22 22:45:44 -05:00
visual_model_relationships.md CLAUDE: Refactor game models and modularize terminal client 2025-10-28 14:16:38 -05:00