nbsphinx

nbsphinx allows you to publish Jupyter notebooks as documentation pages.

Example

This whole page is written in a Jupyter Notebook (see Show Source).

[1]:
import datetime
datetime.datetime.now()
[1]:
datetime.datetime(2023, 12, 13, 9, 38, 49, 403515)
[2]:
import matplotlib.pyplot as plt
import numpy as np

Data for plotting:

[3]:
t = np.arange(0.0, 2.0, 0.01)
s = 1 + np.sin(2 * np.pi * t)
[4]:
fig, ax = plt.subplots()
ax.plot(t, s)
ax.set(
    xlabel='time (s)',
    ylabel='voltage (mV)',
    title='About as simple as it gets, folks',
)
ax.grid()
_images/nbsphinx_5_0.svg

Installation

pip install nbsphinx

Configuration

# conf.py
extensions = [
    '...',
    'nbsphinx',
]