Python notebooks can now have Run in browser and Download and run buttons. JupyterLite supplies the editor, and Pyodide runs Python in the reader’s browser. The buttons and the loading page use the fonts and colours of your site’s theme.
Install smalldocs[notebooks] and set browser-notebooks: true to turn on the feature.
The build reads the imports and checks each package against the disallow list of Pyodide.
It writes the dependencies as metadata into a copy of the notebook.
The source notebook stays unchanged, and the build runs no notebook code.
The documentation includes two examples:
- A plot in the browser uses NumPy and Matplotlib to draw sine and cosine curves.
- Read data in the browser reads a bundled CSV file with Pandas and draws a Seaborn plot.
The browser notebook guide covers setup, lint, data files and downloads. Sites that leave the feature off keep their existing output.