repomatic.release.binaries_page module¶
Generate the binaries catalog: a CSV data file and its docs/binaries.md page.
The catalog inventories every compiled binary the repository ever released, one CSV row per binary: version (linking to the GitHub release), platform target (linking to the direct download), release date, and the VirusTotal detection snapshot (linking to the live analysis). It gives alpha and beta testers a single place to grab binaries from, and the maintainer an overview of how antivirus engines treat each release.
The data lives in docs/assets/binaries.csv, regenerated wholesale on every
release from the GitHub Releases API (the single source of truth for
published assets) and the JSON scan history maintained by scan-virustotal.
The Markdown page renders it through a single csv-table directive and is
otherwise static: it is created once from PAGE_TEMPLATE and only its
marker-delimited region (the detection trend chart) is rewritten afterwards,
so the intro and section prose stay hand-editable per repository.
Note
On the documentation site, the table is searchable and sortable client-side
via the sphinx-datatables extension, which activates on the
sphinx-datatable CSS class. The extension is optional: without it the
csv-table directive still renders a plain table, and on GitHub the CSV
file itself gets the built-in searchable grid viewer.
Note
Development builds are only linked, not cataloged: the rolling dev pre-release is refreshed on every push to the default branch, so any row frozen into the CSV would be stale within hours, while the workflow run artifacts behind the link always are the current builds.
- repomatic.release.binaries_page.CHART_JS_URL = 'https://cdn.jsdelivr.net/npm/chart.js@4.5.0/dist/chart.umd.min.js'¶
Pinned CDN artifact drawing the detections trend chart.
The one external artifact this module publishes into every downstream repository’s docs, so it carries a checksum beside the pin: bump the version by hand together with
CHART_JS_SRI.
- repomatic.release.binaries_page.CHART_JS_SRI = 'sha384-XcdcwHqIPULERb2yDEM4R0XaQKU3YnDsrTmjACBZyfdVVqjh6xQ4/DCMd7XLcA6Y'¶
Subresource Integrity digest of
CHART_JS_URL.The browser refuses the script if the CDN bytes stop matching. Recompute on every version bump as the sha384 of the exact artifact, verified against the same file inside the npm registry tarball before trusting the CDN copy:
hashlib.sha384(artifact_bytes)then base64.
- repomatic.release.binaries_page.CSV_HEADERS = ('Version', 'Platform', 'Released', 'VirusTotal')¶
Column headers of the binaries CSV.
Deliberately compact: the version cell carries the link to the GitHub release, the platform cell the direct binary download, and the VirusTotal cell the analysis link, so no column holds a bare URL, filename, or 64-character checksum.
- repomatic.release.binaries_page.FLAGGED_DANGER_PCT = 10¶
Flagged-verdict share (percent) at which the catalog shield turns red.
Below it, a flagged binary is the routine Nuitka false-positive tail worth a warning tint; from one engine in ten upward, the release deserves a false-positive submission round (see the
/av-false-positiveskill).
- repomatic.release.binaries_page.LEGACY_PAGE_END_MARKER = '<!-- binaries-end -->'¶
Oldest closing marker, migrated to
PAGE_END_MARKERon first touch.
- repomatic.release.binaries_page.LEGACY_PAGE_START_MARKERS = ('<!-- binaries-start -->', '<!-- binaries-chart-start -->')¶
Superseded opening markers, migrated to
PAGE_START_MARKERon first touch.Two generations precede the current bare open: the original
<!-- binaries-start -->, then the<!-- binaries-chart-start -->of the short-lived-start/-endpair. Both collapse toPAGE_START_MARKER, so a page written by any past version refreshes cleanly.
- repomatic.release.binaries_page.PAGE_REGION = 'binaries-chart'¶
Region name spliced by
click_extra.blocks.replace_region().The generated chart lives between the
<!-- binaries-chart -->and<!-- binaries-chart-end -->markers thatPAGE_START_MARKERandPAGE_END_MARKERspell out, following click-extra’s<!-- name --> / <!-- name-end -->marker grammar withname= this value.
- repomatic.release.binaries_page.PAGE_END_MARKER = '<!-- binaries-chart-end -->'¶
Closing marker of the generated chart region in the binaries page.
- repomatic.release.binaries_page.PAGE_START_MARKER = '<!-- binaries-chart -->'¶
Opening marker of the generated chart region in the binaries page.
- repomatic.release.binaries_page.PAGE_TEMPLATE¶
Initial page content, used when the page does not exist yet.
The
{repo_url}placeholder is substituted withstr.replace(notstr.format, which would choke on the csv-table directive’s braces). Everything outside the marker pair is written once and never touched again: repositories can reword the prose without fighting the generator.
- repomatic.release.binaries_page.render_chart_section(records)[source]¶
Render the detection trend across releases as a Chart.js timeline.
Plots the share of antivirus engine verdicts flagging each release’s binaries (all platforms aggregated), using the at-release snapshot of every file, on a true time axis: spacing reflects the actual gaps between releases. Points reuse the catalog shields’ color language, read at view time from sphinx-design’s CSS variables so they match the theme exactly (with hardcoded fallbacks). The data is embedded in the page rather than fetched, so the chart also works on
file://previews; only the Chart.js bundle comes from its CDN, mirroring how the table’s DataTables assets load.- Return type:
- Returns:
A
## VirusTotal detectionssection with arawHTML fence, or an empty string when fewer than two releases have records (a one-point trend is not a trend).
- repomatic.release.binaries_page.render_binaries_csv(repo_slug, releases, records)[source]¶
Render the catalog data as CSV, one row per released binary.
Rows cover every published release carrying compiled binaries, ordered by descending version then filename. Cells hold Markdown links (parsed by MyST inside the
csv-tabledirective): the version to the GitHub release, the platform to the binary download, and the VirusTotal cell to the file’s analysis. The VirusTotal cell renders the at-release snapshot as a green check when no engine flags the binary, and as the flagged-verdict share (tinted byFLAGGED_DANGER_PCT) otherwise.Caution
Only a binary backed by a scan record gets a VirusTotal cell; every other row leaves it empty. A file page exists on VirusTotal solely because the file was submitted, while the catalog spans every release a repository ever published, including those predating
scan-virustotaland those whose upload failed. Deriving the URL from the GitHub asset digest alone therefore sent readers to a blank page for each binary nobody ever uploaded, which was most of the catalog on older projects.Caution
The version and platform cells decorate their links with sphinx-design’s
octiconrole, so the rendering repository needssphinx-designin its documentation build (already true across this ecosystem’s docs stacks).- Parameters:
repo_slug (
str) – Repository inowner/repoform.releases (
Sequence[ReleaseWithAssets]) – Releases fromrepomatic.github.releases.get_releases_with_assets().records (
Sequence[ScanRecord]) – Detection snapshots from the scan history file.
- Return type:
- Returns:
The full CSV content, header row included.
- repomatic.release.binaries_page.update_binaries_csv(csv_path, content)[source]¶
Write the catalog CSV, creating parent directories as needed.
- Parameters:
csv_path (
Path) – Path to the CSV file.content (
str) – Rendered CSV fromrender_binaries_csv().
- Return type:
- Returns:
Truewhen the file was created or its content changed.
- repomatic.release.binaries_page.update_binaries_page(page_path, chart_section, repo_slug)[source]¶
Create the binaries page if missing and refresh its chart region.
A missing page is created (with parent directories) from
PAGE_TEMPLATE. On an existing page only the region betweenPAGE_START_MARKERandPAGE_END_MARKERis replaced byclick_extra.blocks.replace_region(), leaving all surrounding prose untouched. Pages carrying anyLEGACY_PAGE_START_MARKERSopen or theLEGACY_PAGE_END_MARKERclose are migrated to the current markers in the same pass.- Parameters:
page_path (
Path) – Path to the Markdown page.chart_section (
str) – Rendered chart fromrender_chart_section(), or an empty string to leave the region empty.repo_slug (
str) – Repository inowner/repoform, interpolated into the template on first creation.
- Return type:
- Returns:
Truewhen the file was created or its content changed.- Raises:
ValueError – When the page exists but lacks the markers. Loud on purpose: a page not written by this generator must never be overwritten.