Skip to content

Write figures beside the article, not beside the author - #28

Merged
lmoresi merged 1 commit into
mainfrom
fix/absolute-paths-in-examples
Aug 20, 2026
Merged

Write figures beside the article, not beside the author#28
lmoresi merged 1 commit into
mainfrom
fix/absolute-paths-in-examples

Conversation

@lmoresi

@lmoresi lmoresi commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

articles/moving-the-mesh-without-remaking-it/examples/redistribute_figure.py
wrote its figure to

out = "/Users/<name>/+Simulations/mmpde-note-figure/redistribute-before-after.png"

That breaks on any other machine, and it puts a home directory — a username —
into a public, archived repository. It now resolves the article's own figures/
directory from __file__.

A test walks every articles/*/examples/*.py and scripts/*.py for
/Users/<name> and /home/<name>, so the next one is caught before it is
published rather than by a reader. /home/jovyan is allowed — it is the Docker
image's own path and is quoted as such in prose.

131 tests pass.

Underworld development team with AI support from Claude Code

`redistribute_figure.py` wrote its output to an absolute path under a home
directory. That breaks on every other machine, and it publishes a username into a
repository that is public and archived. It now writes to the article's own
`figures/` directory, resolved from `__file__`.

A test walks every shipped example and script for `/Users/<name>` and
`/home/<name>` so the next one is caught before it is published. `/home/jovyan`
is allowed: it is the Docker image's own path, quoted as such in prose.

Underworld development team with AI support from Claude Code
@github-actions

Copy link
Copy Markdown
Contributor

Preview

Or the whole site.

Built from 1f27cd9. Shows notes at draft and review, which the published site withholds. Not indexed, no comments, and not the citable version. Confirmed serving this commit before this was posted.

@lmoresi
lmoresi merged commit 1528742 into main Aug 20, 2026
4 checks passed
lmoresi added a commit that referenced this pull request Aug 20, 2026
#28 landed the absolute-path guard on the same file this branch appends its
reader-page tests to. Both are new tests and neither replaces the other, so the
resolution keeps both. 136 pass.

Underworld development team with AI support from Claude Code
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