Skip to content

Provide live documentation support in Jupyter using Thebe #24593

@nthiery

Description

@nthiery

Thebe is a javascript library to turn static HTML pages into live documents where code cells can be edited and executed. Thebe was been introduced in #20690 as a replacement for the live documentation feature of sagenb. It covers the use case of browsing the documentation through the Jupyter notebook; in this case, Thebe connected to that notebook for computations.

However this model was not sustainable:

  • Shipping Thebe is additional burden for Sage's maintainers and packagers
  • Thebe is a fork of the Jupyter code base and thus not maintainable.
  • In practice, Thebe got out of sync and soon became incompatible with the Jupyter we shipped. So the feature was lost.

Meanwhile, Thebe has been reimplemented as ThebeLab, a thin layer on top of JupyterLab, making it much more sustainable. In addition, an online computation backend is now available thanks to http://mybinder.org and Sage's docker container.

In this ticket, we switch gear, and focus on the use case of browsing the documentation from anywhere (within Jupyter, local static documentation, Sage's online documentation), with the assumption of an internet connection.

Implementation:

  • When compiling the documentation, Sphinx adds a small header to the produced static html pages.
  • If a page contains a sage code cell, an Activate button is added.
  • Upon activation, and only then, the thebelab javascript library together with its dependencies in the jupyterlab javascript library are fetched from the web.
  • Thebe is configured to use Sage's docker container on MyBinder as computation backend.

Bonus:

The feature has been tested for a couple months on
More SageMath Tutorials. It's also configured by default for any Sage package that uses sage-package; see e.g. this page.

We believe that dropping the use case of offline browsing while having a notebook running (which is broken anyway) is largely compensated by the much easier maintenance and the availability of the feature for all deployments of Sage's documentation.

thebelab tarball: https://registry.npmjs.org/thebelab/-/thebelab-0.2.1.tgz

CC: @jdemeyer @sagetrac-tmonteil @embray @videlec @jhpalmieri @kwankyu @antonio-rojas

Component: documentation

Keywords: notebook

Branch/Commit: u/jdemeyer/upgrade_from_thebe_to_thebelab_for_live_documentation_support @ c991041

Reviewer: Nicolas M. Thiéry

Issue created by migration from https://trac.sagemath.org/ticket/24593

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions