Skip to content

Add complete Python project base template#1

Merged
samhodgkinson merged 3 commits into
mainfrom
claude/python-docker-template-QWs3s
Jun 5, 2026
Merged

Add complete Python project base template#1
samhodgkinson merged 3 commits into
mainfrom
claude/python-docker-template-QWs3s

Conversation

@samhodgkinson

Copy link
Copy Markdown
Owner

Sets up the repository as a reusable base for any Python project:

  • Dockerfile: multi-stage build (dev target for dev containers, prod for deployment)
  • docker-compose.yml: app, dev, and test services
  • pyproject.toml: uv project config with ruff, mypy, pytest, bandit, pip-audit
  • .devcontainer/: VS Code dev container using the dev Dockerfile target
  • .vscode/: settings, recommended extensions, and debug launch configs
  • .github/workflows/: CI (lint, test, security scan, Docker build) + CodeQL
  • src/app/: minimal application entry point
  • tests/: pytest example with coverage
  • CLAUDE.md: AI context for Claude Code
  • .claude/commands/: /test, /lint, /security, /build slash commands

https://claude.ai/code/session_01TiXyp1vCmxNP2ewP4s1TGH

claude added 3 commits June 5, 2026 22:46
Sets up the repository as a reusable base for any Python project:

- Dockerfile: multi-stage build (dev target for dev containers, prod for deployment)
- docker-compose.yml: app, dev, and test services
- pyproject.toml: uv project config with ruff, mypy, pytest, bandit, pip-audit
- .devcontainer/: VS Code dev container using the dev Dockerfile target
- .vscode/: settings, recommended extensions, and debug launch configs
- .github/workflows/: CI (lint, test, security scan, Docker build) + CodeQL
- src/app/: minimal application entry point
- tests/: pytest example with coverage
- CLAUDE.md: AI context for Claude Code
- .claude/commands/: /test, /lint, /security, /build slash commands

https://claude.ai/code/session_01TiXyp1vCmxNP2ewP4s1TGH
Commits the generated lock file so CI and Docker builds resolve
identical dependency versions across all environments.

https://claude.ai/code/session_01TiXyp1vCmxNP2ewP4s1TGH
Correctness:
- pytest: add pythonpath = ["src"] so bare pytest works without uv sync
- pyproject.toml: remove dead `targets` key from [tool.bandit] (silently ignored)

Developer experience:
- pytest addopts: remove coverage flags; pass --cov=src explicitly in CI only
- VS Code: set python.analysis.typeCheckingMode to "off" (defer to mypy strict)
- pyproject.toml: remove warn_return_any/warn_unused_configs (already in strict)

CI:
- ci.yml: add enable-cache: true to all setup-uv steps
- ci.yml: drop bandit from CI; CodeQL covers SAST with better data-flow analysis
- ci.yml: add scope=dev/prod to Docker GHA cache steps to prevent collision
- ci.yml: add --cov=src to test job run step

Docker / devcontainer:
- Dockerfile dev stage: add non-root devuser (uid 1000), remove redundant
  build-time uv sync (the venv volume always shadows it anyway)
- devcontainer.json: change remoteUser from root to devuser
- docker-compose.yml: remove confusing `dev` service (was just a pytest runner
  with a misleading name); single `test` service covers that use case

https://claude.ai/code/session_01TiXyp1vCmxNP2ewP4s1TGH
@samhodgkinson samhodgkinson merged commit 27b0cd9 into main Jun 5, 2026
4 of 5 checks passed
@samhodgkinson samhodgkinson deleted the claude/python-docker-template-QWs3s branch June 5, 2026 23:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants