Thebe

Thebe turns your static HTML pages into interactive ones, powered by a kernel. It is the evolution of the original Thebe project with javascript APIs provided by JupyterLab.

For example, see the following code cell:

%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
plt.ion()
fig, ax = plt.subplots()
ax.scatter(*np.random.randn(2, 100), c=np.random.randn(100))
ax.set(title="Wow, an interactive plot!")

It is static for now. You can activate Thebe by pressing the button below. This will ask mybinder.org for a Python kernel, and turn the code cell into an interactive one with outputs!

Try clicking the button. The cell will be come active!

You can press “run” in order to run the contents of the cell and display the result (be patient, it will take a few moments for Binder to start the kernel).

Getting Started

To get started, check out Get started.

References to thebelab will be removed in version 0.9.0

As part of the library migration to an executable books project (#230), thebe has been added as an alias for thebelab and all css classes beginning with thebelab- duplicated as thebe-. The thebelab global object, exposed functions and user code reliant on css classes thebelab-*, will continue to work and any DOM elements created during operation will be decorated with thebelab- classes as expected, until removed in version 0.9.0.

Examples

For more examples showing how to configure, use, and activate Thebe, see the list below. We recommend browsing the raw HTML of each one in order to see how Thebe is used.

HTML based examples

Source code for these examples can be found in thebe/docs/_static/html_examples folder

Important

All examples build a _local_ version of thebe in order to show off the latest features. If you’d like to instead load the latest _release_ of Thebe, replace the <script> elements with the following:

`html <script type="text/javascript" src="https://unpkg.com/thebe@latest"></script> `

Important

Serve the HTML examples indepenently by running yarn serve:examples in your local development environment.

External Examples

Acknowledgements

thebe was originally developed as a part of OpenDreamKit - Horizon 2020 European Research Infrastructure project (676541).