python-uv

Modern Python development with uv package manager. Use when working on Python projects using uv, pytest, FastAPI, or Django. Covers development workflow, testing, and EC2 deployment.

16 stars

Best use case

python-uv is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Modern Python development with uv package manager. Use when working on Python projects using uv, pytest, FastAPI, or Django. Covers development workflow, testing, and EC2 deployment.

Teams using python-uv should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/python-uv/SKILL.md --create-dirs "https://raw.githubusercontent.com/diegosouzapw/awesome-omni-skill/main/skills/backend/python-uv/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/python-uv/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How python-uv Compares

Feature / Agentpython-uvStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Modern Python development with uv package manager. Use when working on Python projects using uv, pytest, FastAPI, or Django. Covers development workflow, testing, and EC2 deployment.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# Python/uv Development

Modern Python development workflow using uv instead of pip/poetry.

## Why uv?

- 10-100x faster than pip
- Drop-in replacement for pip, pip-tools, virtualenv
- Lockfile support (`uv.lock`)
- Built-in Python version management

## Project Setup

### New Project

```bash
# Initialize project
uv init my-project
cd my-project

# Or with specific Python version
uv init my-project --python 3.12
```

### Existing Project

```bash
# Create venv and sync dependencies
uv sync

# With dev dependencies
uv sync --dev
```

### pyproject.toml Structure

```toml
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "my-project"
version = "0.1.0"
description = "Project description"
readme = "README.md"
requires-python = ">=3.12"
authors = [{ name = "Your Name", email = "you@example.com" }]
dependencies = [
    "fastapi~=0.118",
    "uvicorn[standard]~=0.37",
    "pydantic>=2.12,<3",
]

[project.optional-dependencies]
dev = [
    "pytest",
    "pytest-asyncio",
    "pytest-cov",
    "ruff",
    "black",
]

[project.scripts]
myapp = "app.main:start"

[tool.pytest.ini_options]
asyncio_mode = "auto"
testpaths = ["tests"]
addopts = "-q --tb=short"

[tool.ruff]
target-version = "py312"
line-length = 88

[tool.black]
line-length = 88
target-version = ["py312"]
```

## Development Workflow

### Dependency Management

```bash
# Add dependency
uv add fastapi

# Add dev dependency
uv add --dev pytest

# Add with version constraint
uv add "pydantic>=2.0,<3"

# Remove dependency
uv remove package-name

# Update all dependencies
uv sync --upgrade

# Update specific package
uv add package-name --upgrade
```

### Running Code

```bash
# Run script
uv run python script.py

# Run module
uv run python -m app.main

# Run project script (from pyproject.toml)
uv run myapp

# Run with specific Python
uv run --python 3.12 python script.py
```

### Testing

```bash
# Run all tests
uv run pytest

# Run with coverage
uv run pytest --cov=app --cov-report=term-missing

# Run specific test file
uv run pytest tests/test_api.py

# Run tests in parallel
uv run pytest -n auto

# Run marked tests
uv run pytest -m "not slow"
```

### Linting and Formatting

```bash
# Format with black
uv run black .

# Check formatting
uv run black --check .

# Lint with ruff
uv run ruff check .

# Auto-fix ruff issues
uv run ruff check --fix .

# Sort imports
uv run isort .
```

## FastAPI Development

### Project Structure

```
my-project/
├── app/
│   ├── __init__.py
│   ├── main.py           # FastAPI app
│   ├── api/
│   │   ├── __init__.py
│   │   └── routes.py
│   ├── models/
│   │   └── __init__.py
│   └── tests/
│       └── test_api.py
├── pyproject.toml
├── uv.lock
└── README.md
```

### Running FastAPI

```bash
# Development with auto-reload
uv run uvicorn app.main:app --reload --port 8000

# Production
uv run uvicorn app.main:app --host 0.0.0.0 --port 8000 --workers 4
```

## Django Development

### Running Django

```bash
# Migrations
uv run python manage.py migrate

# Run server
uv run python manage.py runserver

# Create superuser
uv run python manage.py createsuperuser

# Shell
uv run python manage.py shell
```

## Database Migrations (Alembic)

```bash
# Generate migration
uv run alembic revision --autogenerate -m "Add users table"

# Apply migrations
uv run alembic upgrade head

# Rollback
uv run alembic downgrade -1
```

## EC2 Deployment

### Deploy Script Pattern (from rookery)

```bash
# GitHub Actions deploy pattern
SCRIPT_AFTER: |
  set -e
  # Install uv
  curl -LsSf https://astral.sh/uv/install.sh | sh
  export PATH="$HOME/.local/bin:$PATH"

  cd /opt/myapp

  # Sync dependencies
  uv sync

  # Run migrations
  uv run alembic upgrade head

  # Restart service
  sudo systemctl restart myapp

  # Health check with retries
  for i in {1..5}; do
    if curl -sf http://127.0.0.1:8000/api/health; then
      echo "Health check passed"
      exit 0
    fi
    sleep 5
  done
  exit 1
```

### Systemd Service

```ini
# /etc/systemd/system/myapp.service
[Unit]
Description=My FastAPI App
After=network.target

[Service]
User=appuser
WorkingDirectory=/opt/myapp
ExecStart=/home/appuser/.local/bin/uv run uvicorn app.main:app --host 0.0.0.0 --port 8000 --workers 2
Restart=always
RestartSec=5

[Install]
WantedBy=multi-user.target
```

## CI/CD

### GitHub Actions

```yaml
name: Python Tests

on: [push, pull_request]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Install uv
        uses: astral-sh/setup-uv@v4
        with:
          version: "latest"

      - name: Set up Python
        run: uv python install 3.12

      - name: Install dependencies
        run: uv sync --dev

      - name: Run tests
        run: uv run pytest

      - name: Lint
        run: uv run ruff check .
```

## Common Patterns

### Version Stamping

```bash
# Stamp build version for deployments
printf "%s\n" "$(date -u +%Y%m%dT%H%M%SZ)_$(git rev-parse --short HEAD)" > VERSION
```

### Environment Variables

```python
# app/config.py
from pydantic_settings import BaseSettings

class Settings(BaseSettings):
    database_url: str
    secret_key: str
    debug: bool = False

    class Config:
        env_file = ".env"

settings = Settings()
```

## Quick Reference

```bash
# Essential commands
uv sync              # Install all dependencies
uv run pytest        # Run tests
uv run ruff check .  # Lint
uv run black .       # Format
uv add <pkg>         # Add dependency
uv add --dev <pkg>   # Add dev dependency

# FastAPI
uv run uvicorn app.main:app --reload

# Django
uv run python manage.py runserver

# Alembic
uv run alembic upgrade head
```

Related Skills

lang-python

16
from diegosouzapw/awesome-omni-skill

Python 3.13+ development specialist covering FastAPI, Django, async patterns, data science, testing with pytest, and modern Python features. Use when developing Python APIs, web applications, data pipelines, or writing tests.

Add prerequisite install script for Python deps (self-contained skill)

16
from diegosouzapw/awesome-omni-skill

No description provided.

python-github-actions

16
from diegosouzapw/awesome-omni-skill

Complete Python GitHub Actions system. PROACTIVELY activate for: (1) uv-based CI workflows (10-100x faster), (2) Matrix testing across Python versions, (3) Dependency caching with setup-uv, (4) Parallel test execution, (5) Reusable workflows, (6) Publishing to PyPI with trusted publishing, (7) Code coverage with codecov, (8) Security scanning. Provides: Workflow templates, caching config, matrix strategies, composite actions. Ensures fast, reliable CI/CD pipelines.

biopython

16
from diegosouzapw/awesome-omni-skill

Comprehensive molecular biology toolkit. Use for sequence manipulation, file parsing (FASTA/GenBank/PDB), phylogenetics, and programmatic NCBI/PubMed access (Bio.Entrez). Best for batch processing, custom bioinformatics pipelines, BLAST automation. For quick lookups use gget; for multi-service integration use bioservices.

python-v3.14

16
from diegosouzapw/awesome-omni-skill

Python 3.14 / FastAPI. Proyecto usa este skill; contenido canónico en .ai-system.

python-pro

16
from diegosouzapw/awesome-omni-skill

Master Python 3.12+ with modern features, async programming, performance optimization, and production-ready practices. Expert in the latest Python ecosystem including uv, ruff, pydantic, and FastAPI.

python-fastapi

16
from diegosouzapw/awesome-omni-skill

Python FastAPI development with uv package manager, modular project structure, SQLAlchemy ORM, and production-ready patterns.

python-fastapi-scalable-api-cursorrules-prompt-fil

16
from diegosouzapw/awesome-omni-skill

Apply for python-fastapi-scalable-api-cursorrules-prompt-fil. --- description: Defines conventions specific to FastAPI usage in the backend. globs: backend/src/**/*.py

python-fastapi-development

16
from diegosouzapw/awesome-omni-skill

Python FastAPI backend development with async patterns, SQLAlchemy, Pydantic, authentication, and production API patterns.

python-django-best-practices-cursorrules-prompt-fi

16
from diegosouzapw/awesome-omni-skill

Apply for python-django-best-practices-cursorrules-prompt-fi. --- description: Configurations for Django settings file with the list of dependencies and conventions. globs: **/settings.py

python-development-python-scaffold

16
from diegosouzapw/awesome-omni-skill

You are a Python project architecture expert specializing in scaffolding production-ready Python applications. Generate complete project structures with modern tooling (uv, FastAPI, Django), type hint

python-backend-expert

16
from diegosouzapw/awesome-omni-skill

Python backend expert including Django, FastAPI, Flask, SQLAlchemy, and async patterns