-
Notifications
You must be signed in to change notification settings - Fork 180
Open
Description
Expected Behavior
Solara runs as server app as reliably as it does in a notebook when imported code uses IPython.core.magic.register_cell_magic
Current Behavior
Code that calls from IPython.core.magic.register_cell_magic in a context that uses an instance of solara.server.patch.FakeIPython will result in the AttributeError in the title of this issue:
AttributeError: 'FakeIPython' object has no attribute 'register_magic_function'
Steps to Reproduce the Problem
- Write solara code that imports code that uses
register_cell_magic, for examplemermaid-py:from mermaid import Mermaidas seen below - Observe that it works in a Jupyter notebook
- Observe that using
solara runresults inAttributeError
App with the following code fails with solara run but works in notebook:
import solara
from mermaid import MermaidWorkaround
import solara.server.patch
# Patch the FakeIPython class to add register_magic_function
def noop_register_magic_function(self, *args, **kwargs):
pass
# I looked at mermaid-py's use of register_magic_function and I don't need it
solara.server.patch.FakeIPython.register_magic_function = noop_register_magic_function
import solara
from mermaid import MermaidSpecifications
-
Solara Version: 1.51.1
-
Platform: Docker on Windows
python:3.13.7-slim-trixieuname -a:Linux f6f919b954ee 6.6.87.2-microsoft-standard-WSL2 #1 SMP PREEMPT_DYNAMIC Thu Jun 5 18:30:46 UTC 2025 x86_64 GNU/Linux
-
Affected Python Versions: 3.13.7
Metadata
Metadata
Assignees
Labels
No labels