[IPython-dev] Python and Javascript

Cyrille Rossant cyrille.rossant at gmail.com
Mon Aug 26 15:50:48 EDT 2013


Just an update about our investigation of a possible web backend for
Vispy, notably for an integration in the IPython notebook. We've made
some progress on this question during EuroSciPy. I also made a proof
of concept during the sprint (see
https://groups.google.com/forum/#!topic/vispy/16SO-JLVVII, BTW those
interested in following this work can subscribe to this mailing list).

Our conclusion is that there are multiple ways of making a web backend
for an OpenGL-based Python visualization toolkit like Vispy. GL
rendering can happen server-side (VNC-like approach, similar to the
Matplotlib web backend), client-side (GL commands are streamed to the
browser through WebSocket), or a standalone HTML page could be
generated, containing all the visualization info and data. I think all
approaches are complementary and would be possible in the IPython

My experiment streams GL commands from Python to JS (using WebGL)
through WebSocket and a basic JSON messaging protocol. NumPy arrays
can be transferred with base64. This is likely to be fast in most
situations, where the data are only transferred upon initialization.
In other cases, with datasets containing millions of points and that
need to be transferred often, it may be too slow (I think the
bottleneck is base64 serialization/deserialization, and there's also
the transfer through WebSocket).

We're now investigating a possible binary protocol to avoid
serialization of the data buffer. In addition, there might be a way of
sharing a same data buffer in memory between a Python process and the
web browser, although I've no idea how. I'll keep you in the loop
(unless this is not the right place for that, in which case I'm sorry
about the noise!).


More information about the IPython-dev mailing list