Skip to content

Investigate more immersive integration of interactive API examples, inspired by sphinx-thebe #242

@agriyakhetarpal

Description

@agriyakhetarpal

Problem

The TryExamples directive currently reveals an iframe from a "Try it" button to showcase notebooks for a Pyodide kernel, which then displays the Notebook interface containing the example formatted in a cell with surrounding Markdown. While it is completely functional—of course—it is not "immersive" and does not fully integrate with the rest of the surrounding elements on the docs page.

Proposed Solution

Enable connecting to a Xeus/Pyodide kernel more seamlessly, in a way that is less intrusive on the page, by reworking the UI similar to this example from the sphinx-thebe documentation: https://sphinx-thebe.readthedocs.io/en/latest/use.html#an-example.

It can be used as a "MyST-NB" adapter of sorts as well, so that one does not need to open a new tab to run a notebook embedded as HTML separately – they can just connect to a kernel (which, by the way, is a single one for all cells on the page, see #2), and magically spring up the notebook cells into interactivity without leaving the page.

This would require a significant amount of work, around:

  • enabling just one kernel per page (if notebooks are to be supported, otherwise no)
  • modifying the JupyterLite UI upstream or disabling as many visual elements as possible, so that just a minimal code cell remains (and is editable)
  • being able to "communicate" between WASM kernels and the output in the same way as Binder does

Additional context

xref: jupyterlite/jupyterlite#148 and #63

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions