nbox.lib.notebook
Jupyter Notebooks are user by millions of developers world wide, so we said why not just create an operator that runs the jupyter notebook and creates a python file out of it. Catch: Currently we do not support notebooks that have a !
for shell commands, please replace them with subprocess.call(shelex.split(<com>))
Example:
from nbox.lib.notebook import NotebookRunner op = NotebookRunner("./sample.ipynb") op() # call and it will do the rest
Functions
functionget_py_builtin_all
[source]functionget_package_version
[source]functionprocess_codeblocks
[source]This function is responsible for unpacking the code blocks and creating the python file from it.
functionnb2script
[source](nb:str,path:str)
Parameters
- nb -
path to the notebook file
- path -
path to the python file to be created, if
None
same name as notebook
This function takes in a notebook file and creates a python file from it.
functionupdate_requirements
[source]Classes
classImportNodeVisitor
[source]function__init__
[source]functionvisit_Import
[source]functionvisit_ImportFrom
[source]classNotebookRunner
[source]function__init__
[source](nb:str,outfile:str)
Parameters
- nb -
path to the notebook file
- outfile -
path to the python file to be created
Run any notebook as a python file.
functionforward
[source]