Skip to content

Commit a1ed6e3

Browse files
snopokeclaude
andcommitted
docs: refresh CLAUDE.md architecture and test prerequisites
Procrastinate, context providers and the heartbeat thread were missing from the architecture map, and both test commands understated what they need to run. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 39ffb8c commit a1ed6e3

1 file changed

Lines changed: 12 additions & 6 deletions

File tree

CLAUDE.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ Official Python client for [Task Badger](https://taskbadger.net/). Public packag
66

77
```bash
88
uv sync --frozen # Install deps (incl. dev + cli extras via dependency-groups)
9-
uv run pytest # Run unit tests (integration_tests/ is excluded by default)
10-
uv run pytest integration_tests -vs # Run integration tests (needs Redis + TASKBADGER_API_KEY)
9+
uv run pytest # Run unit tests (needs Redis; integration_tests/ excluded by default)
10+
uv run pytest integration_tests -vs # Run integration tests (needs Redis + Postgres + API key)
1111
uv run ruff check . --fix # Lint
1212
uv run ruff format . # Format
1313
uv build # Build sdist + wheel
@@ -20,7 +20,10 @@ Pre-commit runs ruff-check + ruff-format; install with `uv run pre-commit instal
2020
- `taskbadger/` — SDK source
2121
- `sdk.py`, `mug.py`, `safe_sdk.py` — public API surface (re-exported from `__init__.py`)
2222
- `decorators.py``@track` decorator
23-
- `systems/`, `celery.py` — Celery integration (optional extra)
23+
- `celery.py`, `procrastinate.py` — per-queue integrations (optional extras)
24+
- `systems/`, `_integrations.py` — auto-tracking layer (`BaseSystemIntegration`) wired onto a Celery/Procrastinate app
25+
- `context_providers/`, `_error_context.py` — pluggable error context (e.g. Sentry issue links) via `init(context_providers=[...])`
26+
- `_heartbeat.py` — background thread pinging long-running tasks
2427
- `cli/`, `cli_main.py` — Typer-based CLI (optional `[cli]` extra)
2528
- `internal/`**generated** by `openapi-python-client`; do not hand-edit
2629
- `tests/` — unit tests (pytest, pytest-httpx)
@@ -40,7 +43,7 @@ The `update-api` invoke task curls `localhost:8000/api/schema.json` by default
4043

4144
- Ruff: line-length 120, target Python 3.10, rules `E F I UP DJ PT`.
4245
- Supports Python 3.10–3.14 — don't use 3.11+ syntax (e.g. `Self`, `LiteralString`).
43-
- Celery and CLI deps are optional; guard imports inside `taskbadger/celery.py`, `taskbadger/systems/celery.py`, `taskbadger/cli/`.
46+
- Extras (`celery`, `procrastinate`, `cli`, `sentry`) are all optional; keep their imports inside the corresponding module (`taskbadger/celery.py`, `taskbadger/procrastinate.py`, `taskbadger/systems/`, `taskbadger/cli/`, `taskbadger/context_providers/sentry.py`).
4447
- `taskbadger/internal/*` is generator output — lint is best-effort, don't reformat manually.
4548

4649
## Releasing
@@ -54,5 +57,8 @@ GitHub Actions then drafts a release; publishing the release triggers `publish.y
5457
## Gotchas
5558

5659
- `pytest` skips `integration_tests/` via `norecursedirs` — name them explicitly to run.
57-
- Integration tests need `TASKBADGER_ORG`, `TASKBADGER_PROJECT`, `TASKBADGER_API_KEY` env vars and a running Redis.
58-
- Imports of `celery`, `typer`, `rich` must stay optional — only the core httpx/attrs deps are guaranteed.
60+
- Integration tests need `TASKBADGER_ORG`, `TASKBADGER_PROJECT`, `TASKBADGER_API_KEY`, a running Redis, and Postgres via `PROCRASTINATE_DSN` (defaults to `postgresql://postgres:postgres@localhost:5432/procrastinate`).
61+
- Unit tests also need Redis — `tests/conftest.py` points Celery at `redis://localhost:6379` so serialization is exercised for real.
62+
- Don't unpin `openapi-python-client<0.29` — 0.29 generates `datetime.fromisoformat` calls that can't parse the API's `Z`-suffixed timestamps on Python 3.10.
63+
- User-facing features are documented in `README.md`, not a docs site — add a section there when adding one.
64+
- Only the core httpx/attrs/dateutil/tomlkit deps are guaranteed at runtime.

0 commit comments

Comments
 (0)