-
Notifications
You must be signed in to change notification settings - Fork 52
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
Thank you so much for this library!
It seems that the experimental API isn't working properly on Marimo. I created a minimal plugin using both the stable and experimental APIs, but the experimental version isn't rendering. Marimo is showing the error: Unsupported mimetype: application/vnd.jupyter.widget-view+json. I'm not sure if this issue is related to Marimo or Anywidget, so I'm posting it here first for feedback.
Reproduction
import marimo
__generated_with = "0.11.0"
app = marimo.App(width="medium")
@app.cell
def _():
import marimo as mo
return (mo,)
@app.cell
def _(mo):
mo.md(r"""# Classic""")
return
@app.cell
def _():
import anywidget
import traitlets
return anywidget, traitlets
@app.cell
def _(anywidget, traitlets):
class MinimalWidget(anywidget.AnyWidget):
_esm = """
function render({ model, el }) {
el.textContent = `Value: ${model.get('value')}`;
model.on('change:value', () => {
el.textContent = `Value: ${model.get('value')}`;
});
}
export default { render };
"""
value = traitlets.Int(0).tag(sync=True)
MinimalWidget(value=3)
return (MinimalWidget,)
@app.cell
def _(mo):
mo.md(r"""# Experimental""")
return
@app.cell
def _():
import pydantic
import psygnal
from anywidget.experimental import widget
return psygnal, pydantic, widget
@app.cell
def _(psygnal, pydantic, widget):
@widget(
esm="""
function render({ model, el }) {
el.textContent = `Value: ${model.get('value')}`;
model.on('change:value', () => {
el.textContent = `Value: ${model.get('value')}`;
});
}
export default { render };
"""
)
@psygnal.evented
class MinimalWidgetExperimental(pydantic.BaseModel):
value: int = 0
MinimalWidgetExperimental(value=3)
return (MinimalWidgetExperimental,)
if __name__ == "__main__":
app.run()You can run previous code with marimo edit file.py.
Logs
Unsupported mimetype: application/vnd.jupyter.widget-view+json
No logs in terminal.System Info
Dependencies:
$ uv pip freeze | grep -E "anywidget|jupyter|notebook"
anywidget==0.9.13
jupyterlab-widgets==3.0.13
System and browser:
System:
OS: macOS 14.7.3
CPU: (16) arm64 Apple M3 Max
Memory: 15.65 GB / 64.00 GB
Shell: 5.9 - /bin/zsh
Browsers:
Chrome: 133.0.6943.54Severity
annoyance
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working