Python devops
Skill Mattakushi432/Claude-Code-Skills-Custom-DevTools-Pack/plugins/devtools-pack/skills/python-devops
When to activate: Dockerfile for Python, CI for Python, GitHub Actions, uv, production deployment, health checksFrom its SKILL.md
npx -y skills add Mattakushi432/Claude-Code-Skills-Custom-DevTools-Pack --skill python-devopsAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
2.7 KB, 670 tokens by cl100k_base, as published. Nobody here has run it
Python DevOps Patterns
Optimized Dockerfile
# Build stage
FROM python:3.11-slim AS builder
WORKDIR /build
# Install uv (fast package manager)
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
# Copy dependency specs first (cache layer)
COPY pyproject.toml uv.lock ./
RUN uv sync --frozen --no-dev --no-editable
# Runtime stage
FROM python:3.11-slim
WORKDIR /app
# Non-root user
RUN groupadd -r appgroup && useradd -r -g appgroup appuser
# Copy only the installed packages
COPY --from=builder /build/.venv /app/.venv
ENV PATH="/app/.venv/bin:$PATH"
COPY --chown=appuser:appgroup . .
USER appuser
# Health check
HEALTHCHECK --interval=30s --timeout=10s --retries=3 \
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')"
EXPOSE 8000
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000", "--workers", "4"]
GitHub Actions CI
name: Python CI
on:
push:
branches: [main]
pull_request:
jobs:
test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16
env:
POSTGRES_USER: test
POSTGRES_PASSWORD: test
POSTGRES_DB: test
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v3
- name: Set up Python
run: uv python install 3.11
- name: Install dependencies
run: uv sync --frozen
- name: Run ruff
run: uv run ruff check .
- name: Run mypy
run: uv run mypy app
- name: Run tests
env:
DATABASE_URL: postgresql+asyncpg://test:test@localhost/test
run: uv run pytest --cov=app --cov-fail-under=80
Health Check Endpoint
from fastapi import APIRouter
from sqlalchemy import text
router = APIRouter()
@router.get("/health")
async def health_check(db: AsyncSession = Depends(get_db)) -> dict:
try:
await db.execute(text("SELECT 1"))
db_status = "ok"
except Exception:
db_status = "error"
return {
"status": "ok" if db_status == "ok" else "degraded",
"database": db_status,
"version": settings.app_version,
}
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.