Skip to content

Latest commit

 

History

History
93 lines (68 loc) · 3.61 KB

File metadata and controls

93 lines (68 loc) · 3.61 KB

Marimo Widget Rendering Issue

Problem

Playwright tests for Buckaroo widgets in marimo notebooks timeout waiting for widget elements to appear in the DOM. All 6 marimo tests fail with:

TimeoutError: locator.waitFor: Timeout 30000ms exceeded.
- waiting for locator('.buckaroo_anywidget').first() to be visible

Root Cause Analysis

What Works ✅

  • Python side: Widget instantiation and dataflow execution work perfectly
  • Static assets: widget.js (2.3MB) and compiled.css (8.3KB) are built and present
  • Marimo server: Starts without errors and serves HTML correctly
  • Notebook execution: All cells execute successfully without Python errors

What Doesn't Work ❌

  • Widget rendering in browser: The .buckaroo_anywidget elements never appear in the DOM
  • Marimo integration: Marimo logs "This notebook has errors, saving may lose data" warning
  • Minimal anywidget test: Even a simple inline anywidget fails to render in marimo

Investigation Results

  1. Tested Python execution directly:

    • BuckarooWidget(small_df) and BuckarooInfiniteWidget(large_df) instantiate successfully
    • Static files load properly into _esm and _css attributes
  2. Tested marimo server:

    • HTML is served correctly
    • No Python errors in execution
    • CSS includes .buckaroo_anywidget selector
  3. Tested minimal anywidget:

    • Even a simple inline anywidget with no external files fails to render
    • Marimo shows the same "notebook has errors" warning

Hypothesis

Marimo's anywidget support appears to be incomplete or broken in version 0.17.6/0.18.4. The widgets are instantiated in Python but not rendered by the marimo frontend/anywidget integration layer.

Solutions Tested

  1. Version Update to 0.20.1:

    • Upgraded from 0.17.6 to 0.20.1 via uv sync
    • Result: Tests still fail with same widget rendering timeout
    • Conclusion: Issue persists across versions, not a version-specific bug
  2. Wrapper Patterns:

    • Tried mo.output(widget, ...) wrapper pattern
    • Tried explicit widget return in cells
    • Tried widget as last expression
    • Result: All patterns fail with timeouts
    • Conclusion: Not a usage pattern issue
  3. Widget Display Patterns:

    • Multiple cell structures tested
    • All result in same widget rendering failure
    • Conclusion: Fundamental marimo/anywidget integration issue

Files Affected

  • /Users/paddy/buckaroo/buckaroo/static/widget.js - Frontend code (added)
  • /Users/paddy/buckaroo/buckaroo/static/compiled.css - Styles (added)
  • /Users/paddy/buckaroo/tests/notebooks/marimo_pw_test.py - Test notebook
  • /Users/paddy/buckaroo/packages/buckaroo-js-core/pw-tests/marimo.spec.ts - Playwright tests

Configuration

Minimum marimo version set to 0.19.7 in pyproject.toml:

  • Specified in both [project.optional-dependencies] and [dependency-groups]
  • Allows recent marimo releases (0.20.1+ installed)
  • 0.19.7 is the WASM release available on marimo.io

Recommended Actions

  1. Skip marimo tests in CI (until upstream fix):

    • Add continue-on-error: true to marimo test step in CI workflow
    • Prevents build failures due to infrastructure issue
  2. File upstream issue with marimo project:

    • Provide minimal reproduction: simple anywidget in marimo notebook
    • Affects all anywidgets, not just Buckaroo
  3. Monitor marimo releases:

    • Check if future versions restore anywidget support
    • May require marimo team investigation/fix
  4. Alternative: Use Jupyter notebooks instead

    • Tests work fine with Jupyter/JupyterLab
    • marimo integration appears incomplete