Skip to content

bridge-v0.2.2

Choose a tag to compare

@github-actions github-actions released this 13 Apr 10:53
· 99 commits to master since this release

Fixes

Two failures that surfaced when a user runs %run script.py in the YADE IPython console after the bridge has started:

1. NameError: name '_mcp_pyrunner_tick' is not defined

YADE's PyRunner evaluates its command via py::exec(cmd, __main__.__dict__), re-resolving sys.modules['__main__'] each call. IPython's %run temporarily replaces __main__ with the script's own module, hiding the tick callback injected at bridge startup.

Fix: idempotently re-inject _mcp_pyrunner_tick into whichever module is currently __main__ on bridge start and before every hooked O.run().

2. AttributeError: 'dict' object has no attribute '_mcp_bridge_runner'

YADE's mapLabeledEntitiesToVariables runs __builtins__.<label>=Omega().labeledEngine('<label>') on every O.engines=[...] assignment. In a non-__main__ namespace, __builtins__ is the builtins dict, not the module, so attribute assignment fails.

Fix: drop the engine label entirely and identify our PyRunner by its command string instead, bypassing YADE's label auto-injection.