Reproducibility enforcement for Jupyter notebooks: a JupyterLab extension that enforces rerun consistency by tracking variable- and column-level dependencies between cells.
Project description
Emery Berger, Cormac Flanagan, Stephen Freund, Eunice Jun
Reproducibility enforcement for Jupyter notebooks.
FlowBook is a JupyterLab extension that enforces rerun consistency: re-executing each cell from the current state would produce a result consistent with a top-to-bottom execution of the notebook, regardless of which cells have been run, modified, and rerun. Cells whose inputs may have changed are marked stale, and operations that would break rerun consistency (e.g., a later cell overwriting a value read by an earlier one) disallowed.
When every cell is clean — executed and rerun consistent — the notebook is guaranteed reproducible: running it top-to-bottom from an empty store yields exactly the outputs currently recorded.
Quick Start
Install FlowBook using pip:
python3 -m pip install flowbook-python
Then launch jupyter lab
jupyter lab .
Once JupyterLab opens, create or open a notebook and select the FlowBook kernel from the kernel picker.
To walk through FlowBook's features interactively, download the Getting Started demo notebook, open it in JupyterLab. Be sure to use the FlowBook Kernel.
For a longer, self-contained tutorial, download our FlowBook tutorial
Troubleshoot
If FlowBook does not appear to be working, work through these steps:
1. Confirm the server extension is enabled.
jupyter server extension list
Look for flowbook marked as enabled. If it is missing or disabled,
enable it:
jupyter server extension enable flowbook
2. Confirm the frontend extension is installed.
jupyter labextension list
Look for flowbook in the list of enabled extensions. If it is not
there, reinstall the package:
python3 -m pip install --force-reinstall flowbook-python
3. Confirm the FlowBook kernel is registered.
jupyter kernelspec list
You should see flowbook_kernel in the output. If it is missing,
reinstall the package (step 2) — the kernelspec is registered at
install time.
4. Pick the FlowBook kernel in your notebook.
FlowBook only tracks notebooks running under the FlowBook Kernel. Use JupyterLab's kernel picker (top-right of the notebook) to switch away from the default Python kernel if you are not seeing staleness/violation markers.
5. Hard-refresh the browser.
After installing or upgrading, JupyterLab may cache older frontend
assets. Do a hard refresh (Cmd+Shift+R on macOS, Ctrl+Shift+F5 on
Linux/Windows) and reopen the notebook.
6. Check the browser console and the JupyterLab server log.
Open the browser's developer tools (Cmd+Option+I / Ctrl+Shift+I)
and look for errors in the Console tab. Also look at the terminal
where you launched jupyter lab for server-side errors. These often
point directly at the underlying problem (missing dependency, version
mismatch, etc.).
7. Still stuck?
Please file an issue at github.com/stephenfreund/FlowBook/issues with the outputs of the commands above, your OS and Python version, and a minimal notebook that reproduces the problem.
Uninstall
To remove the extension, execute:
pip uninstall flowbook-python
Source Installation
Clone this repository and then install it as an editable package
python3 -m pip install -e .
jupyter lab examples/
Once JupyterLab opens, create or open a notebook and select the
FlowBook kernel from the kernel picker. Start with
GettingStarted.ipynb, then explore the demos/ and litmus/
directories.
Note: You will need NodeJS to build the extension package.
The jlpm command is JupyterLab's pinned version of
yarn that is installed with JupyterLab. You may use
yarn or npm in lieu of jlpm below.
# Clone the repo to your local environment
# Change directory to the flowbook directory
# Install package in development mode
pip install -e "."
# Link your development version of the extension with JupyterLab
jupyter labextension develop . --overwrite
# Server extension must be manually installed in develop mode
jupyter server extension enable flowbook
# Rebuild extension Typescript source after making changes
jlpm build
You can watch the source directory and run JupyterLab at the same time in different terminals to watch for changes in the extension's source and automatically rebuild the extension.
# Watch the source directory in one terminal, automatically rebuilding when needed
jlpm watch
# Run JupyterLab in another terminal
jupyter lab
With the watch command running, every saved change will immediately be built locally and available in your running JupyterLab. Refresh JupyterLab to load the change in your browser (you may need to wait several seconds for the extension to be rebuilt).
By default, the jlpm build command generates the source maps for this extension to make it easier to debug using the browser dev tools. To also generate source maps for the JupyterLab core extensions, you can run the following command:
jupyter lab build --minimize=False
Running tests
Run the full Python test suite with pytest:
pytest flowbook/
To run the tests for a specific subpackage, point pytest at its tests/ directory, e.g.:
pytest flowbook/kernel/tests/
pytest flowbook/mcp/tests/
Development uninstall
# Server extension must be manually disabled in develop mode
jupyter server extension disable flowbook
pip uninstall flowbook-python
In development mode, you will also need to remove the symlink created by jupyter labextension develop
command. To find its location, you can run jupyter labextension list to figure out where the labextensions
folder is located. Then you can remove the symlink named flowbook within that folder.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file flowbook_python-0.1.0.tar.gz.
File metadata
- Download URL: flowbook_python-0.1.0.tar.gz
- Upload date:
- Size: 1.6 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ba7e12247d22b1b618435c26a0d7f35d0a4a6da8c949ac7a8e28c671d4f02938
|
|
| MD5 |
0403164a88e8c1aa7219f2b0ca8072c4
|
|
| BLAKE2b-256 |
1d61730dfa1e820196de4bfb4f15047a9a9f9f46ca153b2b9d6aca1bffa8aba4
|
File details
Details for the file flowbook_python-0.1.0-py3-none-any.whl.
File metadata
- Download URL: flowbook_python-0.1.0-py3-none-any.whl
- Upload date:
- Size: 1.3 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b8448c75683659566da3db8cfe3a469beadbc3c05629b1f6ca786272f075943a
|
|
| MD5 |
eb548d9cae4509885fb2ea21b8841c47
|
|
| BLAKE2b-256 |
1636acf73146aefe64827f6f7d651108f0cc4071a4e7864c971925c92951f504
|