[IPython-dev] API to execute cells of notebook
andy at payne.org
Thu Aug 7 13:50:03 EDT 2014
> I could do that, but it seems a bit out of place in the IPython widget
> Imagine if cells had a hidden attribute that could be set in python. Then
> you could use the widget framework to implement a slideshow, or select
> which type of report to show. Being able to only access those apis through
The challenge (I suspect) is the execution of a Web notebook is driven from
earlier eventually calls notebook.execute_cell(), which invokes the
execute() method on the cell.
For code cells, that generates an execute message to the kernel, see:
And the message:
Note that the kernel execute message has the actual code fragment to run,
not a reference to a cell. The current state of the notebook (e.g. all the
code) is in the browser not the kernel (e.g. you can edit 3 code cells and
then do "run all" and get the result you expect). This means a "run all"
operation has to involve the browser notebook somehow.
I'm not defending this design or saying what you're looking for is
unreasonable. I'm just noting that there may be an impedance mismatch with
way the kernel and notebooks are built (which likely derives from the
team's stated design goal to keep them independent).
And given that widgets are essentially a combination of kernel-side Python
messages, you could easily (I think) implement a widget version of what
you're looking for by taking the button widget and calling the
execute_all_cells() method on invocation.
I hope this is helpful,
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the IPython-dev