/p5-notebook

A minimal Jupyter Notebook UI for p5.js kernels running in the browser

Primary LanguageTypeScriptBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

p5-icon p5-notebook p5-icon

Github Actions Status

A minimal Jupyter Notebook UI for p5.js kernels.

Try it in your browser!

screenshot

Status

This is still an experiment 🧪.

Feel free to open an issue if you have any feedback, and PRs are also welcome! Thanks!

Dev install

Make sure Node.js is installed.

yarn
yarn run build
npx http-server

Open http://localhost:8080 in your browser.

There is also a watch command to automatically rebuild the application when there are new changes:

yarn run watch

How it works

This notebook interface is built using components from the JupyterLab computational environment.

JupyterLab is the next-gen UI for Project Jupyter, and is itself built as a set of extensions. These extensions are modular and can be reused in alternative frontends such as this notebook interface.

Jupyter front-ends usually rely on a server known as the Jupyter Server (also called the Notebook Server). This server is written in Python and handles request coming from the client, such as starting a new kernel or retrieving the content of a Jupyter notebook. The kernels usually run on the host machine, but it is also possible to have kernels running on a remote machine.

Because the p5 notebook runs entirely in the browser, it relies on a very minimal Jupyter Server that also runs in the browser and exposes (parts of) the notebook server REST API. This makes it easier to reuse components from core JupyterLab and swap the backend to an alternative one running in the browser.

p5.js kernels also run in the browser in their own IFrame. The IFrame provides the execution engine for the kernel and this is where its state is kept.

Related projects