Bonobo with Jupyter Notebooks

Brand new feature

This feature is now released in the stable channel of Bonobo.

Jupyter plugin

Jupyter plugin is bundled within the main bonobo package. To ensure optional dependencies are available, make sure you install it using the bonobo[jupyter] extra.

You should already be familiar with jupyter notebooks. If it's not the case, that may be not the page you're looking for.

pip install bonobo[jupyter]


Jupyter extension needs to be enabled before it is loaded in notebooks.

jupyter nbextension enable --py --sys-prefix widgetsnbextension
jupyter nbextension install --py bonobo.ext.jupyter
jupyter nbextension enable --py --sys-prefix bonobo.ext.jupyter

Create an ETL job in a notebook

Creating an ETL job within a notebook is done exactly the same way you'd do it in a source file. Just add the right imports, create your graph, and use bonobo.run(graph) to execute it.

If bonobo can detect you're in a jupyter notebook, which it should, a jupyter widget will display statistics about your running transformation while it's executing. Read the full documentation of the plugin.

Using services in a notebook

To use services in a notebook, you need to define a get_services() function that returns the usual dictionary of implementations (read about services in the documentation if you're not familiar with that), and just pass it to the bonobo.run(...) call.

def get_services():
    return { 'foo': Foo() }

bonobo.run(graph, services=get_services())

Future

As said, the widget is kind of minimalistic right now, but establish the basic infrastructure to be way better in the future. Amongst other things we're interested in, we'll at least implement the following:

  • Graphic visualisation using the graphviz rendering feature introduced in 0.5
  • Play / Pause / Step-debug
  • Other debugging tools
  • HTML pretty printer

If you're interested, feel free to contribute on this!

Happy jupyterization!

Did I say we need feedback? Slack discussions and issues are more than welcome!