Debian Codegraph @

docs/examples/execution.rst

raw
1 Execution Libraries
2 ===================
3
4 Many execution libraries can be used to display the output of IPyhton cells. We used ``MySTnb`` to parse and display the outputs presented in :doc:`./pydata`. In this section we'll show alternatives that runs code for you using a Jupyter like kernel.
5
6 Jupyterlite
7 -----------
8
9 .. warning::
10 The jupyterLite lib is not yet providing a handle to switch from light to dark theme. If you consider using it in your documentation you should also enforce the light theme to your users.
11 Follow https://github.com/jupyterlite/jupyterlite-sphinx/issues/69 for more information.
12
13 ``jupyterlite-sphinx`` brings the power of `JupyterLite <https://jupyterlite.readthedocs.io/en/latest/>`__ to your Sphinx documentation. It makes a full JupyterLite deployment in your docs and provide some utilities for using that deployment easily.
14
15 This section demonstrate how it displays in a **pydata-sphinx-theme** context:
16
17 .. replite::
18 :kernel: python
19 :height: 600px
20 :prompt: Try Replite!
21
22 print("it's a test")
23
24 jupyter-sphinx
25 --------------
26
27 Another common library is ``jupyter-sphinx``.
28 This section demonstrates a subset of functionality to make sure it behaves as expected.
29
30 .. jupyter-execute::
31
32 import matplotlib.pyplot as plt
33 import numpy as np
34
35 rng = np.random.default_rng()
36 data = rng.standard_normal((3, 100))
37 fig, ax = plt.subplots()
38 ax.scatter(data[0], data[1], c=data[2], s=3)