Skip to content

tutorial figures (notebook + docs) + PyPI README images + release 0.2.0 - #4

Merged
katosh merged 2 commits into
mainfrom
dominik/tutorial-figures-release-fixes
Jul 21, 2026
Merged

tutorial figures (notebook + docs) + PyPI README images + release 0.2.0#4
katosh merged 2 commits into
mainfrom
dominik/tutorial-figures-release-fixes

Conversation

@settylab-dotto-bot

@settylab-dotto-bot settylab-dotto-bot Bot commented Jul 21, 2026

Copy link
Copy Markdown

What & why

The tutorial should actually contain its outputs and figures; the red v0.1.0 PyPI deployment and the broken images on the PyPI project page should be fixed; and — since blend (#1), the reuse cache (#2) and smooth-all-once (#3) landed after v0.1.0 — the package should be released as 0.2.0, correctly this time.

A. Tutorial ships executed, with figures (notebook and docs)

Diagnosis. The #3 smooth-all-once merge (9d6ac8c) rebuilt tutorial.ipynb from build_tutorial.py but committed it unexecuted — every output stripped (0 figures; 682501e had 5). The docs ship the notebook pre-executed (nb_execution_mode = "off"), so the live page rendered zero figures and outputs (0 <img>, 0 cell-output containers). The mystnb.unknown_mime_type suppression was a red herring — image/png is standard and renders fine; the sole gap was the missing committed outputs.

Fix. Re-executed on the full 36k-cell section (canonical notebooks/run_tutorial.sh: build → nbconvert --execute → scrub). The committed notebook now carries 7 image/png figures, 0 error outputs, the level-three truncation UserWarning preserved on stderr, and 0 host-path/UUID leaks (scrub exit 0). Local docs build embeds all 7 figures (<img src="_images/…png">). tests/test_tutorial_artifact.py passes 7/7.

Two supporting bug fixes surfaced during re-execution:

  • build_tutorial.py — the 10x CloudFront CDN rejects the default Python-urllib User-Agent with HTTP 403, so the dataset download cell failed for everyone. Present a browser User-Agent.
  • tests/test_tutorial_artifact.py — the host-path leak test scanned the raw notebook JSON including base64 image data, where /fh/ appears by chance in a big enough figure — a spurious failure. Now scans only the readable surfaces the scrubber cleans (source, stream, text/plain|html|markdown, traceback), never encoded media. Same real intent, no base64 flakiness.

D. Release 0.2.0 (this PR bumps the version; the operator publishes)

blend (#1), the smoothing reuse cache (#2) and smooth-all-once all_genes=True (#3) are new user-facing features since v0.1.0 → a MINOR bump is the correct SemVer step. Bumped pyproject.toml + src/spatial_smooth/__init__.py to 0.2.0 (conf.py tracks __version__, so docs follow); updated the illustrative check_dependencies() output in installation.rst; added a CHANGELOG.md. twine check passes on the 0.2.0 sdist+wheel; full test suite green.

C. Broken images on the PyPI project page

The PyPI long-description is the README (pyproject.toml readme); PyPI resolves image src against nothing, so the two relative figure paths 404 on the project page (and the notebooks/tutorial.ipynb / LICENSE links 404 off-site). Rewrote all four to absolute URLs (raw.githubusercontent.com/.../main/…; github.com/.../blob/main/…). Rendered long-description <img> srcs are absolute and HTTP 200; twine check passes; GitHub still renders everything.

This only becomes visible on the 0.2.0 release. PyPI freezes the long-description per version, so the README image fix does not repair the existing v0.1.0 page — publishing 0.2.0 (below) is what makes the broken-images fix actually show on pypi.org.

B. Why v0.1.0's deployment was red (root cause; fixed by the release procedure, not code)

Run 29120105023 failed at pypa/gh-action-pypi-publish, verbatim:

Trusted publishing exchange failure:
* `invalid-publisher`: valid token, but no corresponding publisher (Publisher with matching claims was not found)
  sub: repo:settylab/spatial-smooth:environment:pypi
  workflow_ref: settylab/spatial-smooth/.github/workflows/release.yml@refs/tags/v0.1.0
  environment: pypi

The OIDC token is valid; PyPI simply has no Trusted Publisher registered for these claims. release.yml is correct (id-token: write, environment pypi, skip-existing: true, @release/v1) — the claims match a TP registration exactly — so no workflow code change. The fix is the one-time TP registration in the release procedure below.

The release procedure — do 0.2.0 correctly this time (operator-owned)

Ordered steps so v0.2.0 publishes green with working images. Steps (a)/(c) need a PyPI project owner and actions:write, which the bot lacks — all operator-owned:

  1. (a) Register the pypi.org Trusted Publisher — the missing piece that reddened v0.1.0. On pypi.org → project spatial-smoothPublishing → add a GitHub Actions publisher: owner settylab, repository spatial-smooth, workflow filename release.yml, environment pypi.
  2. (b) Merge this PR (tutorial figures (notebook + docs) + PyPI README images + release 0.2.0 #4) to main.
  3. (c) Tag v0.2.0 and publish the GitHub release (Releases → Draft a new release → tag v0.2.0 on main → Publish). Publishing fires release.yml; the OIDC claims now match the TP → it builds and publishes to PyPI. (workflow_dispatch also works, but the release: published trigger is the intended path.)
  4. (d) Verify: the pypi deployment is GREEN; pypi.org/project/spatial-smooth/ shows 0.2.0; and the project-page images now render — because 0.2.0's long-description carries the absolute URLs. (The v0.1.0 page stays broken; that's expected — PyPI freezes it per version.)

Do not cut/publish the release from this PR — it is operator + actions:write-gated.

Verification (in this branch)

  • notebook: 7 image/png, 0 errors, truncation warning on stderr, 0 readable leaks (scrub exit 0)
  • docs: local Sphinx/myst-nb build embeds all 7 figures; title reads spatial-smooth 0.2.0
  • version: pyproject.toml + __version__ = 0.2.0; ss.__version__ == "0.2.0"
  • pytest full suite → green; twine check dist/* → PASSED on the 0.2.0 sdist+wheel
  • long-description <img> srcs absolute + HTTP 200

Notes

  • Base main. Please review — do not merge on my behalf (public flagship repo). Nothing published.
  • The _static/*.png README assets are unchanged (they already resolve at main).

katosh added 2 commits July 21, 2026 12:48
…ages

The #3 smooth-all-once merge (9d6ac8c) rebuilt tutorial.ipynb from
build_tutorial.py but committed it *unexecuted* -- stripping all outputs.
The published docs ship the notebook pre-executed (nb_execution_mode=off),
so settylab.github.io/spatial-smooth/tutorial.html rendered zero figures
and zero cell outputs.

Re-execute the tutorial on the full 36k-cell section and commit it with
outputs: 7 figures, the truncation UserWarning preserved on stderr, no
error outputs, no host-path leaks. The docs now embed all 7 figures.

Also:
- build_tutorial.py: the 10x CloudFront CDN rejects the default
  Python-urllib User-Agent with HTTP 403, so the download cell failed for
  everyone. Present a browser User-Agent so the notebook is runnable.
- test_tutorial_artifact.py: the host-path leak test scanned the raw
  notebook JSON including base64 image data, where "/fh/" or "/home/"
  appears by chance in a large enough figure -- a spurious failure on an
  honest notebook. Scan only the readable surfaces the scrubber cleans
  (source, stream, text/plain|html|markdown, traceback), not media.
- README.md: the long-description feeds the PyPI project page, which
  resolves image src against nothing, so the two relative figure paths
  404'd. Point them (and the Tutorial/LICENSE links) at absolute URLs
  (raw.githubusercontent.com / github.com, ref main) so PyPI renders them.
Since v0.1.0 the package gained three user-facing features -- `blend`
composition mode (#1), the smoothing reuse cache (#2), and smooth-all-once
`all_genes=True` (#3) -- so a MINOR bump to 0.2.0 is the correct SemVer step.

- pyproject.toml + src/spatial_smooth/__init__.py: version 0.1.0 -> 0.2.0
- docs/source/installation.rst: the illustrative check_dependencies() output
  shows v0.2.0 (it prints v{__version__})
- CHANGELOG.md: new; 0.2.0 (the three features + the tutorial-now-executed and
  PyPI-image fixes) and a 0.1.0 baseline entry

conf.py already tracks __version__, so the docs title/version follow
automatically. twine check passes on the 0.2.0 sdist+wheel; the full test
suite is green.
@settylab-dotto-bot settylab-dotto-bot Bot changed the title tutorial: executed notebook with figures (notebook + docs) + PyPI README images tutorial figures (notebook + docs) + PyPI README images + release 0.2.0 Jul 21, 2026
@katosh
katosh merged commit d034add into main Jul 21, 2026
5 checks passed
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