IPySpaghetti

Changing Notebook paradigm to solve their pitfalls?

 

Dr. Corentin Cadiou — @cphyc ­— github.com/cphyc

IPySpaghetti

Changing Notebook paradigm to solve their pitfalls?

Example Issue
Let's execute out of order! ❌ Reproducibility
Let's overwrite this global variable! ❌ Global scope pollution
Let's couple this cell to its surroundings! ❌ Testability
Let's copy and paste this piece of code! ❌ Reusability

Jupyter notebooks permit bad habits

See J. Grus' talk @ JupyterCon

IPySpaghetti

Changing Notebook paradigm to solve their pitfalls?

Some solutions exist:

Issue Elyra DF notebook execution_dependencies
Reproducibility ✅ * ✅ (automatic) ✅ (manually)
Scope pollution partially
Testability ✅ *
Reusability ✅ *

* using a graph of notebooks, not enforced at notebook level

Links: Elyra, Dataflow notebook, execution_dependencies

IPySpaghetti

Changing Notebook paradigm to solve their pitfalls?

Jupyter Notebook

Based on "read-eval-print loop":

  1. write cell
  2. evaluate cell
  3. print output

IPySpaghetti

Changing Notebook paradigm to solve their pitfalls?

Jupyter Notebook

IPySpaghetti

Based on "read-eval-print loop":

  1. write cell
  2. evaluate cell
  3. print output

Based on dataflow paradigm:

  1. write node
  2. insert node in graph
  3. execute graph

1

2

3

IPySpaghetti

Changing Notebook paradigm to solve their pitfalls?

Jupyter Notebook

IPySpaghetti

IPySpaghetti

Changing Notebook paradigm to solve their pitfalls?

Replacing REPLDataflow

Reproducibility ✅ Enforced by graph
Scope pollution ✅ Each node has its scope
Testability ✅ Relies on regular .py functions
Reusability ✅ Functions can be reused

Advantages

Drawbacks

Less interactivity

Steeper learning curve

More clicks

Code not very mature, bad doc

No community (yet!)

Reuses JLab interactivity (widgets, ...)

Graph executable w/ parallel scheduler

Backed by regular .py file

Could use "node bookshelf"

Technical details

Graph: Litegraph

Interactivity: JLab

Language: typescript

Source code: cphyc/ipyspaghetti

Inspirations

IPySpaghetti

By Corentin Cadiou

IPySpaghetti

Poster for the 2021 Scipy Conference

  • 161