Package: runnb
runnb - The run-notebook scriptrunnbis a script to runjupyternotebooks from the command-line.
It is anbconvertAPI wrapper.
Notes on executing notebooks can be foundhere.
You may also want to see the format specification ofjupyternotebooksnbformat.Current version ofrunnbis implemented and tested underpython 2, 3andjupyter 4.3.0.InstallationTo install pip package,pipinstallrunnbor to install latest version,pipinstall--upgradegit+https://github.com/InnovArul/runnbUsagerunnb[options]<path/to/notebook.ipynb>Options-h --help                               Display help message.-e --allow-error                        Allow error during single cell and continue running.-n --no-stdio                           Don't recover STDIO to command line. (You may not see printed messages.)-a --allow-not-trusted                  Run the notebook even not trusted.-t --to=<path/to/notebook.out.ipynb>   Save the executed notebook to a specific file.ExamplesAssume we have a notebooktest.ipynb.
Simply run the notebook from command-line:runnbtest.ipynbIf we want to run the notebook not being break by possible error in some cell, pass the--allow-errorflag:runnb--allow-errortest.ipynbOr do it with the shortcut-e:runnb-etest.ipynbIf we wanted to export the executed notebook, use--to:runnb--to=test.out.ipynbtest.ipynbor using its shortcut-t:runnb--ttest.out.ipynbtest.ipynbBy default, we recover the output of notebook to the command-line by boardcasting theinput/output/errorstream. This is done by adding a small snippet of code handlingsys.stdin,sys.stdout, andsys.stderr. A tinyTeeClass is used to support such behavior. Make suretee.pyis in our python search path. If doing this is not preferable in certain scenario, we can turn it off by passing--no-stdioflag:runnb--no-stdiotest.ipynbor using its shortcut-n:runnb-ntest.ipynbHowever, this could mean we may not see output from the execution on the command-line. It could be a good idea to save those outputs to a output notebook by using--toflag:runnb--no-stdio--totest.out.ipynbtest.ipynbThe most (no exaggeration) dangerous thing we can try here is to run anot trustednotebook. By default, running a not-trusted notebook leads to aDeprecationWarningthat stop it from running. However, if one insists to, we can pass--allow-not-trustedflag to allow running.runnb--allow-not-trustednot_trusted.ipynbDeprecation message will be displayed but it would not block running. The executed not-trusted notebook could also be saved by using--to. We will unsign the outcome of not-trusted notebook and mark it not trusted. However, the best practice is do not run not trusted notebooks. At least we should review the notebook first, and sign it trusted if it is safe. Make sure we understand what is happenning and what we are doing.Lib usagerunnb(nb_path, allow_errors=False, no_stdio=False, to_file=None)Run a notebook from current path.Parameters:nb_path(str) - path to a notebook.allow_errors(bool) - Wheither to allow error during single cell and continue running. When set toTrue, the notebook will continue running following cells if error presents in some cell.  DefaultFalse.no_stdio(bool) - Wheither to stop recovering STDIO to default. When set toTrue, default STDIO (usually command-line) will not be recovered. Results can be found only in the output notebook. DefaultFalse.to_file(str) - Path to which file the executed notebook will be saved to. The notebook will not be save if set toNoneor empty string. DefaultNone.Raises:DeprecationWarning- Raise if the notebook is not trusted and the warning is not filtered withwarningsmodule.