Add the missing setup_notebook() line to overview_3_statistical_methods - #138
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
scripts/overview/overview_3_statistical_methods.pynotebooks/overview/overview_3_statistical_methods.ipynbWhy
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
.pykeeps 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 realgenerate.pyrun should be a no-op. Worth confirming before merge if you want belt and braces.No
pending-releasegate applies:setup_notebookis long-shipped in releasedautofitand is already called by every other example script here.Scope
One leg of a full audit of the
setup_notebookline 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_workspaceand every*_workspace_test/*_workspace_developerrepo 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