Skip to content

Add package detail pages and improve packages UI#7

Merged
simonw merged 3 commits intomainfrom
claude/add-package-detail-pages-QEZfz
Feb 8, 2026
Merged

Add package detail pages and improve packages UI#7
simonw merged 3 commits intomainfrom
claude/add-package-detail-pages-QEZfz

Conversation

@simonw
Copy link
Owner

@simonw simonw commented Feb 8, 2026

Add a feature where each package gets a page at /-/packages/name-of-package which is a page that shows the available metadata about that package, including the README - rendered as plain text using pre-wrap styling

The /-/packages page should stop showing JSON and should instead show an HTML. list of those packages, each a link to that page, still also showing the version number

Summary

This PR enhances the datasette-packages plugin by adding individual package detail pages and improving the overall user interface with proper HTML templates instead of generic JSON rendering.

Key Changes

  • New package detail route: Added /-/packages/<package_name> endpoint that displays detailed metadata and README for individual packages
  • Improved packages list: Changed the packages listing from displaying raw JSON to a user-friendly HTML page with clickable links to package details
  • Custom templates: Created two new HTML templates (packages_list.html and package_detail.html) that extend the base Datasette template
  • Template directory registration: Added extra_template_dirs() hook implementation to register the templates directory
  • Data structure refactor: Changed internal package representation from dict to list of dicts to better support template rendering
  • Package metadata handling: Implemented proper extraction and display of package metadata including support for multi-value fields
  • README support: Added extraction and display of package README content from metadata
  • Error handling: Added 404 response for non-existent packages
  • Setup configuration: Updated setup.py to include template files in package distribution

Notable Implementation Details

  • Package metadata is extracted using dist.metadata.get_all() to properly handle fields that can have multiple values
  • The JSON endpoint maintains backward compatibility by converting the list back to a dict format
  • README content is extracted via dist.metadata.get_payload() and only displayed if non-empty
  • Tests have been updated to verify the new HTML output and added comprehensive tests for the detail page functionality

https://claude.ai/code/session_01NweDU9Kg1no11mAq3azT55

- /-/packages now renders an HTML list of packages, each linking to
  its detail page and showing the version number
- /-/packages/<name> shows all available metadata for a package in a
  table, plus the README rendered as plain text with pre-wrap styling
- Returns 404 for unknown package names
- JSON endpoint at /-/packages.json remains unchanged

https://claude.ai/code/session_01NweDU9Kg1no11mAq3azT55
@simonw simonw added the enhancement New feature or request label Feb 8, 2026
@simonw simonw merged commit c8d7d6c into main Feb 8, 2026
10 checks passed
simonw added a commit that referenced this pull request Feb 8, 2026
@simonw
Copy link
Owner Author

simonw commented Feb 8, 2026

New pages look like this:

CleanShot 2026-02-08 at 10 15 23@2x CleanShot 2026-02-08 at 10 15 45@2x CleanShot 2026-02-08 at 10 15 53@2x

@simonw simonw deleted the claude/add-package-detail-pages-QEZfz branch February 8, 2026 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants