These are chat archives for ipython/ipython

21st
May 2015
Andreas Klostermann
@akloster
May 21 2015 14:03
hm, I'm starting again to write custom widgets... seems like some things have changed...
Any advice for writing widgets for IPython 3 and avoiding at least some upwards incompatibility?
Uncaught TypeError: WidgetManager.register_widget_view is not a function
Andreas Klostermann
@akloster
May 21 2015 14:17
sorry, I overlooked "Migrating widgets to IPython 3"
Andreas Klostermann
@akloster
May 21 2015 14:51
is there any guide to how widgets work now, the migration guide leaves me a bit befuddled
Dave Hirschfeld
@dhirschfeld
May 21 2015 15:00
Is there any way in IPython parallel to tell how many clients are connected to a controller?
Also, is there a way to start a parallel engine so that it uses dill by default? My usecase is that when starting a cluster, depending on the load on the grid some engines may be put in a queue and only register at some later stage. Those new engines wouldn't have had IPython.utils.pickleutil.use_dill() called on them so I imagine they would fail if they tried to execute an unpickleable task.
Jason Grout
@jasongrout
May 21 2015 15:05
@akloster, I don't think we have anything besides the migration guide. What questions do you have?
Jonathan Frederic
@jdfreder
May 21 2015 15:27
@akloster the example notebooks should be up to date for 3.x
Andreas Klostermann
@akloster
May 21 2015 15:40
I'm wondering how to register views
as far as I understand it, the old thing with the widget manager is deprecated... and I'm trying to figure it out from the source now
Jonathan Frederic
@jdfreder
May 21 2015 15:48
Ah yes, so you should be using require.js to manage your views
So put your view code in a define block, like before
Andreas Klostermann
@akloster
May 21 2015 15:49
actually, no, I copied from the examples and used "require"
Kyle Kelley
@rgbkrk
May 21 2015 15:50
Are we having a meeting at all today?
Jonathan Frederic
@jdfreder
May 21 2015 15:51
The require call in the example notebooks should be changed to a define call.
Andreas Klostermann
@akloster
May 21 2015 15:51
ok
Jonathan Frederic
@jdfreder
May 21 2015 15:51
so instead of calling the register method
return a dictionary, at the end of the define call inside the callback, like {VIEWNAME: ViewClass}
If you're working in the notebook
Andreas Klostermann
@akloster
May 21 2015 15:52
ah yes now it works
it sort of didn't before ... hmmm
Jonathan Frederic
@jdfreder
May 21 2015 15:53
the define call will look different than if you're working in a standalone js file
for the notebook:
define('ModuleName', [...imports], function(...imports) {});
for a standalone file:
define([...imports], function(...imports) {});
Andreas Klostermann
@akloster
May 21 2015 15:54
ah
Jonathan Frederic
@jdfreder
May 21 2015 15:54
the ModuleName is then the standalone file's name
without the .js
Then in your Python, your specify two things- the view module and view name
@rgbkrk I don't think we are having a meeting today, but I could be wrong. Maybe @minrk @takluyver or @Carreau have something to share?
@akloster let me know if you need anymore help
Andreas Klostermann
@akloster
May 21 2015 15:57
@jdfreder how is the module specified on the python widget class? The built-in widget in the source use a register decorator
Kyle Kelley
@rgbkrk
May 21 2015 15:57
Didn't seem like we would.
Jonathan Frederic
@jdfreder
May 21 2015 15:58
@akloster the same way you did in IPython 2.0, a unicode traitlet with sync=True, but replace name with module
let me dig up an example
Andreas Klostermann
@akloster
May 21 2015 15:59
My general strategy is to prototype widgets in a notebook and then move them out to js and py files
Jonathan Frederic
@jdfreder
May 21 2015 16:00
Yup, that's usually what I do too
That's how I've been writing my widgets now days
Sumit Sahrawat
@sumitsahrawat
May 21 2015 16:03
Are there any updates on adding IHaskell to try.jupyter.org? (jupyter/docker-demo-images#29)
Jonathan Frederic
@jdfreder
May 21 2015 16:03
the boilerplate includes setup.py code
@sumitsahrawat @rgbkrk is who to ask
Sumit Sahrawat
@sumitsahrawat
May 21 2015 16:03
Yeah, he was here just now I think.
He told me a decision would me made at the dev-meeting.
Andreas Klostermann
@akloster
May 21 2015 16:05
@jdfreder thank you
Kyle Kelley
@rgbkrk
May 21 2015 16:05
Yeah I think we stayed in indecision
I'd like to see @gibiansky to my question about pinning
Sumit Sahrawat
@sumitsahrawat
May 21 2015 16:06
IHaskell is about to have a new release.
In 1-2 days max.
Kyle Kelley
@rgbkrk
May 21 2015 16:06
I don't want builds to fail
because it's mostly just me running the show there
Sumit Sahrawat
@sumitsahrawat
May 21 2015 16:07
So if we have a new release, would the current size be acceptable?
Kyle Kelley
@rgbkrk
May 21 2015 16:08
I'll hate it, but I want to include IHaskell
Sumit Sahrawat
@sumitsahrawat
May 21 2015 16:08
I'll look around if there's something I can do about the size.
Kyle Kelley
@rgbkrk
May 21 2015 16:09
I don't think there's much more you can do about it
Sumit Sahrawat
@sumitsahrawat
May 21 2015 16:09
I'll ping you when a release is out. :+1:
Kyle Kelley
@rgbkrk
May 21 2015 16:09
The Haskell build takes a good bit of time too
Alright, thanks for your patience
and iterating on it
Sumit Sahrawat
@sumitsahrawat
May 21 2015 16:09
Thanks. I also wanted to see IHaskell there.
Andreas Klostermann
@akloster
May 21 2015 16:11
I'm working on a widget that runs an asyncio loop in the kernel. I've got the loop, now I need the widget.
Jason Grout
@jasongrout
May 21 2015 16:14
@akloster: It starts an asyncio loop? What does it do then? It sounds interesting...
Andreas Klostermann
@akloster
May 21 2015 16:15
the loop is pretty simple currently... it just runs "BaseEventLoop._run_once()" repeatedly, and makes sure that method doesn't wait forever on the select call
I'd like to create a widget out of it so that this loop has a sort of "permanent" communication channel to the browser
Jason Grout
@jasongrout
May 21 2015 16:16
Also, @jdfreder - what is jupyterpip? I'm looking at your boilerplate code
Jonathan Frederic
@jdfreder
May 21 2015 16:17
This message was deleted
Andreas Klostermann
@akloster
May 21 2015 16:17
The overarching plan is to bring realtime ECG and EEG data from Bitalino/Mindwave into the browser in a more sane fashion
Jason Grout
@jasongrout
May 21 2015 16:17
@akloster - ah, so you want realtime polling of outside data sources?
Andreas Klostermann
@akloster
May 21 2015 16:17
asyncio is used to communicate with another process which does all the bluetooth handling
Jason Grout
@jasongrout
May 21 2015 16:17
would it make sense to tap into the kernel's existing event loop?
Andreas Klostermann
@akloster
May 21 2015 16:18
@jasongrout yes, it wants to poll
Jonathan Frederic
@jdfreder
May 21 2015 16:18
@jasongrout it's a one stop nbextension deployment solution. It allows you to piggy back your nbextension stuff in your setup.py.
Andreas Klostermann
@akloster
May 21 2015 16:18
@jasongrout no, problems abound... the kernel uses zmq's Event loop which doesn't do asynchronous IO
Jonathan Frederic
@jdfreder
May 21 2015 16:18
So your users can pip install .
or pip install -e . for symlinks
I made it because I got tired of updating all of my widget repos
Jason Grout
@jasongrout
May 21 2015 16:19
@jdfreder - how does it separate the js for nbextensions from the python?
Andreas Klostermann
@akloster
May 21 2015 16:19
also the bluetooth stuff is very unstable... "exceptions" are part of normal operations
Jonathan Frederic
@jdfreder
May 21 2015 16:19
everytime the suggested deployment method changed
Andreas Klostermann
@akloster
May 21 2015 16:19
and I'd like to isolate the recording stuff from what the notebook is doing
Jason Grout
@jasongrout
May 21 2015 16:19
I thought @takluyver experimented with making the kernel event loop asyncio?
maybe you could at least hook into the kernel event loop to run your event loop?
i.e., the kernel event loop does the run_once call?
Andreas Klostermann
@akloster
May 21 2015 16:20
that may be possible
but it's rather the same thing
Jonathan Frederic
@jdfreder
May 21 2015 16:20
@jasongrout you place all of your nbextensions stuff in a directory, it can be the same as the python if you like, and then the setup.py just install-nbextensions it post Python install.
Andreas Klostermann
@akloster
May 21 2015 16:21
except the widget simplifies the communication I think
Jonathan Frederic
@jdfreder
May 21 2015 16:21
@jasongrout it's not the end-plan, but it's useful to have that code in one place
so when we do have a real end-plan
I can just update it once
a few other people are using it now too
Jason Grout
@jasongrout
May 21 2015 16:21
@akloster. Yes, I suppose widgets do simplify the communication. Are you communicating the entire history of readings, though?
@jdfreder - so you install the python files into nbextensions too?
@akloster: I can imagine that only sending updates will be far more efficient for real-time data.
Andreas Klostermann
@akloster
May 21 2015 16:23
@jasongrout not really... the recording server stores stuff by appending to bcolz. The kernel-side code can request periodic updates, or things like "last 5 seconds", and then I can transform it to a pandas time series or something
Jonathan Frederic
@jdfreder
May 21 2015 16:23
If you want it to, yes. But you can specify the folder name, so you could put them in a separate dir if you'd like.
Andreas Klostermann
@akloster
May 21 2015 16:23
it's sort of updating
it will be a delicate dance of data
Jonathan Frederic
@jdfreder
May 21 2015 16:24
In the boilerplate, I just nbextension the Python too-
I thought it was simpler than having to separate directories
and I wanted it to be as simple as possible
Andreas Klostermann
@akloster
May 21 2015 16:24
for various reasons I don't expect more than two or three "frames" per second when displaying realtime data
bokeh also flickers a lot
last year at Europython I just replaced matplotlib images to show realtime data in the live presentation
I don't know if I'll present at bilbao, my talks weren't voted high enough, probably
Jason Grout
@jasongrout
May 21 2015 16:26
@jdfreder - it would also be cool if it supported the destination argument to install_nbextension. Often I will have a widget that has an "mywidget/nbextension" directory, but of course, I want it installed to "nbextensions/mywidget".
(not nbextensions/nbextension)
Jonathan Frederic
@jdfreder
May 21 2015 16:27
Yup, I'm happily accepting PRs : )
Jason Grout
@jasongrout
May 21 2015 16:27
:)
Jonathan Frederic
@jdfreder
May 21 2015 16:27
already got one for Windows support : D
Jason Grout
@jasongrout
May 21 2015 16:29
@akloster - so the widget would be controlling the kernel-side updates you mention above, like "get the last 5 seconds as an array of numbers" or something?
(just trying to understand how you are tackling the problem. Real-time data to the browser is an interesting use of widgets and interactivity)
Andreas Klostermann
@akloster
May 21 2015 16:44
yes, the kernel-side widget code is opening a websocket to the acquisition-server, and can issue commands like "every second, give me the last one second of data"
I thought about direct communication between browser and the websocket server, but for various reasons I want to be able to use Python to handle the data first. Later maybe I can do some "direct" widgets which are more performant
Pandas' timeseries functionality is all kinds of useful when dealing with ecg
Andreas Klostermann
@akloster
May 21 2015 16:53
at europython I stood before an audience of like 300 people and had to wait for bluetooth to reconnect again. I'd like to avoid that in the future...
Jason Grout
@jasongrout
May 21 2015 17:06
Interesting. So for example, you'd have a drop-down box that would control the rates of updates, or maybe a slider for "Updates per minute". The widget communicates that back to the kernel, and the kernel-side widget code sets up the polling for that time interval.
is that the idea?
Then the actual polling step is handled however. The widget just controls the polling loop and how much data is requested.
So, for example, the widget can be created with a callback function, which will be called whenever new data is available.
TimingLoopWidget(callback = myfunction, period=10, data_amount=1) # every 10s, get 1s of data, and call myfunction with the resulting pandas data frame?
something like that?
and then the period and data_amount could be adjusted
Jason Grout
@jasongrout
May 21 2015 17:11
If that's the idea, @akloster, I wonder if it would be more natural to make it a class (or traits class), and just hook up the actual graphical widgets, like sliders or dropdowns, to the period/data_amount variables
Andreas Klostermann
@akloster
May 21 2015 17:39
One way of operation is a "callback" much like the @interactive decorator.
that would be for recording data to a file, displaying realtime data just to take a look at it, or to prototype realtime algorithms
the other mode of operation will be "experiments" which are asyncio coroutines and do stuff like instructions, feedback and record the data, so that later notebook cells can do the analysis
I'll see how that works out in the end
Kyle Kelley
@rgbkrk
May 21 2015 18:30
Alright @sumitsahrawat, I've merged and I'll run the official build now
Probably won't deploy until tonight as I'll want to just run in place against current nodes
Rather, the image will be available
but there are about 510 containers to consume until it gets to the new image
(currently running pools)
Anton Akhmerov
@akhmerov
May 21 2015 20:31
Hi everyone. Is this the right place to report a revoked certificate error for https://nature.tmpnb.org/?
Jonathan Frederic
@jdfreder
May 21 2015 21:41
https://gitter.im/jupyter/tmpnb is probably better, but @rgbkrk listens here too.
Thanks!
Anton Akhmerov
@akhmerov
May 21 2015 21:50
My pleasure.
Kyle Kelley
@rgbkrk
May 21 2015 22:58
awwww
I knew that would come up someday
Anton Akhmerov
@akhmerov
May 21 2015 23:00
Anything serious? I wondered about using that demo tomorrow (selling Jupyter for local education).
Kyle Kelley
@rgbkrk
May 21 2015 23:01
Fixing it now
Feel free to use try.jupyter.org as well
but the nature demo lends good credence
I think we said we'd keep it up 3 months
We've gone well past that
Anton Akhmerov
@akhmerov
May 21 2015 23:02

but the nature demo lends good credence

that (also it has shiny galaxies)

Kyle Kelley
@rgbkrk
May 21 2015 23:03
That's true
we need better demos on try
How's it look now @akhmerov
Anton Akhmerov
@akhmerov
May 21 2015 23:07
Looks like it's working again. Better demos are good, but you're doing fine overall :)
Kyle Kelley
@rgbkrk
May 21 2015 23:07
:)
Anton Akhmerov
@akhmerov
May 21 2015 23:11
Thanks for the quick fix.