Skip to content

Document and test async startup hooks - #2901

Open
roli-lpci wants to merge 1 commit into
simonw:mainfrom
roli-lpci:docs/async-startup-hook
Open

Document and test async startup hooks#2901
roli-lpci wants to merge 1 commit into
simonw:mainfrom
roli-lpci:docs/async-startup-hook

Conversation

@roli-lpci

Copy link
Copy Markdown

The startup hook guide currently shows a synchronous function returning an async inner function. Datasette also accepts async def startup(datasette) directly, so plugins can await initialization work without the wrapper.

This updates the example and adds tests for direct async hooks, returned async functions, returned coroutines, and StartupError propagation after an awaited database query. It documents existing behavior and is scoped to the startup hook.

Refs #2497.

Validation: uv run pytest tests/test_plugins.py (154 passed, 4 skipped); strict Sphinx HTML build; Black and Ruff checks. Prepared with Codex assistance and reviewed with Claude and an independent Codex review.

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.

1 participant