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>
49 lines
1.1 KiB
TOML
49 lines
1.1 KiB
TOML
[project]
|
|
name = "paper-dynasty-backend"
|
|
version = "0.1.0"
|
|
description = "Paper Dynasty Real-Time Game Engine Backend - FastAPI with WebSocket support"
|
|
readme = "README.md"
|
|
requires-python = ">=3.13"
|
|
authors = [
|
|
{ name = "Paper Dynasty Team" }
|
|
]
|
|
dependencies = [
|
|
"aiofiles==24.1.0",
|
|
"alembic==1.14.0",
|
|
"asyncpg==0.30.0",
|
|
"click==8.1.8",
|
|
"fastapi==0.115.6",
|
|
"greenlet==3.2.4",
|
|
"httpx==0.28.1",
|
|
"passlib[bcrypt]==1.7.4",
|
|
"pendulum==3.0.0",
|
|
"psycopg2-binary==2.9.10",
|
|
"pydantic==2.10.6",
|
|
"pydantic-settings==2.7.1",
|
|
"python-dotenv==1.0.1",
|
|
"python-jose[cryptography]==3.3.0",
|
|
"python-multipart==0.0.20",
|
|
"python-socketio==5.11.4",
|
|
"redis==5.2.1",
|
|
"rich==13.9.4",
|
|
"sqlalchemy==2.0.36",
|
|
"uvicorn[standard]==0.34.0",
|
|
]
|
|
|
|
[build-system]
|
|
requires = ["hatchling"]
|
|
build-backend = "hatchling.build"
|
|
|
|
[tool.hatch.build.targets.wheel]
|
|
packages = ["app"]
|
|
|
|
[dependency-groups]
|
|
dev = [
|
|
"black==24.10.0",
|
|
"flake8==7.1.1",
|
|
"mypy==1.14.1",
|
|
"pytest==8.3.4",
|
|
"pytest-asyncio==0.25.2",
|
|
"pytest-cov==6.0.0",
|
|
]
|