Fix uncomment_jupyter_magic to match all auto* setup_notebook import forms - #231
Merged
Merged
Conversation
uncomment_jupyter_magic only matched the autonerves import form, but every workspace and HowTo script writes the line as e.g. '# from autolens import setup_notebook; setup_notebook()' (each library re-exports it). The regex mismatch meant generated notebooks never activated their working-directory setup, which broke notebook execution from a notebook-dir cwd — surfaced by HowToLens markdown renders of dataset-loading tutorials failing to resolve their auto-simulate paths. The substitution now matches any auto* package and preserves it. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BxKfSZisjnEn91LRGkN4SU
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.
Summary
uncomment_jupyter_magiconly matched# from autonerves import setup_notebook; setup_notebook(), but every workspace and HowTo script writes the line with the library's own re-export (e.g.# from autolens import setup_notebook; setup_notebook()). The regex mismatch meant generated notebooks never activated their working-directory setup, so notebook execution from a notebook-dir cwd broke — surfaced by HowToLens markdown renders of dataset-loading tutorials failing to resolve their auto-simulate paths.Changes
autohands/build_util.py: the substitution now matches anyauto\w+package and preserves the original import (# from autolens import ...→from autolens import ...).Validation
generate.pynow emits notebooks with the setup line active, andgenerate_markdown.pyrenders all 9 curated chapter 1 scripts (previously 3 failed on dataset paths) — see Restructure the lecture series: point sources + formalism lectures, chaining into chapter 2, pixelizations as chapter 3, new Scaling Up Lensing chapter 4 HowToLens#68, which this unblocks.🤖 Generated with Claude Code
https://claude.ai/code/session_01BxKfSZisjnEn91LRGkN4SU
Generated by Claude Code