Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .claude/commands/build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Build both Docker images (dev and prod) and verify they build cleanly.

```bash
docker build --target dev -t python-project-base:dev . && \
docker build --target prod -t python-project-base:prod .
```

Report image sizes for both targets. Flag any build warnings or errors.
8 changes: 8 additions & 0 deletions .claude/commands/lint.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Run linting, formatting, and type checks.

```bash
uv run ruff check . && uv run ruff format --check . && uv run mypy src/
```

If ruff reports errors, fix them. If mypy reports type errors, explain each
one and apply fixes. After fixing, re-run to confirm all checks pass.
11 changes: 11 additions & 0 deletions .claude/commands/security.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Run security scans: static analysis and dependency vulnerability checks.

```bash
uv run bandit -r src/ -c pyproject.toml
uv run pip-audit
```

Report any HIGH or MEDIUM severity findings with:
- What the issue is
- Where it occurs (file:line)
- Recommended fix
8 changes: 8 additions & 0 deletions .claude/commands/test.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Run the full test suite with coverage.

```bash
uv run pytest --cov=src --cov-report=term-missing -v
```

If tests fail, show the full traceback and suggest fixes. If coverage drops
below 80%, flag which lines are uncovered.
51 changes: 51 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"name": "Python 3.13 (uv)",
"build": {
"dockerfile": "../Dockerfile",
"target": "dev",
"context": "..",
"args": {
"PYTHON_VERSION": "3.13"
}
},
"workspaceFolder": "/app",
"workspaceMount": "source=${localWorkspaceFolder},target=/app,type=bind,consistency=cached",
"mounts": [
"source=${devcontainerId}-venv,target=/app/.venv,type=volume"
],
"postCreateCommand": "uv sync --all-groups",
"remoteUser": "devuser",
"features": {
"ghcr.io/devcontainers/features/git:1": {},
"ghcr.io/devcontainers/features/github-cli:1": {}
},
"customizations": {
"vscode": {
"extensions": [
"ms-python.python",
"ms-python.vscode-pylance",
"charliermarsh.ruff",
"ms-python.mypy-type-checker",
"ms-python.debugpy",
"tamasfe.even-better-toml",
"ms-azuretools.vscode-docker",
"GitHub.copilot",
"GitHub.copilot-chat",
"github.vscode-github-actions"
],
"settings": {
"python.defaultInterpreterPath": "/app/.venv/bin/python",
"[python]": {
"editor.defaultFormatter": "charliermarsh.ruff",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.ruff": "explicit",
"source.organizeImports.ruff": "explicit"
}
},
"python.testing.pytestEnabled": true,
"python.testing.pytestArgs": ["tests"]
}
}
}
}
21 changes: 21 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
.git
.gitignore
.github
.vscode
.devcontainer
.mypy_cache
.pytest_cache
.ruff_cache
.coverage
coverage.xml
__pycache__
*.pyc
*.pyo
*.pyd
*.egg-info
dist/
build/
.venv/
node_modules/
*.md
!README.md
105 changes: 105 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
name: CI

on:
push:
branches: [main]
pull_request:
branches: [main]

permissions:
contents: read

jobs:
lint:
name: Lint & Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: astral-sh/setup-uv@v5
with:
python-version: "3.13"
enable-cache: true

- name: Install dependencies
run: uv sync --all-groups

- name: Ruff lint
run: uv run ruff check .

- name: Ruff format check
run: uv run ruff format --check .

- name: Mypy type check
run: uv run mypy src/

test:
name: Tests (Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.13"]
steps:
- uses: actions/checkout@v4

- uses: astral-sh/setup-uv@v5
with:
python-version: ${{ matrix.python-version }}
enable-cache: true

- name: Install dependencies
run: uv sync --all-groups

- name: Run tests with coverage
run: uv run pytest --cov=src --cov-report=xml

- name: Upload coverage report
uses: codecov/codecov-action@v4
with:
files: ./coverage.xml
continue-on-error: true

security:
name: Security Scan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: astral-sh/setup-uv@v5
with:
python-version: "3.13"
enable-cache: true

- name: Install dependencies
run: uv sync --all-groups

- name: pip-audit (dependency vulnerabilities)
run: uv run pip-audit

docker:
name: Docker Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build dev image
uses: docker/build-push-action@v6
with:
context: .
target: dev
push: false
cache-from: type=gha,scope=dev
cache-to: type=gha,mode=max,scope=dev

- name: Build production image
uses: docker/build-push-action@v6
with:
context: .
target: prod
push: false
cache-from: type=gha,scope=prod
cache-to: type=gha,mode=max,scope=prod
42 changes: 42 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: CodeQL

on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
# Weekly on Monday at 06:00 UTC
- cron: "0 6 * * 1"

permissions:
actions: read
contents: read
security-events: write

jobs:
analyze:
name: Analyze (Python)
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: python
config: |
paths:
- src
paths-ignore:
- tests
- .venv

- name: Autobuild
uses: github/codeql-action/autobuild@v3

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:python"
15 changes: 15 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"recommendations": [
"ms-python.python",
"ms-python.vscode-pylance",
"charliermarsh.ruff",
"ms-python.mypy-type-checker",
"ms-python.debugpy",
"tamasfe.even-better-toml",
"ms-azuretools.vscode-docker",
"ms-vscode-remote.remote-containers",
"GitHub.copilot",
"GitHub.copilot-chat",
"github.vscode-github-actions"
]
}
45 changes: 45 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "debugpy",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"justMyCode": true
},
{
"name": "Python: Module (app.main)",
"type": "debugpy",
"request": "launch",
"module": "app.main",
"console": "integratedTerminal",
"justMyCode": true,
"env": {
"PYTHONPATH": "${workspaceFolder}/src"
}
},
{
"name": "Python: Pytest (all)",
"type": "debugpy",
"request": "launch",
"module": "pytest",
"args": ["tests/", "-v", "--tb=short"],
"console": "integratedTerminal",
"justMyCode": false,
"env": {
"PYTHONPATH": "${workspaceFolder}/src"
}
},
{
"name": "Python: Pytest (current file)",
"type": "debugpy",
"request": "launch",
"module": "pytest",
"args": ["${file}", "-v", "--tb=short"],
"console": "integratedTerminal",
"justMyCode": false
}
]
}
34 changes: 34 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python",
"python.terminal.activateEnvironment": true,
"[python]": {
"editor.defaultFormatter": "charliermarsh.ruff",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.ruff": "explicit",
"source.organizeImports.ruff": "explicit"
}
},
"ruff.enable": true,
"ruff.lint.enable": true,
"mypy-type-checker.enabled": true,
"mypy-type-checker.args": ["--config-file=pyproject.toml"],
"python.testing.pytestEnabled": true,
"python.testing.pytestArgs": ["tests"],
"python.testing.unittestEnabled": false,
"python.analysis.typeCheckingMode": "off",
"editor.rulers": [88],
"editor.insertSpaces": true,
"editor.tabSize": 4,
"files.trimTrailingWhitespace": true,
"files.insertFinalNewline": true,
"files.exclude": {
"**/__pycache__": true,
"**/*.pyc": true,
".pytest_cache": true,
".mypy_cache": true,
".ruff_cache": true,
"*.egg-info": true
},
"evenBetterToml.formatter.alignEntries": false
}
Loading
Loading