[IPython-dev] Notebook CodeCell for editing and executing javascript

Nissim Karpenstein nissimk at gmail.com
Tue Dec 18 08:02:44 EST 2012


Hi,

I'm new here and I wanted to run this by the group before I start working
on it.  I'm interested in building a facility to use the notebook to edit
and execute javascript code for presenting data from the python kernel.  I
know there is a magic function and there is some sort of way to have python
code render js in <script> tags, and you can put javascript in the Markdown
cells, but I was envisioning something more like a standard codecell, but
execution is handled by the browser rather than the kernel.

Let's say you've loaded some data and run some computations in your python
kernel and now you want to display results in the notebook using some
javascript library like d3, datatables or processing.  If you want to do
this by writing the javascript code in a CodeCell and evaluating that code
in the browser you need a couple of things:

1) ability to change a code cell language to javascipt in the notebook
frontend.  I saw that there is a language field in the notebook file format
for CodeCell but it is always = python.

2) facility to have the browser javascript engine evaluate the contents of
the javascript CodeCell when it is executed by the user

3) http REST api that will return json representations of Python objects
that exist in the kernel.  (this may already exist, I don't really
understand the kernel communication protocol yet).

There are probably some more things like the ability to add CSS, HTML, js
and image resources to the server that it can then serve back to the
client.  I see that there's been a lot of discussion related to this in the
plugins thread, but maybe there can also be a method for accessing
resources from the network and then telling the notebook server to serve
them from some path.

I'd like to implement this and I had a couple of questions:

1) Does this fit in with your ideas for the notebook or is editing non
python code in CodeCell outside of the vision?

2) Should there be another Dropdown for the language of the CodeCell or
should there be a javascript option added to the existing select box.

Thanks

   -Nissim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20121218/feb32149/attachment.html>


More information about the IPython-dev mailing list