Skip to content

Feature request: add notebook anywidget support #245

@Billyzhang1229

Description

@Billyzhang1229

Hi all, I’d like to propose adding anywidget support for notebook workflows (Jupyter/marimo), with an API like:

w = d3arg.to_anywidget()
w

Why

  • Better notebook-native embedding than side-effect display(...) flows
  • Works well in modern notebook apps (including marimo)
  • Cleaner composition with other widget-based UIs

Proposal

  • Add D3ARG.to_anywidget(...) that returns an anywidget.AnyWidget
  • Reuse existing visualizer.js + visualizer.css rendering logic
  • Use iframe srcdoc for isolation and compatibility

Notes from prototyping

  • iframe/body sizing and overflow need small CSS guards to avoid duplicate-looking scrollbars
  • anywidget implies Python >=3.8 compatibility (metadata should match)

Questions for maintainers

  1. Does this API shape (to_anywidget) look acceptable for upstream?
  2. Should anywidget be a hard dependency, or optional extra (e.g. [widgets])?
  3. Any preference on implementation style:
    • wrapper around existing render pipeline (minimal change), or
    • deeper renderer refactor for shared frontend entrypoints?

I have created a PR for this feature. Let me know what you think. #244

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions