Skip to content

fix: simulators call af.ex.util instead of a local util module (PENDING RELEASE) - #130

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/simulator-util-to-af-ex
Aug 3, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
feature/simulator-util-to-af-ex

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Workspace half of PyAutoLabs/PyAutoFit#1444. PENDING RELEASE — needs the af.ex.util helpers from PyAutoLabs/PyAutoFit#1445 to ship first.

The bug

notebooks/simulators/simulators.ipynb and simulators_sample.ipynb failed workspace smoke with ModuleNotFoundError: No module named 'util' (PyAutoHeart run 30790463134).

scripts/simulators/util.py could only ever be imported by the .py scripts: running one puts scripts/simulators/ on sys.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 util fails 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.py is deleted, along with the util.ipynb it 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.py under a fixed seed on the library PR).

Verification

  • Both simulator notebooks execute clean via the same runner smoke uses.
  • Both .py siblings pass.
  • run_smoke.py: 10/10 passed.
  • check_navigator.py --banners=fail: OK.
  • Notebooks regenerated with generate.py autofit (32 scripts); the diff touches only the simulator files plus llms-full.txt / workspace_index.json.

🤖 Generated with Claude Code

…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>
@Jammy2211 Jammy2211 added the pending-release PR queued for the next release build label Aug 3, 2026
@Jammy2211
Jammy2211 merged commit 138b51a into main Aug 3, 2026
9 of 11 checks passed
@Jammy2211
Jammy2211 deleted the feature/simulator-util-to-af-ex branch August 3, 2026 21:40
@Jammy2211 Jammy2211 removed the pending-release PR queued for the next release build label Oct 7, 2026
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.

1 participant