Example - Executing a notebook from the Command Line

How to add a parameter tag

If you wanted to add your own parameter tag, you would go to the menu: View ➡️ Cell Toolbar ➡️ Tags

Input notebook

Let's take a look at the input notebook (simple_input.ipynb). This notebook has cells containing tags for the parameters.

See input notebook

Execute using the Command Line

We are going to use the Jupyter magic %%bash to simulate executing the notebook from the command line from a bash terminal.

The command takes the form:

papermill <input notebook> <output notebook> -p <parameter name> <parameter value>


In [ ]:
binder_dir = '..'

In [ ]:
!papermill {binder_dir}/cli-simple/simple_input.ipynb {binder_dir}/cli-simple/simple_output.ipynb -p msg 'Hello'

Output notebook

Let's take a look at the output notebook.

See output notebook