Skip to content

Add datasette-paper embed provider for FEC candidates#1

Closed
asg017 wants to merge 3 commits into
mainfrom
paper-embed-0630
Closed

Add datasette-paper embed provider for FEC candidates#1
asg017 wants to merge 3 commits into
mainfrom
paper-embed-0630

Conversation

@asg017

@asg017 asg017 commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

Adds a datasette-paper embed provider for FEC candidates.

🤖 Generated with Claude Code

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
asg017 and others added 2 commits July 6, 2026 16:46
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>
@asg017

asg017 commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator Author

Superseded by #4 — reorganized so the screenshot tooling (#3) sits on main and the paper embed provider + paper screenshot stack on top of it.

@asg017 asg017 closed this Jul 7, 2026
@asg017 asg017 deleted the paper-embed-0630 branch July 7, 2026 00:30
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