Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/davidbrochart/subnotebook

Call Jupyter notebooks as Python functions
https://github.com/davidbrochart/subnotebook

jupyter-notebook python

Last synced: 16 days ago
JSON representation

Call Jupyter notebooks as Python functions

Awesome Lists containing this project

README

        

# Subnotebook

Run a notebook as you would call a Python function.

Two modes are currently supported:

- An in-process mode, where the subnotebook is executed in the same kernel your
interpreter is running in (but in a different name space). This allows to pass
parameters and get results back, including widgets.
```python
from subnotebook import run_nb

ab, ba, slider, output = run_nb('sub_notebook.ipynb', a='c', b='d')
```

- An out-of-process mode, where the subnotebook is executed and served using
[Voila](https://voila.readthedocs.io), and included in the main notebook as an
IFrame. This mode only allows to display the outputs of the subnotebook, which
is useful for offloading the main notebook but also to offer a UI to resources
you would not have access to, such as big data or protected data.
```python
from subnotebook import display_nb

display_nb('widget_notebook.ipynb')
```