fix: simulators call af.ex.util, and the chain-run resolves in a notebook (PENDING RELEASE) - #42
Merged
Merged
Conversation
…e__ (PyAutoFit#1444) Two failures in the same notebook, the second masked by the first. 1. scripts/simulators/util.py could only ever be imported by the .py scripts: running one puts scripts/simulators/ on sys.path[0], but a notebook kernel has no script directory, so both simulator notebooks failed workspace smoke with `ModuleNotFoundError: No module named 'util'`. The four helpers now live in af.ex.util, so the same call works from a script, a notebook and Colab alike. util.py is deleted along with the util.ipynb it generated. 2. simulators.py chain-ran simulators_sample.py through a path derived from the script's own file path, which a notebook kernel does not define - and no .py exists in the notebooks tree in any case. That cell would have failed the instant the import above was fixed. It is now resolved relative to the repository root, which the script run, the pinned notebook kernel and Colab all share. PENDING RELEASE: needs the af.ex.util helpers from PyAutoFit#1444. Verified: both simulator notebooks execute clean (the chain-run cell included), both .py siblings pass, smoke 10/10, navigator check OK. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Workspace half of PyAutoLabs/PyAutoFit#1444. PENDING RELEASE — needs the
af.ex.utilhelpers from PyAutoLabs/PyAutoFit#1445 to ship first.Two failures in the same notebook, the second masked by the first.
1.
ModuleNotFoundError: No module named 'util'notebooks/simulators/simulators.ipynbandsimulators_sample.ipynbfailed workspace smoke (PyAutoHeart run 30790463134).scripts/simulators/util.pycould only ever be imported by the.pyscripts: running one putsscripts/simulators/onsys.path[0]. A notebook kernel has no script directory —sys.path[0]is the cwd — so the generated notebooks could never import it. Not a cwd bug:import utilfails from the notebook's own directory and from the workspace root.The four simulate helpers now live in
af.ex.util, so the same call works from a script, a notebook and Colab alike.scripts/simulators/util.pyis deleted along with theutil.ipynbit generated.2. The chain-run cell, found while fixing the first
scripts/simulators/simulators.pyends by chain-runningsimulators_sample.pyso every tutorial's simulator subprocess also produces the chapter-3 sample folders. It resolved that path from the script's own file path — which a notebook kernel does not define, and which points into the notebooks tree where no.pyexists in any case.That cell survives into
notebooks/simulators/simulators.ipynb, so it would have failed the instant the import above was fixed — it was simply never reached before. The path is now relative to the repository root, which the script run, the pinned notebook kernel and Colab all share.Verification
.pysiblings pass.run_smoke.py: 10/10 passed.check_navigator.py --banners=fail: OK.generate.py howtofit(15 scripts); the diff touches only the simulator files plusllms-full.txt/workspace_index.json.🤖 Generated with Claude Code