Skip to main content

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 any 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.

For technical details and a complete evaluation, see our arXiv paper: FlowBook: Enforcing Reproducibility in Computational Notebooks .

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flowbook_python-0.1.2.tar.gz (1.7 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flowbook_python-0.1.2-py3-none-any.whl (1.3 MB view details)

Uploaded Python 3

File details

Details for the file flowbook_python-0.1.2.tar.gz.

File metadata

  • Download URL: flowbook_python-0.1.2.tar.gz
  • Upload date:
  • Size: 1.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for flowbook_python-0.1.2.tar.gz
Algorithm Hash digest
SHA256 16cfc9c9c5077109cd4a6d4799229bfda47ad168524398660e36016117f22c1e
MD5 91163ed5f17dd353ccb31713d11ae501
BLAKE2b-256 ac1267eece7b3b916a4be8bcf6541e731e6e063ec39577df284a7488a5d81442

See more details on using hashes here.

File details

Details for the file flowbook_python-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for flowbook_python-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 fd324484f24019a8087da0fa8c9096581007ccac4dc799edf978af3f73149c57
MD5 760ca6b05f45b2ddded97f69df6ba387
BLAKE2b-256 074c21b452f01cd0da66c0cc0cfdf8e16dfe4b95492ca32b8e32d19c72b16939

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page