Share a Papermill run
Papermill solved the boring half of notebooks: parameterize one, execute
it headlessly, get an output notebook per parameter set. What it does not
solve is that the output is another .ipynb — a file format whose
audience is people with a Jupyter install and time.
The run that matters is the one someone else reads.
Publish it
papermill weekly.ipynb "out-$REGION.ipynb" \
-p region "$REGION" -p as_of "$(date +%F)" || true
jupyter nbconvert --to html --embed-images --no-input "out-$REGION.ipynb"
curl -fsS -X PATCH \
"https://commareports.com/api/v1/reports/$COMMA_REPORT_ID" \
-H "Authorization: Bearer $COMMA_API_TOKEN" \
-H "Content-Type: application/json" \
-d "$(jq -n --rawfile html "out-$REGION.html" \
--arg title "Weekly — $REGION — $(date +%F)" \
'{title: $title, html: $html}')"
|| true on the papermill line is deliberate. Papermill exits non-zero
when a cell raises and still writes the traceback into the output
notebook, and that is precisely the run you want at a URL rather than
buried in a CI log.
PATCH on a saved report id per region is the shape that pays off: one
stable URL per parameter set, a revision per run, and a diff between any
two runs. A fresh POST every execution gives you a graveyard of
one-off links instead.
Use a scoped token with reports:write only.