Add datasette-paper embed provider for FEC candidates#1
Closed
asg017 wants to merge 3 commits into
Closed
Conversation
Implements a paper_embed_provider so an FEC candidate renders as a rich
inline pill and read-only block card inside a paper document.
- datasette_libfec/paper.py: provider descriptor (kind=libfec-candidate,
ref_prefixes, /-menu source, vite frontend_assets unwrapped to bare URLs).
- frontend/src/paper_embed.ts: client-side provider (matchRef/matchUrl/
resolve/mount/picker/search). Fetches Datasette's native
/{db}/libfec_candidates.json with the viewer cookie; leak discipline maps
403->denied, missing->not_found. Stored ref is reordered to
/-/libfec/candidate/{db}/{id} so it sits under a static ref_prefix (the
real page URL leads with a variable db segment).
- frontend/vite.config.ts: paper-embed entry + preserveEntrySignatures
"allow-extension" so the provider's `export default` survives the app
build (default false tree-shakes it away).
- pyproject.toml: datasette-libfec[paper] optional extra pinning
datasette-paper>=0.0.2a3 via the sibling wheel.
Verified live: both inline pills and the block card render against the
fixture db; native table API + /-/databases.json shapes confirmed.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013ikxoxihTC15haHeknRcgg
The [tool.uv.sources] path pointed at a sibling checkout's wheel that doesn't exist in CI (or fresh clones), so `uv run pytest` failed at resolve time before any test ran. The paper extra is optional and the plugin is a no-op without datasette-paper, so drop the local path source and document how to supply the wheel via --find-links for local dev. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The extra resolves from PyPI (datasette-paper 0.0.2a3+ is published); it's a prerelease, so a fresh checkout may need --prerelease=allow. No local wheel. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Collaborator
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a
datasette-paperembed provider for FEC candidates.🤖 Generated with Claude Code