These are chat archives for ipython/ipython

24th
Sep 2015
epifanio
@epifanio
Sep 24 2015 03:08
Hi, I’m working on a fork of the cesium-ipython widget, I added camera events to move the globe from the notebook to the js globe, and added support for other format (geojson)
.. I’m new to js … I was now now investigating how (from cesium) trig “signals” when the camera moves
do you have any example code where a js variable is sent back to the IPython notebook kernel ?
I’m tring to send back to python the mouse ‘click’ events ...
but I’ve no clue on how to do it
i know ipywidget does this for jquery widgets like textbox, radio button,drppdown menu etc … but how can be done the same from a js code stored in the nbextension directory ?
Aaron Watters
@AaronWatters
Sep 24 2015 12:24
Hi epifanio -- the svg canvas widget I'm developing uses traitlets to allow the client code to subscribe to any DOM event -- here https://github.com/simonsfoundation/jp_svg_canvas/blob/master/jp_svg_canvas/canvas.js#L5 an event handler captures the event and translates it to a traitlet value which magically appears on the python side. The circles example https://github.com/simonsfoundation/jp_svg_canvas/blob/master/examples/Moving%20circles.ipynb is intended to illustrate how to use events from the Python client code.
epifanio
@epifanio
Sep 24 2015 13:05
Thankyou so much @AaronWatters i’ll study your code and come back later :)
Aaron Watters
@AaronWatters
Sep 24 2015 13:29
On the topic: what is the best practice for a widget to check whether the supporting javascript has been loaded into a notebook and load it if it is not present but not reload it if it is present. (Assuming there might be thousands of widgets I don't want to always load it for all notebooks.) In the cesium widget I see a _view_module trait -- is that the magic? How does it work? Sorry if I missed some documentation where this is explained -- please point me to it if so.
epifanio
@epifanio
Sep 24 2015 13:37
i don’t know the answer (I made a fork .. still studing this code)
But one think happen (maybe related to what you are asking) is that when i refresh a notebook page (where a js cesium view is running)
The widget and its state are preserved
also, if i change something in the js file, i don’t need to restart the kernel to see the effects of the changes (just refresh the page)
.. don’t know if related, i found this behaviour “new to me"
Vasco Tenner
@vascotenner
Sep 24 2015 13:54

Today I tried again, no luck. I also did not receive any e-mails from the ipython mailinglist since 14 september
Is the ipython-dev mailing list still in use? I get errors:

ipython-dev-scipy.org@scipy.org (expanded from ipython-dev@scipy.org):
unknown user: "ipython-dev-scipy.org"

Aaron Watters
@AaronWatters
Sep 24 2015 13:55
I re-found the "low level" explanation https://github.com/ipython/ipywidgets/blob/master/examples/Widget%20Low%20Level.ipynb -- I'm working on understanding it. It seems to offer a number ways to install and load the javascript -- is there a good example of what has worked for other people that I could use as a best practices formula?
dimbeto
@dimbeto
Sep 24 2015 14:02
Hi, I have spark installed on my local machine for testing purposes and I am trying to run it in ipython/jupyter notebook. Jason pointed out to me jupyter-incubator sparkmagic https://github.com/jupyter-incubator/sparkmagic but based on the README file it seems this is meant to work for remote spark clusters. I was wondering, in order to run spark in the notebook should I install the sparkmagic modules or should I instead follow the cloudera pyspark installation guide? http://blog.cloudera.com/blog/2014/08/how-to-use-ipython-notebook-with-apache-spark/ Any help would be appreciated. Thanks!
Min RK
@minrk
Sep 24 2015 14:05
@vascotenner ipython-dev list should be back up as of a few minutes ago. It's been down for at least a few days.
@dimbeto for local spark, you can use findspark to locate your local spark implementation.
dimbeto
@dimbeto
Sep 24 2015 15:44
Thanks @minrk. It worked