Skip to content

Add the missing setup_notebook() line to overview_3_statistical_methods - #138

Merged
Jammy2211 merged 1 commit into
mainfrom
claude/howto-setup-notebook-audit-dm2j9e
Aug 18, 2026
Merged

Add the missing setup_notebook() line to overview_3_statistical_methods#138
Jammy2211 merged 1 commit into
mainfrom
claude/howto-setup-notebook-audit-dm2j9e

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

What

Adds the standard boilerplate line

# from autofit import setup_notebook; setup_notebook()

to the one script in this repo that never had it, and updates its generated notebook to match.

Script Notebook
scripts/overview/overview_3_statistical_methods.py notebooks/overview/overview_3_statistical_methods.ipynb

Why

setup_notebook() chdir's to the workspace root and enables inline plotting. Without it, a script that loads data by a relative path fails when executed by nbconvert, which runs with CWD set to the notebook's own directory — it works interactively only if the user happens to launch jupyter from the repo root.

The other 31 example scripts in this repo carry the line; this one was missed. It is prose-only (a single module docstring, no code), so this is a consistency fix rather than a live breakage — the notebook gains a code cell where it previously had only the Colab setup cell. Say the word if you'd rather it stayed pure markdown.

Placement

Immediately after the module docstring, matching the sibling convention exactly. The .py keeps the line commented; the notebook generator strips the # when it emits the code cell, which is what the notebook side of this diff shows.

Notebooks

Patched by hand rather than regenerated — PyAutoHands isn't available in the session that produced this. The edit reproduces the generator's output shape exactly (verified against already-correct sibling pairs in this repo, and json.dumps(nb, indent=1) round-trips the file byte-identically), so a real generate.py run should be a no-op. Worth confirming before merge if you want belt and braces.

No pending-release gate applies: setup_notebook is long-shipped in released autofit and is already called by every other example script here.

Scope

One leg of a full audit of the setup_notebook line across the three HowTo repos and all five user-facing workspaces — 39 scripts missing it in total (HowToFit 3, HowToGalaxy 2, HowToLens 6, autofit_workspace 1, autogalaxy_workspace 5, autolens_workspace 22; autocti_workspace was already clean). autoreduce_workspace and every *_workspace_test / *_workspace_developer repo are deliberately excluded: none of them generates notebooks, so the convention doesn't apply there yet.

Tracked in PyAutoMind as howto-setup-notebook-audit.


Generated by Claude Code

Sweep of the same boilerplate gap audited across the HowTo repos. Every example
script opens with

    # from autofit import setup_notebook; setup_notebook()

after the module docstring (after the `jax_wrapper` import where a script has
one); the line chdir's to the workspace root and enables inline plotting when
the generated notebook is run. Without it a notebook that loads data by a
relative path fails under nbconvert, which runs with CWD set to the notebook's
own directory.

The scripts here had never been given the line. It is added in the sibling
convention's exact position and the generated notebooks are updated to match,
uncommented, the way PyAutoHands emits them.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0126SmBwHMzP4okcjhjPoLFZ
@Jammy2211
Jammy2211 merged commit fa55c43 into main Aug 18, 2026
6 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.

2 participants