deployment-patternslisted
Install: claude install-skill Izangi2714/claude-code-python-stack
# Deployment Patterns for Python
Production deployment workflows and CI/CD best practices.
## When to Activate
- Setting up CI/CD pipelines for Python projects
- Dockerizing Python/Django/FastAPI applications
- Planning deployment strategy
- Implementing health checks and readiness probes
## Deployment Strategies
| Strategy | Use When | Pros | Cons |
|----------|----------|------|------|
| Rolling | Standard deploys | Zero downtime | Two versions run simultaneously |
| Blue-Green | Critical services | Instant rollback | 2x infrastructure |
| Canary | Risky changes | Catches issues early | Requires traffic splitting |
## Python Dockerfile
```dockerfile
FROM python:3.12-slim AS builder
WORKDIR /app
RUN pip install --no-cache-dir uv
COPY requirements.txt .
RUN uv pip install --system --no-cache -r requirements.txt
FROM python:3.12-slim AS runner
WORKDIR /app
RUN useradd -r -u 1001 appuser
USER appuser
COPY --from=builder /usr/local/lib/python3.12/site-packages /usr/local/lib/python3.12/site-packages
COPY --from=builder /usr/local/bin /usr/local/bin
COPY . .
ENV PYTHONUNBUFFERED=1
EXPOSE 8000
HEALTHCHECK --interval=30s --timeout=3s CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8000/health/')" || exit 1
CMD ["gunicorn", "config.wsgi:application", "--bind", "0.0.0.0:8000", "--workers", "4"]
```
## GitHub Actions (Python)
```yaml
name: CI/CD
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test:
runs-on: ub