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
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ cd my-app && uv sync && uv run pytest
# Add a local extension
CI=true uv run create-awesome-python-app my-app \
--template "file://$PWD?subdir=templates/fastapi-starter" \
--addons "file://$PWD?subdir=extensions/github-setup" \
--addons "file://$PWD?subdir=extensions/all-github-setup" \
--no-interactive
```

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ uvx create-awesome-python-app
# With template and extensions
uvx create-awesome-python-app my-api \
--template fastapi-starter \
--addons github-setup python-docker
--addons github-setup fastapi-docker
```

For local development against this checkout:
Expand Down
5 changes: 4 additions & 1 deletion ci/profiles/celery-default.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@
"id": "celery-default",
"description": "Celery worker with GitHub CI + Docker",
"templateDir": "celery-worker",
"addons": ["github-setup", "python-docker"]
"addons": [
"github-setup",
"celery-docker"
]
}
5 changes: 4 additions & 1 deletion ci/profiles/cli-default.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@
"id": "cli-default",
"description": "CLI tool with GitHub CI + Dev Container",
"templateDir": "cli-starter",
"addons": ["github-setup", "python-devcontainer"]
"addons": [
"github-setup",
"development-container"
]
}
8 changes: 6 additions & 2 deletions ci/profiles/django-default.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{
"id": "django-default",
"description": "Django API with GitHub CI + Dev Container",
"description": "Django API with GitHub CI + Docker + Dev Container",
"templateDir": "django-api",
"addons": ["github-setup", "python-devcontainer"]
"addons": [
"github-setup",
"development-container",
"django-docker"
]
}
6 changes: 5 additions & 1 deletion ci/profiles/fastapi-default.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@
"id": "fastapi-default",
"description": "Typical FastAPI API: GitHub CI + Docker + Postgres",
"templateDir": "fastapi-starter",
"addons": ["github-setup", "python-docker", "python-postgres"]
"addons": [
"github-setup",
"fastapi-docker",
"postgres"
]
}
5 changes: 4 additions & 1 deletion ci/profiles/fastapi-devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@
"id": "fastapi-devcontainer",
"description": "FastAPI with GitHub CI and VS Code Dev Container",
"templateDir": "fastapi-starter",
"addons": ["github-setup", "python-devcontainer"]
"addons": [
"github-setup",
"development-container"
]
}
4 changes: 3 additions & 1 deletion ci/profiles/uv-workspace-default.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@
"id": "uv-workspace-default",
"description": "uv workspace monorepo with GitHub CI",
"templateDir": "uv-workspace-starter",
"addons": ["github-setup"]
"addons": [
"github-setup"
]
}
5 changes: 4 additions & 1 deletion ci/profiles/uv-workspace-devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@
"id": "uv-workspace-devcontainer",
"description": "uv workspace monorepo with GitHub CI and VS Code Dev Container",
"templateDir": "uv-workspace-starter",
"addons": ["github-setup", "python-devcontainer"]
"addons": [
"github-setup",
"development-container"
]
}
11 changes: 11 additions & 0 deletions docs/AUTHORING.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,17 @@ Examples:

**Never** use a generic `python-*` folder/slug for overlays that write FastAPI `app/` paths or a FastAPI-only `CMD`.

CI enforces this in `scripts/ci/validate-registry.py`: folders must be `all-*`, or
`{stack}-*` matching the extension's single `type` (see `STACK_PREFIX_BY_TYPE`).

### `incompatibleWith` (path collisions)

Use symmetric `incompatibleWith` when two extensions would overwrite the same
generated paths (for example two Docker overlays that both ship `Dockerfile` /
`compose.yml` for the **same** template `type`). Today stack Docker extensions
are isolated by `type`; when a type gains a second packaging strategy, declare
mutual incompatibility like cna-templates does for Redux saga/thunk.

### Template quality bar (every catalog template)

Every template registered in `templates.json` must ship at least:
Expand Down
6 changes: 3 additions & 3 deletions docs/FUTURE_TEMPLATES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Planned templates and extensions not yet in `templates.json`. These are phased a

| Slug | Type | Description |
|------|------|-------------|
| `uv-workspace-starter` | `uv-workspace` | Python monorepo using uv workspaces: shared `packages/` libraries and `apps/` deployables with one lockfile, shared Ruff/Pyright/pytest, and a Typer CLI that consumes a local library. Compatible extensions: `github-setup`, `python-devcontainer`. |
| `uv-workspace-starter` | `uv-workspace` | Python monorepo using uv workspaces: shared `packages/` libraries and `apps/` deployables with one lockfile, shared Ruff/Pyright/pytest, and a Typer CLI that consumes a local library. Compatible extensions: `github-setup`, `development-container`. |

## Planned templates

Expand All @@ -19,13 +19,13 @@ Planned templates and extensions not yet in `templates.json`. These are phased a

- **When:** Command-line tools, internal utilities, or libraries shipped as console scripts.
- **Stack:** `pyproject.toml` with `[project.scripts]`, Typer (or Click), pytest for CLI invocation tests.
- **Extensions:** `github-setup`, `python-devcontainer`; Docker extension optional for containerized CLI distribution.
- **Extensions:** `github-setup`, `development-container`; Docker extension optional for containerized CLI distribution.

### `celery-worker`

- **When:** Background jobs, scheduled tasks, or async processing separate from an HTTP API.
- **Stack:** Celery app module, worker/beat commands, health probe, example task.
- **Extensions:** `python-docker`, `python-postgres` (for result backend or ORM), message-broker compose under `docker/redis/` or similar.
- **Extensions:** `fastapi-docker`, `postgres` (for result backend or ORM), message-broker compose under `docker/redis/` or similar.

## Contributing

Expand Down
2 changes: 1 addition & 1 deletion docs/MAINTENANCE_CI.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ Curated JSON under `ci/profiles/`. Validator enforces **one extension per catego
REPO="$PWD"
python scripts/ci/run-scaffold-check.py \
--template-url "file://$REPO?subdir=templates/fastapi-starter" \
--addon-url "file://$REPO?subdir=extensions/python-docker" \
--addon-url "file://$REPO?subdir=extensions/fastapi-docker" \
--workdir /tmp/cpa-check
```

Expand Down
6 changes: 3 additions & 3 deletions docs/MAINTENANCE_TEMPLATES.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,11 @@ Key questions:
ls extensions/

# Read the registry entry
grep -A 15 '"slug": "python-docker"' templates.json
grep -A 15 '"slug": "fastapi-docker"' templates.json

# Read partial manifest and files
cat extensions/python-docker/pyproject.toml
ls -la extensions/python-docker
cat extensions/fastapi-docker/pyproject.toml
ls -la extensions/fastapi-docker
```

Key questions:
Expand Down
6 changes: 3 additions & 3 deletions docs/TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ After entries are registered in `templates.json` and the CLI catalog points to t
```sh
CI=true uvx create-awesome-python-app my-app \
--template fastapi-starter \
--addons github-setup python-docker \
--addons github-setup fastapi-docker \
--no-interactive
cd my-app && uv sync && uv run ruff check . && uv run pytest
```
Expand All @@ -29,8 +29,8 @@ CI=true uvx create-awesome-python-app my-app \
CI=true uvx create-awesome-python-app my-app \
--template "file://$REPO?subdir=templates/fastapi-starter" \
--addons \
"file://$REPO?subdir=extensions/github-setup" \
"file://$REPO?subdir=extensions/python-docker" \
"file://$REPO?subdir=extensions/all-github-setup" \
"file://$REPO?subdir=extensions/fastapi-docker" \
--no-interactive
cd my-app && uv sync && uv run pytest
```
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Dev Container (extension bank)

Maintainer-facing notes for the **python-devcontainer** extension in `cpa-templates`.
Maintainer-facing notes for the **development-container** extension in `cpa-templates`.

Copied into generated projects (via `template/`):

Expand All @@ -18,7 +18,7 @@ The bank `README.md` (this file) stays **outside** `template/` so it does not ov
```sh
uvx create-awesome-python-app my-api \
--template fastapi-starter \
--addons python-devcontainer \
--addons development-container \
--yes
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Overview

The **python-devcontainer** extension opens the project in a [Dev Container](https://code.visualstudio.com/docs/devcontainers/containers) with Python 3.12 and [uv](https://docs.astral.sh/uv/). It is editor-focused and does not replace **python-docker** for deployment or CI image builds. You can use both: Dev Container for daily coding, Docker Compose for integration testing.
The **development-container** extension opens the project in a [Dev Container](https://code.visualstudio.com/docs/devcontainers/containers) with Python 3.12 and [uv](https://docs.astral.sh/uv/). It is editor-focused and does not replace **fastapi-docker** for deployment or CI image builds. You can use both: Dev Container for daily coding, Docker Compose for integration testing.

## What it adds

Expand Down Expand Up @@ -37,7 +37,7 @@ uv run uvicorn app.main:app --reload --host 0.0.0.0 --port 8000

Port `8000` is forwarded — open http://localhost:8000/docs.

### With python-postgres
### With postgres

The Dev Container does not start Postgres automatically. Options:

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# PostgreSQL (extension bank)

Maintainer-facing notes for the **python-postgres** extension in `cpa-templates`.
Maintainer-facing notes for the **postgres** extension in `cpa-templates`.

Copied into generated projects (via `template/`):

Expand All @@ -20,16 +20,16 @@ The bank `README.md` (this file) stays **outside** `template/` so it does not ov
```sh
uvx create-awesome-python-app my-api \
--template fastapi-starter \
--addons python-postgres \
--addons postgres \
--yes
```

Often combined with `python-docker`:
Often combined with `fastapi-docker`:

```sh
uvx create-awesome-python-app my-api \
--template fastapi-starter \
--addons python-docker python-postgres \
--addons fastapi-docker postgres \
--yes
```

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

# PostgreSQL (python-postgres extension)
# PostgreSQL (postgres extension)
# PostgreSQL (optional overlay)
# DATABASE_URL=postgresql+psycopg://app:app@localhost:5432/app
POSTGRES_USER=app
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Overview

The **python-postgres** extension adds a local Postgres 16 Compose service under `docker/postgres/`, merges the `psycopg[binary]` driver into `pyproject.toml`, and appends Postgres-related keys to `.env.example`.
The **postgres** extension adds a local Postgres 16 Compose service under `docker/postgres/`, merges the `psycopg[binary]` driver into `pyproject.toml`, and appends Postgres-related keys to `.env.example`.

It ships the **database service and client library** — wire your ORM and migrations in application code after scaffold.

Expand All @@ -29,7 +29,7 @@ Connect from the host:
psql "postgresql://app:app@localhost:5432/app"
```

### With python-docker
### With fastapi-docker

```sh
docker compose -f compose.yml -f docker/postgres/compose.yml up --build
Expand Down Expand Up @@ -59,7 +59,7 @@ Root `.env.example` gains these keys from `.env.example.append`:
| `POSTGRES_DB` | `app` | Database name |
| `DATABASE_URL` | (commented example) | e.g. `postgresql+psycopg://app:app@localhost:5432/app` |

When combined with **python-docker**, the postgres compose overlay sets:
When combined with **fastapi-docker**, the postgres compose overlay sets:

```env
DATABASE_URL=postgresql+psycopg://app:app@db:5432/app
Expand Down
33 changes: 33 additions & 0 deletions extensions/celery-docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Docker for Celery (extension bank)

Maintainer-facing notes for the **celery-docker** extension.

Copied into generated projects (via `template/`):

| Path | Purpose |
|------|---------|
| `Dockerfile` | uv-based image; Celery worker CMD |
| `.dockerignore` | Excludes `.venv`, caches, git metadata |
| `compose.yml` | Dev worker compose (bind mount) |
| `compose.prod.yml` | Prod worker overlay |
| `docs/DOCKER_GUIDE.md` | Long-form guide |
| `docs/README.md.append` | Index bullet |

Compose includes a Redis broker. Env vars are `BROKER_URL` / `RESULT_BACKEND`
(matching `worker/config.py`). Pair with `postgres` only when the worker also
needs a database.

## Apply

```sh
uvx create-awesome-python-app my-worker \
--template celery-worker \
--addons celery-docker \
--yes
```

## Verify

```sh
docker compose up --build
```
15 changes: 15 additions & 0 deletions extensions/celery-docker/template/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim

WORKDIR /app

ENV UV_COMPILE_BYTECODE=1
ENV UV_LINK_MODE=copy
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1

COPY pyproject.toml README.md ./
COPY worker ./worker

RUN uv sync --no-dev

CMD ["uv", "run", "celery", "-A", "worker.celery_app", "worker", "--loglevel=INFO"]
15 changes: 15 additions & 0 deletions extensions/celery-docker/template/compose.prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
services:
redis:
image: redis:7-alpine
restart: always
worker:
build: .
env_file:
- .env
environment:
BROKER_URL: redis://redis:6379/0
RESULT_BACKEND: redis://redis:6379/1
restart: always
depends_on:
- redis
command: uv run celery -A worker.celery_app worker --loglevel=INFO --concurrency=2
17 changes: 17 additions & 0 deletions extensions/celery-docker/template/compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
services:
redis:
image: redis:7-alpine
ports:
- "6379:6379"
worker:
build: .
env_file:
- .env
environment:
BROKER_URL: redis://redis:6379/0
RESULT_BACKEND: redis://redis:6379/1
volumes:
- .:/app
depends_on:
- redis
command: uv run celery -A worker.celery_app worker --loglevel=INFO
Loading
Loading