I have some code in a .ipynb file and got it to the point where I don't really need the "interactive" feature of IPython Notebook. I would like to just run it straight from a Mac Terminal Command Line.
Basically, if this were just a .py file, I believe I could just do python filename.py from the command line. Is there something similar for a .ipynb file?
nbconvert allows you to run notebooks with the
--execute
flag:If you want to run a notebook and produce a new notebook, you can add
--to notebook
:Or if you want to replace the existing notebook with the new output:
Since that's a really long command, you can use an alias:
You can export all your code from
.ipynb
and save it as a.py
script. Then you can run the script in your terminal.Hope it helps.
For new version instead of:
You can use jupyter instend of ipython:
From the command line you can convert a notebook to python with this command:
You may have to install the python mistune package:
Update with quoted comment by author for better visibility:
Install runipy library that allows running your code on terminal
After just compiler your code:
You can try cronjob as well. All information is here