[IPython-dev] API to execute cells of notebook

Andrew Payne andy at payne.org
Thu Aug 7 12:33:25 EDT 2014


> I don't see a way via python to cause the current kernel to execute the
> rest of the cells in the notebook.  I could hack something together with
> javascript, but that seems problematic and brittle.
>

There are a number of existing Javascript  methods for executing cells,
including execute_cell_range(start, end) and execute_all_cells().

See:
https://github.com/ipython/ipython/blob/6ecbe721af987d743b7bfcec0448e4edace5f812/IPython/html/static/notebook/js/notebook.js#L1685

And this notebook includes a simple example of adding keyboard shortcut
using this method.  See:
http://nbviewer.ipython.org/github/minrk/pydata-sv-14/blob/master/What's%20New.ipynb

It's easy to generalize that to a Javascript button.

-andy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20140807/9ff2f6c4/attachment.html>


More information about the IPython-dev mailing list