These are chat archives for ipython/ipython

26th
Mar 2015
Kyle Kelley
@rgbkrk
Mar 26 2015 00:01 UTC
ah, cool
Jason Grout
@jasongrout
Mar 26 2015 15:39 UTC
@jdfreder - quick question about the casperjs widget tests...
Jonathan Frederic
@jdfreder
Mar 26 2015 15:40 UTC
Yeah
Jason Grout
@jasongrout
Mar 26 2015 15:41 UTC
you have, for example, in https://github.com/ipython/ipython/blob/master/IPython/html/tests/widgets/widget.js#L161, execute_cell_then, and it seems that the function is then executed after the widget is created. But then you also do wait_for_widget. What is the difference between putting checking code in the execute_cell_then and after the wait_for_widget?
oh, wait. does wait_for_widget wait until all pending messages have been sent?
Jonathan Frederic
@jdfreder
Mar 26 2015 15:43 UTC
Yes
Jason Grout
@jasongrout
Mar 26 2015 15:43 UTC
so you do stuff to the widget in execute_cell_then, then outside you wait_for_widget?
Jonathan Frederic
@jdfreder
Mar 26 2015 15:43 UTC
Yeah, or inside. I think either way would work.
Jason Grout
@jasongrout
Mar 26 2015 15:44 UTC
so the wait_for_widget essentially adds a .then() that stalls until the messages are sent?
Jonathan Frederic
@jdfreder
Mar 26 2015 15:44 UTC
Yes
Jason Grout
@jasongrout
Mar 26 2015 15:44 UTC
okay, that makes sense.
Jonathan Frederic
@jdfreder
Mar 26 2015 15:44 UTC
IIRC it just looks at the pending msg variable
Same one used for throttling
trying to find the code now
hooray for github code searching
Jonathan Frederic
@jdfreder
Mar 26 2015 15:46 UTC
yeah
looks like that's right
One thing I don't know how to do on github, is quickly open a file by name
Jason Grout
@jasongrout
Mar 26 2015 15:47 UTC
type /
Jonathan Frederic
@jdfreder
Mar 26 2015 15:47 UTC
Ah thanks
Jason Grout
@jasongrout
Mar 26 2015 15:47 UTC
sorry; type t
Jonathan Frederic
@jdfreder
Mar 26 2015 15:47 UTC
Because searching util.js brought up 7 files, none of which were util.js
Jason Grout
@jasongrout
Mar 26 2015 15:47 UTC
I searched for wait_for_widget
Jonathan Frederic
@jdfreder
Mar 26 2015 15:47 UTC
(which is uniquely named in our codebase)
ah
Jason Grout
@jasongrout
Mar 26 2015 15:48 UTC
but yeah, if you know the file name, then type t, then util.js
Jonathan Frederic
@jdfreder
Mar 26 2015 15:48 UTC
neat - just tried it
Jason Grout
@jasongrout
Mar 26 2015 15:49 UTC
type ? to see other keyboard shortcuts
This message was deleted
Jonathan Frederic
@jdfreder
Mar 26 2015 15:50 UTC
Interesting, t doesn't show on the keyboard shortcut screen
Jason Grout
@jasongrout
Mar 26 2015 15:50 UTC
yes it does, for me, at the bottom
Jonathan Frederic
@jdfreder
Mar 26 2015 15:51 UTC
Ah "show all"
: P
Jonathan Frederic
@jdfreder
Mar 26 2015 15:51 UTC
Yes in the button test, I'm actually waiting for the element to appear on the page.
what's the difference?
Jonathan Frederic
@jdfreder
Mar 26 2015 15:53 UTC
The difference is that one will fail with a timeout and the other will fail immediately. I think the one that assumes the widget is there, and other instances like that, were done before the promises in which case that was an okay assumption.
Jason Grout
@jasongrout
Mar 26 2015 15:54 UTC
well, I guess not technically, since it may take some time to insert the html into the DOM.
with or without promises
Jonathan Frederic
@jdfreder
Mar 26 2015 15:55 UTC
Would it?
I wasn't aware of that
So manipulations of the DOM are asynchronous, generally speaking?
Or is jQuery asynchronous?
Jason Grout
@jasongrout
Mar 26 2015 15:58 UTC
wait, no, never mind
in general, you have to wait until a page is loaded before interacting with the DOM
but we're explicitly creating elements and adding them to the DOM; that's synchronous
(unless we're using promises, of course)
Jonathan Frederic
@jdfreder
Mar 26 2015 15:58 UTC
Yeah
One of the things I've been excited to look at is rewriting the tests for just the widgets, post big split.
After seeing @jhamrick 's tests, I'm thinking of using Selenium.
Jason Grout
@jasongrout
Mar 26 2015 16:00 UTC
okay
I don't have any experience with Selenium
Jonathan Frederic
@jdfreder
Mar 26 2015 16:01 UTC
Me neither~
Jason Grout
@jasongrout
Mar 26 2015 16:01 UTC
I'm looking forward to writing tests in babel/Typescript
Jonathan Frederic
@jdfreder
Mar 26 2015 16:01 UTC
Yeah! - That too
Jason Grout
@jasongrout
Mar 26 2015 16:01 UTC
even just having the template strings will make a big difference in readability
template strings are multiline strings, among other things
Jonathan Frederic
@jdfreder
Mar 26 2015 16:02 UTC
Ah!
I was just about to ask
lol
Well, that's a good point- we could stick with JS based tests
(or transpiled JS)
and just take what we've learned to do a better job.
-afk
Jonathan Frederic
@jdfreder
Mar 26 2015 16:26 UTC
back
Michael Goerz
@goerz
Mar 26 2015 16:34 UTC
This message was deleted
Matthias Bussonnier
@Carreau
Mar 26 2015 17:23 UTC
@minrk You played with conda right ? is there an easy way to install matplotlib without fetching Qt ?
(heroku so limitted capabilities)
Min RK
@minrk
Mar 26 2015 17:25 UTC
conda matplotlib doesn't depend on qt
So the easiest way is probably conda install matplotlib
Matthias Bussonnier
@Carreau
Mar 26 2015 17:26 UTC
Humm..... d does when I use conda BUILDPACK on heroku.
Min RK
@minrk
Mar 26 2015 17:27 UTC
Maybe it does on Linux. I just tested on OS X
Matthias Bussonnier
@Carreau
Mar 26 2015 17:27 UTC
hum, maybe...
I'll try to mix conda/pip
pandas does not install on heroku/pip
but does on heroku/conda
Thanks for trying I'll play around.
Min RK
@minrk
Mar 26 2015 17:31 UTC
Yup, matplotlib requires qt on linux
I guess because it needs at least one GUI backend, and there's an OS X native one, so qt isn't needed.
Matthias Bussonnier
@Carreau
Mar 26 2015 17:34 UTC
hum... I'm sad it makes heroku buildpack too big.
herokku refuses it...
for ~4mb
Min RK
@minrk
Mar 26 2015 17:34 UTC
Heroku's no good for much other than trivial web services. What are you trying to do?
Matthias Bussonnier
@Carreau
Mar 26 2015 17:36 UTC
Github stat graphs.
I have the notebook with the data, I just want to run the code on the cloud.
(cross repo number of open issues, and who is assigned)
Jason Grout
@jasongrout
Mar 26 2015 17:46 UTC
@jdfreder - one more question:
Jonathan Frederic
@jdfreder
Mar 26 2015 17:47 UTC
shoot
Jason Grout
@jasongrout
Mar 26 2015 17:47 UTC
is there a good way to get a hold of the view created in a cell?
(in a test)
I see you print out the model id on the python side, and then read that in from the output in casper
do you have an example where you interact directly with the view created in a certain cell?
Jonathan Frederic
@jdfreder
Mar 26 2015 17:48 UTC
I may, one sec...
Jason Grout
@jasongrout
Mar 26 2015 17:48 UTC
I'm writing a test that tests sending custom messages from the view back to the kernel with binary buffers
so I want to call a method on the view
I'm also sending a message from the kernel to the view, and I want to check that the view got the message correctly.
Jonathan Frederic
@jdfreder
Mar 26 2015 17:50 UTC
So I don't think I do, you can use the cell index to get a handle on the cell and find the correct view via that.
Jason Grout
@jasongrout
Mar 26 2015 17:51 UTC
do you have a good way of getting the model from the model id?
(or do you just explicitly get the widget manager and get the model out of that?)
presumably, the model only has one view, so I could probably just get it there anyway.
Jonathan Frederic
@jdfreder
Mar 26 2015 17:52 UTC
Right now I just do your parenthesized text.
But if you know it's the only view for the cell
It may be cleaner to just get the view
Jason Grout
@jasongrout
Mar 26 2015 17:52 UTC
right, it is.
oh, hmm...
Jonathan Frederic
@jdfreder
Mar 26 2015 17:53 UTC
and even if you need the model- you can get that from the view
jasongrout @jasongrout goes to see how the cell stores the views
jasongrout @jasongrout hits myself on the head when he realizes that's what Jon just posted
Jonathan Frederic
@jdfreder
Mar 26 2015 17:53 UTC
lol
Yeah
they aren't promises
just vanilla views
Jason Grout
@jasongrout
Mar 26 2015 17:54 UTC
oh, nice
Jonathan Frederic
@jdfreder
Mar 26 2015 17:54 UTC
; )
Jason Grout
@jasongrout
Mar 26 2015 17:54 UTC
so I just need to get the cell object somehow...
Jonathan Frederic
@jdfreder
Mar 26 2015 17:54 UTC
You have the index in the closure
Jason Grout
@jasongrout
Mar 26 2015 17:54 UTC
right, I have the index. hmmm...gotta find where to use it.
Jonathan Frederic
@jdfreder
Mar 26 2015 17:55 UTC
IPython.notebook.get_cell ?
I think that takes an index
Jason Grout
@jasongrout
Mar 26 2015 17:55 UTC
right, I guess that's what I'm seeing in the notebook tests.
Jonathan Frederic
@jdfreder
Mar 26 2015 17:55 UTC
or something named similarly to it..
Jason Grout
@jasongrout
Mar 26 2015 17:55 UTC
Thanks
Jonathan Frederic
@jdfreder
Mar 26 2015 17:55 UTC
np
Jason Grout
@jasongrout
Mar 26 2015 17:56 UTC
is there a function that will append and execute a cell? Edit: There is now! :)
it looks like this.get_cell(i) also gets cell i (defined as a casper convenience function)
Jonathan Frederic
@jdfreder
Mar 26 2015 18:25 UTC
@jasongrout if I understand correctly, be careful with that, not everything can cross the context boundary (JSON-able only).
Jason Grout
@jasongrout
Mar 26 2015 18:25 UTC
right
all I'm doing is wrapping the append cell and execute cell
casper.append_cell_execute_then = function(text, then_callback, expect_failure) {
    // Append a code cell and execute it, optionally calling a then_callback
    var c = this.append_cell(text);
    return this.execute_cell_then(c.index, then_callback, expect_failure);
}

casper.assert_output_equals = function(text, output_text, message) {
    // Append a code cell with the text, then assert the output is equal to output_text
    this.append_cell_execute_then(text, function(index) {
        this.test.assertEquals(this.get_output_cell(index).text, output_text, message);
    });
}
just abstracting out some common patterns for running code and checking results
Jonathan Frederic
@jdfreder
Mar 26 2015 18:27 UTC
Ah yes
Thank you for doing that : )
Jason Grout
@jasongrout
Mar 26 2015 18:27 UTC
I particularly like the assert_output_equals. It makes it easy to check that something works on the python side
Sylvain Corlay
@SylvainCorlay
Mar 26 2015 18:30 UTC
@minrk are you around?
Min RK
@minrk
Mar 26 2015 18:31 UTC
@SylvainCorlay hi
Sylvain Corlay
@SylvainCorlay
Mar 26 2015 18:31 UTC
hi!
rather than creating a new context manager, I was thinking of having your hold_trait_notification also hold the cross_validation
Min RK
@minrk
Mar 26 2015 18:31 UTC
yes, I think that's what we discussed.
I don't think there's a need for the two to be treated separately.
Sylvain Corlay
@SylvainCorlay
Mar 26 2015 18:32 UTC
ok, I did not recall well
thanks
Min RK
@minrk
Mar 26 2015 18:32 UTC
That's what I was thinking anyway, I may not have said it.
Didn't you know that telepathy is a requirement for working on IPython?
Sylvain Corlay
@SylvainCorlay
Mar 26 2015 18:34 UTC
yes, but over 2000 miles, there are some race conditions even with telepathy
Jonathan Frederic
@jdfreder
Mar 26 2015 18:41 UTC
lol
Sang Han
@jjangsangy
Mar 26 2015 19:25 UTC
Hello, so this is a little bit off topic. Was wondering if anyone knew the most portable way for dynamically linking against an external zmq?
Sylvain Corlay
@SylvainCorlay
Mar 26 2015 22:15 UTC
@minrk this is actually quite complicated
especially to deal with nesting
unlike in your case
In case of bulk trait rejections, I must remove the corresponding notifications from the queue that is being held.
A simpler logic would be to not notify for multiple subsequent changes of the same attribute, unlike what you did. Only notify the agregated change
Sylvain Corlay
@SylvainCorlay
Mar 26 2015 23:10 UTC
After discussion here with @jasongrout
Min RK
@minrk
Mar 26 2015 23:31 UTC
@SylvainCorlay It should reject everything all at once, right? Not just the conflicts.
Sylvain Corlay
@SylvainCorlay
Mar 26 2015 23:32 UTC
yes
do you have a minute?
Min RK
@minrk
Mar 26 2015 23:32 UTC
I will shortly. Finishing up a meeting right now.
Sylvain Corlay
@SylvainCorlay
Mar 26 2015 23:32 UTC
ok, cool, I will be here
Min RK
@minrk
Mar 26 2015 23:33 UTC
Is it a problem specifically for nesting? Is it okay for single calls?
Sylvain Corlay
@SylvainCorlay
Mar 26 2015 23:34 UTC
no, I think I got that part. the problem is that to be consistent with the notification, I need to cancel all the new notification of the rejected changes
Min RK
@minrk
Mar 26 2015 23:36 UTC
The nesting is only used in one case in configurable, and I can rewrite that to avoid the need. I don't think it's critical for nesting to be allowed for this.
Sylvain Corlay
@SylvainCorlay
Mar 26 2015 23:36 UTC

In the case where you do

with w.hold_traits():
    w.a = something_invalid
    w.a = something_valid

I am not rejecting the global change, and therefore sending all notification including the invalid one

Min RK
@minrk
Mar 26 2015 23:36 UTC
ah, ok
Sylvain Corlay
@SylvainCorlay
Mar 26 2015 23:36 UTC
so I want to change your logic so as to only send notifications for the final state
Min RK
@minrk
Mar 26 2015 23:37 UTC
ok, that's fine
Sylvain Corlay
@SylvainCorlay
Mar 26 2015 23:37 UTC
this could make the order unpredictable
Min RK
@minrk
Mar 26 2015 23:37 UTC
I don't think the notification order should be important
Sylvain Corlay
@SylvainCorlay
Mar 26 2015 23:37 UTC
(temporal order of notifications)
ok
Min RK
@minrk
Mar 26 2015 23:38 UTC
I think it's okay to say that bundled notifications should be treated as concurrent (i.e. order undefined).
Sylvain Corlay
@SylvainCorlay
Mar 26 2015 23:39 UTC
fair enough, I was just having reservations on changing the logic of your decorator.
thanks
Min RK
@minrk
Mar 26 2015 23:39 UTC
Ah, don't worry about that.