Skip to content

Show notes in the per-package JSON and on package pages - #46

Merged
patrickballard merged 2 commits into
mainfrom
notes-in-pages
Nov 12, 2026
Merged

patrickballard merged 2 commits into
mainfrom
notes-in-pages

Conversation

@patrickballard

@patrickballard patrickballard commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Closes #28

Made with Claude Code.

What changed

  • Per-package JSON. scripts/build_lookup.py adds a notes list to every data/packages/<name>.json (always present, [] when there are none). Each note has the format's fields: platforms, kind, text, links, versions (null when the note has none) and updated (YYYY-MM-DD). This adds a key, so the schema stays 1 and the README's API section describes it.

  • Stale notes are left out, in both places:

    • the note's versions doesn't match the scanned version;
    • every target of every platform it lists has a wheel. That means each Python, free-threaded included. ["all"] means every platform in the scan, pyodide included.
  • Package pages. scripts/build_pages.py adds a "Notes" section to p/<name>/. Each note gets a card with:

    • its text, escaped, with only paired backticks turned into <code>;
    • its kind, platforms, versions if set, and updated date;
    • its links.
  • "Add a note" link. It appears on every page with a gap, meaning any target that is source or missing. Lookup failures don't count. It opens github.com/wheelgap/tracker/new/main?filename=notes/<name>.toml&value=…, with a template pre-filled:

    • the package's gap platforms;
    • empty kind/text/links, so the checker fails until they are filled in;
    • the scan date as updated.
      If notes/<name>.toml already exists, the link opens GitHub's editor for that file instead. GitHub can't create a file that already exists, and it can't pre-fill the editor.
  • One parser. scripts/check_notes.py gains:

    • load(): the checker's own parsing and validation (_file_problems → _read_file, which now also returns the notes). A file with any problem is left out whole, with a ::warning::.
    • version_matches(): the v0 versions subset, matched as PEP 440 does, stdlib only.
    • current(): the stale filter.
    • as_json().

    The build scripts import it with from . import check_notes under the tests and import check_notes when run as scripts, so scan.yml needs no change. Their new optional notes_dir argument defaults to the repo's notes/.

  • CSP. Unchanged. No scripts and no new inline styles. The card spacing is three rules in site/style.css, scoped to .notes.

  • Docs. README.md (API and package pages) and notes/README.md now describe what is shown and when a note is hidden.

Known limits

  • Notes retire per platform, not per Python. A note has no Python field. It retires only once every Python target of every platform it lists (3.13, 3.14, 3.14t, …) has a wheel. So a note about a 3.13 gap stays shown while free-threaded 3.14t still lacks a wheel. notes/README.md says this plainly.
  • Non-plain versions. version_matches only matches plain N(.N)* releases. If the scanned version is a pre-, post- or dev release (110 of the current 5,000, e.g. 0.66b2, 1.4.1.post1), a note with versions is hidden rather than guessed at. Notes without versions are unaffected. This is documented in notes/README.md.

For the maintainer

  • When notes go live. scan.yml's push trigger doesn't include notes/**, so a merged note appears with the next nightly publish (or a manual run). notes/README.md says "from the next publish". Adding notes/** to the push paths would make notes appear on merge. I left that out as a workflow change outside this issue.

Verification

  • uvx --python 3.14 [email protected]: 148 passed. python3 scripts/check_notes.py: clean.
  • Review fixes (second commit):
    • version_matches returns False for a spec the checker rejects (e.g. <2.*) instead of reinterpreting it.
    • load() warns about a subdirectory in notes/.
    • The checker now also rejects links with control or format characters (NUL, DEL, zero-width space, bidi overrides) or a user@ part. Link text drops the scheme case-insensitively, so a link's text can't disguise its target. This tightens the checker.
    • The edit URL is quote()d.
    • There are new tests for each of these, and for: an ["all"] note retiring when every target is a wheel; unknown not counting as a gap; the escaped "for versions …" line; 2 matching >=2.0; a note on platforms the scan lacks being kept; no "Add a note" on a page with notes but no gap; and the edit link for a rejected notes file. Each one fails when I mutate the code it covers (10 mutations, each caught).
  • New tests are in tests/test_notes_on_site.py, and test_scripts.py now expects the notes key. They cover:
    • a current note is listed and shown;
    • a stale note is left out, both by version and by wheels;
    • ["all"] stays while pyodide has a gap;
    • an errored package keeps its notes;
    • HTML escaping, including <script>, & in a link and quotes in <code>;
    • unpaired backticks;
    • the prefilled new-file URL, and the edit URL when the file exists;
    • no section on a page without a gap;
    • a bad note file is skipped;
    • the repo's notes load cleanly against the real scan.
  • The tests fail without the change. With the scripts reverted, 18 fail. With only the wheel-staleness check removed, the two staleness tests fail. With escaping removed from note_text, the two escaping tests fail.
  • Version matching. All version_matches test cases, plus a 20,000-case random fuzz, agree with packaging.specifiers.SpecifierSet.contains.
  • Real build. I built build_lookup.py and build_pages.py from data/coverage.json the way the "Assemble the site" step does, then deleted the output:
    • psycopg2.json and pycrypto.json each list 1 note, mysqlclient.json lists its Linux note, and numpy.json has notes: [].
    • 940 of the 5,000 pages have a Notes section (those with a gap), and 3 show note cards.
    • No page has <script>, and every page parses with balanced tags.
    • The prefilled template parses as TOML, and check_notes.py rejects it until kind, text and links are filled in.
    • In a browser, p/psycopg2/ renders cleanly in dark mode with no console or CSP errors.

🤖 Generated with Claude Code

build_lookup.py adds a notes list to data/packages/<name>.json and
build_pages.py adds a Notes section to p/<name>/, both leaving out stale
notes (versions that don't match the scanned release, or every target of
the listed platforms has a wheel). Pages with a gap get an "Add a note"
link to GitHub's new-file page for notes/<name>.toml with a template.

Notes are read through check_notes.py (new load, version_matches,
current and as_json), so the site only shows files the checker accepts.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- version_matches() returns False for a spec the checker rejects (<2.*).
- load() warns about a subdirectory in notes/, as problems() reports it.
- The checker rejects links with control or format characters or a
  user@ part, and link text drops the scheme whatever its case, so the
  shown link can't disguise its target.
- The edit URL quotes its path like the new-file URL.
- notes/README.md states plainly that a note has no Python field and
  retires only when every Python target of its platforms has a wheel.
- Tests for each of these, for an "all" note retiring, unknown results
  not being a gap, the versions line, short-version padding, the guard
  for platforms the scan lacks, no "Add a note" without a gap, and the
  edit link for a rejected notes file.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@patrickballard
patrickballard merged commit e842ab1 into main Nov 12, 2026
1 check passed
@patrickballard
patrickballard deleted the notes-in-pages branch November 12, 2026 18:43
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.

Show notes in the per-package data and on package pages, with an "add a note" link

1 participant