Skip to content

Latest commit

 

History

History
114 lines (87 loc) · 3.06 KB

File metadata and controls

114 lines (87 loc) · 3.06 KB

python-dev

Pre-built devcontainer for Python projects — APIs (FastAPI, Flask, Django), data pipelines, CLI tools, and scripts. Works for both human developers and AI coding agents.

What's included

Tool Version Purpose
Python 3.14 (patch auto-updates) Runtime
pip / pipx / virtualenv via installTools: true Package and environment management
Docker-outside-of-Docker latest Build images and run containers via the host Docker socket
kubectl 1.36 Deploy to and inspect Kubernetes clusters
Helm 4.1.4 Install and manage Helm charts
k3d 5.8.3 Local Kubernetes cluster (auto-started on container start)
git latest Source control
GitHub CLI (gh) latest PRs, issues, releases, Actions

VS Code extensions

Extension Purpose
github.copilot AI completions
github.copilot-chat AI chat and inline edits
anthropics.claude-code Claude Code agent
ms-python.python Language server, debugging, test runner
ms-python.pylance Fast type checking and IntelliSense
ms-python.black-formatter Black code formatter

Use cases

FastAPI service

// .devcontainer/devcontainer.json in your service repo
{
  "name": "my-api",
  "image": "ghcr.io/dever-labs/devcontainers/python-dev:latest",
  "forwardPorts": [8000],
  "portsAttributes": {
    "8000": { "label": "FastAPI", "onAutoForward": "openBrowser" }
  },
  "postCreateCommand": "pip install -r requirements.txt"
}

Start the server:

uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload

Using a virtual environment

python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

Or with uv (install once, fast everywhere):

pip install uv
uv venv && source .venv/bin/activate
uv pip install -r requirements.txt

Data pipeline / script

{
  "name": "my-pipeline",
  "image": "ghcr.io/dever-labs/devcontainers/python-dev:latest",
  "postCreateCommand": "pip install -r requirements.txt"
}

Running tests

pytest -v
# or with coverage
pytest --cov=src --cov-report=term-missing

Deploying a Python service to local Kubernetes

A k3d cluster starts automatically when the container starts. Build and deploy with Helm:

docker build -t my-api:local .
helm upgrade --install my-api ./charts/my-api \
  --set image.repository=my-api \
  --set image.tag=local

AI agent use (Copilot coding agent / Claude Code)

  • GITHUB_TOKEN is forwarded so gh and git work without prompts.
  • Pylance gives agents precise type information for accurate refactoring.
  • Claude Code and Copilot extensions are pre-installed.
  • Agents can run pytest, validate API responses with httpx, and iterate without leaving the container.

Updating Python

Edit images/python-dev/devcontainer.json:

"ghcr.io/devcontainers/features/python:1": {
  "version": "3.14"   // pin to major.minor; patches flow automatically
}

Push to main — all service repos pick it up on next rebuild.