fix: simulators call af.ex.util instead of a local util module (PENDING RELEASE) - #130
Merged
Merged
Conversation
…oFit#1444) 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 notebooks/simulators/simulators.ipynb and simulators_sample.ipynb 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 - a notebook of bare function definitions nothing could import. PENDING RELEASE: needs the af.ex.util helpers from PyAutoFit#1444. Verified: both simulator notebooks execute clean, 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.The bug
notebooks/simulators/simulators.ipynbandsimulators_sample.ipynbfailed workspace smoke withModuleNotFoundError: No module named 'util'(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 fix
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 — a notebook of bare function definitions that nothing could import.No behaviour change: the helpers produce byte-identical output (verified against the old
util.pyunder a fixed seed on the library PR).Verification
.pysiblings pass.run_smoke.py: 10/10 passed.check_navigator.py --banners=fail: OK.generate.py autofit(32 scripts); the diff touches only the simulator files plusllms-full.txt/workspace_index.json.🤖 Generated with Claude Code