These are chat archives for ipython/ipython

26th
Mar 2015
Kyle Kelley
@rgbkrk
Mar 26 2015 00:01
ah, cool
Jason Grout
@jasongrout
Mar 26 2015 15:39
@jdfreder - quick question about the casperjs widget tests...
Jonathan Frederic
@jdfreder
Mar 26 2015 15:40
Yeah
Jason Grout
@jasongrout
Mar 26 2015 15:41
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
Yes
Jason Grout
@jasongrout
Mar 26 2015 15:43
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
Yeah, or inside. I think either way would work.
Jason Grout
@jasongrout
Mar 26 2015 15:44
so the wait_for_widget essentially adds a .then() that stalls until the messages are sent?
Jonathan Frederic
@jdfreder
Mar 26 2015 15:44
Yes
Jason Grout
@jasongrout
Mar 26 2015 15:44
okay, that makes sense.
Jonathan Frederic
@jdfreder
Mar 26 2015 15:44
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
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
type /
Jonathan Frederic
@jdfreder
Mar 26 2015 15:47
Ah thanks
Jason Grout
@jasongrout
Mar 26 2015 15:47
sorry; type t
Jonathan Frederic
@jdfreder
Mar 26 2015 15:47
Because searching util.js brought up 7 files, none of which were util.js
Jason Grout
@jasongrout
Mar 26 2015 15:47
I searched for wait_for_widget
Jonathan Frederic
@jdfreder
Mar 26 2015 15:47
(which is uniquely named in our codebase)
ah
Jason Grout
@jasongrout
Mar 26 2015 15:48
but yeah, if you know the file name, then type t, then util.js
Jonathan Frederic
@jdfreder
Mar 26 2015 15:48
neat - just tried it
Jason Grout
@jasongrout
Mar 26 2015 15:49
type ? to see other keyboard shortcuts
This message was deleted
Jonathan Frederic
@jdfreder
Mar 26 2015 15:50
Interesting, t doesn't show on the keyboard shortcut screen
Jason Grout
@jasongrout
Mar 26 2015 15:50
yes it does, for me, at the bottom
Jonathan Frederic
@jdfreder
Mar 26 2015 15:51
Ah "show all"
: P
Jonathan Frederic
@jdfreder
Mar 26 2015 15:51
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
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
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
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
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
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
okay
I don't have any experience with Selenium
Jonathan Frederic
@jdfreder
Mar 26 2015 16:01
Me neither~
Jason Grout
@jasongrout
Mar 26 2015 16:01
I'm looking forward to writing tests in babel/Typescript
Jonathan Frederic
@jdfreder
Mar 26 2015 16:01
Yeah! - That too
Jason Grout
@jasongrout
Mar 26 2015 16:01
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
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
back
Michael Goerz
@goerz
Mar 26 2015 16:34
This message was deleted
Matthias Bussonnier
@Carreau
Mar 26 2015 17:23
@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
conda matplotlib doesn't depend on qt
So the easiest way is probably conda install matplotlib
Matthias Bussonnier
@Carreau
Mar 26 2015 17:26
Humm..... d does when I use conda BUILDPACK on heroku.
Min RK
@minrk
Mar 26 2015 17:27
Maybe it does on Linux. I just tested on OS X
Matthias Bussonnier
@Carreau
Mar 26 2015 17:27
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
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
hum... I'm sad it makes heroku buildpack too big.
herokku refuses it...
for ~4mb
Min RK
@minrk
Mar 26 2015 17:34
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
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
@jdfreder - one more question:
Jonathan Frederic
@jdfreder
Mar 26 2015 17:47
shoot
Jason Grout
@jasongrout
Mar 26 2015 17:47
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
I may, one sec...
Jason Grout
@jasongrout
Mar 26 2015 17:48
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
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
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
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
right, it is.
oh, hmm...
Jonathan Frederic
@jdfreder
Mar 26 2015 17:53
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
lol
Yeah
they aren't promises
just vanilla views
Jason Grout
@jasongrout
Mar 26 2015 17:54
oh, nice
Jonathan Frederic
@jdfreder
Mar 26 2015 17:54
; )
Jason Grout
@jasongrout
Mar 26 2015 17:54
so I just need to get the cell object somehow...
Jonathan Frederic
@jdfreder
Mar 26 2015 17:54
You have the index in the closure
Jason Grout
@jasongrout
Mar 26 2015 17:54
right, I have the index. hmmm...gotta find where to use it.
Jonathan Frederic
@jdfreder
Mar 26 2015 17:55
IPython.notebook.get_cell ?
I think that takes an index
Jason Grout
@jasongrout
Mar 26 2015 17:55
right, I guess that's what I'm seeing in the notebook tests.
Jonathan Frederic
@jdfreder
Mar 26 2015 17:55
or something named similarly to it..
Jason Grout
@jasongrout
Mar 26 2015 17:55
Thanks
Jonathan Frederic
@jdfreder
Mar 26 2015 17:55
np
Jason Grout
@jasongrout
Mar 26 2015 17:56
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
@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
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
Ah yes
Thank you for doing that : )
Jason Grout
@jasongrout
Mar 26 2015 18:27
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
@minrk are you around?
Min RK
@minrk
Mar 26 2015 18:31
@SylvainCorlay hi
Sylvain Corlay
@SylvainCorlay
Mar 26 2015 18:31
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
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
ok, I did not recall well
thanks
Min RK
@minrk
Mar 26 2015 18:32
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
yes, but over 2000 miles, there are some race conditions even with telepathy
Jonathan Frederic
@jdfreder
Mar 26 2015 18:41
lol
Sang Han
@jjangsangy
Mar 26 2015 19:25
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
@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
After discussion here with @jasongrout
Min RK
@minrk
Mar 26 2015 23:31
@SylvainCorlay It should reject everything all at once, right? Not just the conflicts.
Sylvain Corlay
@SylvainCorlay
Mar 26 2015 23:32
yes
do you have a minute?
Min RK
@minrk
Mar 26 2015 23:32
I will shortly. Finishing up a meeting right now.
Sylvain Corlay
@SylvainCorlay
Mar 26 2015 23:32
ok, cool, I will be here
Min RK
@minrk
Mar 26 2015 23:33
Is it a problem specifically for nesting? Is it okay for single calls?
Sylvain Corlay
@SylvainCorlay
Mar 26 2015 23:34
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
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

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
ah, ok
Sylvain Corlay
@SylvainCorlay
Mar 26 2015 23:36
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
ok, that's fine
Sylvain Corlay
@SylvainCorlay
Mar 26 2015 23:37
this could make the order unpredictable
Min RK
@minrk
Mar 26 2015 23:37
I don't think the notification order should be important
Sylvain Corlay
@SylvainCorlay
Mar 26 2015 23:37
(temporal order of notifications)
ok
Min RK
@minrk
Mar 26 2015 23:38
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
fair enough, I was just having reservations on changing the logic of your decorator.
thanks
Min RK
@minrk
Mar 26 2015 23:39
Ah, don't worry about that.