[IPython-User] How to execute ipython notebook with cell-level magics from the command line?

Matthias BUSSONNIER bussonniermatthias@gmail....
Wed Nov 14 04:42:30 CST 2012

Le 14 nov. 2012 à 09:48, Christoph Deil a écrit :

> Hi,
> is it possible to execute an ipython notebook with cell-level magics from the command line?
> I have a bunch of ipython notebooks that contain e.g.
> %load_ext cythonmagic
> %%cython
> and I'd like to be able to run them from the command line for automatic testing.
> I tried converting the ipynb file to a py file and then running it through
> ipython -i myscript.py

File with .py extension will be treated as plain python file. You have to rename them with .ipy extension for IPython to do its magic. 
Still, Cell magic are not yet supported in ipy script.
see this issue https://github.com/ipython/ipython/issues/2539

Following gist might be a good starting point, or even do what you want.


> but that already gives a syntax error for simple magics and I guess it's impossible to incorporate cell-level magics in regular python files somehow?
> Christoph
> _______________________________________________
> IPython-User mailing list
> IPython-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-user

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-user/attachments/20121114/ce3eb73b/attachment.html 

More information about the IPython-User mailing list