These are chat archives for ipython/ipython

18th
Sep 2014
epifanio
@epifanio
Sep 18 2014 00:01
Hi, do you know where can i find a favicon.ico for IPython ?
i guess this one http://ipython.org/_static/favicon.ico right ?
Thomas Kluyver
@takluyver
Sep 18 2014 00:04
that looks like it
epifanio
@epifanio
Sep 18 2014 00:05
i saw the discussion about the logo, i assume this url will not change soon, right ?
Thomas Kluyver
@takluyver
Sep 18 2014 00:06
not soon. There will be a different favicon for Jupyter soon, and we are hoping to redesign the IPython logo
don't rely on that URL for years, but it should be safe for weeks
Kyle Kelley
@rgbkrk
Sep 18 2014 05:39
Hey, it appears that the bootstrap alert classes don't work in ipython master
Worked in IPython 2.x
Kyle Kelley
@rgbkrk
Sep 18 2014 05:45
ah, needs a role too now
Kyle Kelley
@rgbkrk
Sep 18 2014 05:51
That's a bootstrap 3 thing
Sylvain Corlay
@SylvainCorlay
Sep 18 2014 15:08
I am trying to use the status_started.Kernel event
is it still a valid event?
Thomas Kluyver
@takluyver
Sep 18 2014 16:16
@SylvainCorlay I think it is, but from recent discussion, it may not fire when changing kernel with the language selector. There's a started.Session event that may be better
Sylvain Corlay
@SylvainCorlay
Sep 18 2014 16:19
It is not a general IPython event but an event triggered in IPython.notebook.events.
right?
Thomas Kluyver
@takluyver
Sep 18 2014 16:21
Sorry, I don't understand the distinction you're asking about
Sylvain Corlay
@SylvainCorlay
Sep 18 2014 16:22
There is IPython.events which triggers app_initialized.NotebookApp
IPython.notebook.events which triggers started.Session
it seems that when started.Session is fired, Codecell.kernel can still be null. Hence I really need a kernel started event.
Thomas Kluyver
@takluyver
Sep 18 2014 16:25
I think those events objects are different names for the same thing
I don't know which events are right for what - someone else will need to jump in on that
Sylvain Corlay
@SylvainCorlay
Sep 18 2014 16:33
thanks, I am just trying to figure out why status_started.Kernel never gets triggered
I am getting started.Session
Thomas Kluyver
@takluyver
Sep 18 2014 16:39
a session is a kernel associated with a notebook - we start a session, we don't directly start a kernel
Sylvain Corlay
@SylvainCorlay
Sep 18 2014 16:47
ok, status_started.Kernel is an event of the notification area
Thomas Kluyver
@takluyver
Sep 18 2014 16:49
I'm pretty sure there's just one global events object, wherever it's accessed
Sylvain Corlay
@SylvainCorlay
Sep 18 2014 16:53
OK, I think that I figured out the issue. started.Session is triggered before the kernel is created.
https://github.com/ipython/ipython/blob/f98e5939d5cff1b98b4fd9260083385919383d12/IPython/html/static/services/sessions/js/session.js#L107
calls _kernel_started which does not trigger any event.
Thomas Kluyver
@takluyver
Sep 18 2014 16:55
It looks like the kernel started event is only triggered when all websockets are connected
Maybe changing the kernel doesn't reopen the websockets - it's still talking to the same server, after all
Sylvain Corlay
@SylvainCorlay
Sep 18 2014 16:55
it is fine with me, just that the kernel started is an event of the kernel, and I cannot register to event from the kernel if I don' t have a kernel !
Thomas Kluyver
@takluyver
Sep 18 2014 16:57
again, there is just one events object
wherever you access it, you should be able to register for any events
Sylvain Corlay
@SylvainCorlay
Sep 18 2014 16:57
in kernel.js : this.events = notebook.events;
Thomas Kluyver
@takluyver
Sep 18 2014 16:58
exactly
we plan to clean it up so everything uses one name, but it looks like we haven't got to that yet
Jonathan Frederic
@jdfreder
Sep 18 2014 16:59
meeting today?
It's thursday right?
Min RK
@minrk
Sep 18 2014 16:59
yup, getting set up now
Missing B & F today, so probably a quick one.
Jessica B. Hamrick
@jhamrick
Sep 18 2014 17:00
Ack, it’s thursday already?! :)
Jonathan Frederic
@jdfreder
Sep 18 2014 17:00
I don't have anything to share myself, so I'm okay with that :)
Matthias Bussonnier
@Carreau
Sep 18 2014 17:01
too many meeting, we loose track of time :-)
Sylvain Corlay
@SylvainCorlay
Sep 18 2014 17:02
ok, thanks thomas. for some reason, not catching status_started.Kernel but catching started.Session.
Sylvain Corlay
@SylvainCorlay
Sep 18 2014 17:09
The function triggering the Kernel Started event is _ws_opened, which assigned to onopen for each one of the WebSockets.
Kyle Kelley
@rgbkrk
Sep 18 2014 17:10
ipython/ipython#6480
Matthias Bussonnier
@Carreau
Sep 18 2014 17:12
sorry random add that went through pop up blocker.
Sylvain Corlay
@SylvainCorlay
Sep 18 2014 17:19
@takluyver actually, it is just that in _ws_opened, it never gets to the line where the event is triggered
All the channels ready state are "open"
yeah ok, == has to be changed to !=
Thomas Kluyver
@takluyver
Sep 18 2014 17:26
OK
Sylvain Corlay
@SylvainCorlay
Sep 18 2014 17:27
opened a mini pr, sorry for the noise
Kyle Kelley
@rgbkrk
Sep 18 2014 17:27
Brian was hoping we would hold a g+ hangout later for tmpnb / the demo server, though of course Matthias wants to get to bed at some point
Damian Avila
@damianavila
Sep 18 2014 17:27
Not able to join today... have a good meeting!
Matthias Bussonnier
@Carreau
Sep 18 2014 17:27
Sorry I'm not good at improvising talks :-)
Sylvain Corlay
@SylvainCorlay
Sep 18 2014 17:28
some other code in the notification area was depending on that event, and thus not called, I hope that it will not break anything,
This message was deleted
Jason Grout
@jasongrout
Sep 18 2014 17:32
github now has split diffs! Nice!
Damian Avila
@damianavila
Sep 18 2014 18:06
people any official way to get the notebook_dir from inside the notebook besides the pwd at the very beginning?
Thomas Kluyver
@takluyver
Sep 18 2014 18:08
no, because the kernel doesn't know about the notebook
Damian Avila
@damianavila
Sep 18 2014 18:14
I mean from the Python side... not the notebook itself... sorry to not be explicit...
something like profile_dir, but for the path where the server was started...
Thomas Kluyver
@takluyver
Sep 18 2014 18:18
which Python side? Something in the notebook server, or the user code running in the kernel?
Damian Avila
@damianavila
Sep 18 2014 18:26
user running code in the kernel...
although the notebook server seems a nice question too :smile:
Thomas Kluyver
@takluyver
Sep 18 2014 18:29
for user code running in the kernel, no, there isn't currently any official way to do that, for the reason I gave before
we're thinking about relaxing that separation a bit, but currently, the kernel doesn't know anything about the notebook
Jason Grout
@jasongrout
Sep 18 2014 18:32
@ellisonbg: re "With the new CSS traitlets, why not just build a dict of values and then pass them into all the widgets you want to style that way?" ... because not all css traits are exposed. And it's probably not right to expose all of them at the top level of the widget namespace because (1) it clutters the namespace, and (2) many attributes may not map very well to other display systems. Having a .css attribute, for example, lets you expose all valid css traits. Though even then, that technically varies by browser for esoteric traits.
Damian Avila
@damianavila
Sep 18 2014 18:39
and from the notebook server??
btw, I agree on the relaxing... from several different request I always get them the same answer... jaja, and then I have to do crazy things, which is fun... but make my work easier, people ja ja ja...
Brian E. Granger
@ellisonbg
Sep 18 2014 18:58
Hi folks - I don't view the new attributes as CSS attributes - they are "Style" attributes that are (or should be) semantic and can be implemented by any frontend
We nee to review them to amke sure they are semantic and overly tied to CSS
Jonathan Frederic
@jdfreder
Sep 18 2014 18:59
@jasongrout I think those arguments are valid, but I think we could address them by adding appropriate mixin classes
@ellisonbg I agree
Brian E. Granger
@ellisonbg
Sep 18 2014 19:00
@all - I am online some today and can help review/discuss if needed
Did you have a dev meeting?
Jonathan Frederic
@jdfreder
Sep 18 2014 19:00
Yes, it was short
Kyle Kelley
@rgbkrk
Sep 18 2014 19:00
yup, we had a dev meeting
Jonathan Frederic
@jdfreder
Sep 18 2014 19:00
@ellisonbg there still is a problem with traits like "color" existing for widgets like Image.
Do you think it would make sense to have mix in classes for different sets of traits
Like a FontStylable
Brian E. Granger
@ellisonbg
Sep 18 2014 19:01
Yes, but then maybe that should be on a different subclass?
Jonathan Frederic
@jdfreder
Sep 18 2014 19:01
which could have font-family, color, etc...
Brian E. Granger
@ellisonbg
Sep 18 2014 19:02
I read through the hackpad = any else I should know from the meeting?
Jonathan Frederic
@jdfreder
Sep 18 2014 19:02
Not that I'm aware of.
Brian E. Granger
@ellisonbg
Sep 18 2014 19:02
Good semantic style attributes will definitely require a better class hierarchy than we currently have
OK
Jonathan Frederic
@jdfreder
Sep 18 2014 19:03
I don't know if you saw, but I made the changes to the ScrollManager PR
Brian E. Granger
@ellisonbg
Sep 18 2014 19:03
I see that #6463 is still marked as "Needs Decision"?
OK I will review that
Jonathan Frederic
@jdfreder
Sep 18 2014 19:04
I think everyone is okay with on_atomic_change...
@jasongrout still prefers on_change with good docs
but said he was okay with atomic
so I think it just needs to be merged at this point
Brian E. Granger
@ellisonbg
Sep 18 2014 19:07
Is it implemented currently as on_atomic_change?
What is the Python API for the context manager?
Jonathan Frederic
@jdfreder
Sep 18 2014 19:07
Yes
Same PR? Are you asking about this?:
wid = TestWidget()
display(wid)
with wid.hold_sync():
    wid.a = True
    wid.b = True
Brian E. Granger
@ellisonbg
Sep 18 2014 19:09
Ahh, yes, thanks - I like the on_atomic_change, but also like the hold_sync - what if we unify the names
?
A bit confusing to have the two sides called something completely different no?
Sylvain Corlay
@SylvainCorlay
Sep 18 2014 19:09
The hold_sync context manager is already in master.
Brian E. Granger
@ellisonbg
Sep 18 2014 19:09
What about hold_sync and on_hold_sync?
Can on_atomic_change every be called without hold_sync?
Sylvain Corlay
@SylvainCorlay
Sep 18 2014 19:10
In render.
Jonathan Frederic
@jdfreder
Sep 18 2014 19:10
We could rename hold_sync
to atomic_sync
or use on_hold_update
or on_held_update
Sylvain Corlay
@SylvainCorlay
Sep 18 2014 19:11
It can be called on the creation of the widget if registered in initialize.
Hum not in render but I mean called on instantiation of the widget.
I am not sure that is has to be linked with hold_sync.
Jason Grout
@jasongrout
Sep 18 2014 19:18
hold_sync and on_atomic_change work well together, but really they are two separate things.
I wouldn't be opposed to making it atomic_sync, though.
I don't think it should be atomic_change if the traitlet handlers are still firing, though.
Sylvain Corlay
@SylvainCorlay
Sep 18 2014 19:32
Simultaneous updates of attributes can happen in initialization and maybe other situations that with hold_sync.
Jason Grout
@jasongrout
Sep 18 2014 20:12
Is there a reason why the notebook, cell, and other objects have an events member, rather than just allowing events on the objects themselves (i.e., cell.on(), instead of cell.events.on() )?
Jonathan Frederic
@jdfreder
Sep 18 2014 20:13
I think it just allows global events
Since we use it for global events, we've just stuck to using it for everything
But some (maybe a lot of) events are probably better using the pattern you suggest.
Jason Grout
@jasongrout
Sep 18 2014 20:21
yeah, I'm realizing that the IPython.notebook.events, the cell object .events, and the global events is all the same object
but it seems a little more elegant to have $(IPython.notebook).on(...), $(some_cell).on(...), etc.
Sylvain Corlay
@SylvainCorlay
Sep 18 2014 20:23
Ok are you guys merging the bulk updates?
Jason Grout
@jasongrout
Sep 18 2014 20:25
Well, at least I can try out adding events to objects like this, just to see how it works out.
Sylvain Corlay
@SylvainCorlay
Sep 18 2014 22:06
@takluyver as you are working on the requirejs pR, I just put an idea I had for a python-side widget registry in PR #6493. The implementation is clearly not final, but I would be interested in your thoughts about it.
btw Do one get notifications from gitter when one is mentioned in a room?
Jonathan Frederic
@jdfreder
Sep 18 2014 22:08
Hey @SylvainCorlay I don't have a problem merging it, but @ellisonbg never said he was fine with the name.
Sylvain Corlay
@SylvainCorlay
Sep 18 2014 22:10
ok
Thomas Kluyver
@takluyver
Sep 18 2014 22:20
Hi @SylvainCorlay I wonder if we should have a similar mechanism to allow the frontend to specify a Python module from which to load a widget clas
s
obviously other kernels will want to implement widgets too, but there will no doubt be some Python specific ones, just like there will be some HTML+JS specific ones on the frontend
Jonathan Frederic
@jdfreder
Sep 18 2014 22:21
I think the only thing missing from his implementation is the logic that tries to Python import the module if it's not in the Python registry, right @SylvainCorlay ?
Sylvain Corlay
@SylvainCorlay
Sep 18 2014 22:22
Yes. In the widget registry, I was wondering if I should specify a key (potentially language-agnostic) or use the class name (with all the path)
In the latter case, we could just use a python set for the registry and send the class name as strings so that it is serializable.
Thomas Kluyver
@takluyver
Sep 18 2014 22:23
the nice thing about the full import path is that the other side can create a widget pair without having to get something loaded on the other end beforehand
Jonathan Frederic
@jdfreder
Sep 18 2014 22:23
Or you could do both, right? Try the key first, and if it isn't found try importing it as-if it's a namespace.
Sylvain Corlay
@SylvainCorlay
Sep 18 2014 22:23
The other problem is that we already have instances of widgets which have both same view and model names but are actually different. (They inherit from each other without overloading the view and model name)
in this case, a js model/view pair would not know which python side class to use in the registry
Jonathan Frederic
@jdfreder
Sep 18 2014 22:24
i.e. the IntSliderView, right?
has both IntSlider and IntRangeSlider in the backend
We could make the key a callback
Sylvain Corlay
@SylvainCorlay
Sep 18 2014 22:25
yeah good example,
Jonathan Frederic
@jdfreder
Sep 18 2014 22:25
and then the view could perform custom logic
i.e. for the slider, it's easy enough to know where or not it's a range instead of a single value
Sylvain Corlay
@SylvainCorlay
Sep 18 2014 22:26
Imagine two sliders implementing a different validation in the python side.
I inherit from slider and implement my own
you need to make a choice of which one to instantiate if you initiate from the javascript
Jonathan Frederic
@jdfreder
Sep 18 2014 22:28
That's the same thing, a callback would work for that
Sylvain Corlay
@SylvainCorlay
Sep 18 2014 22:28
what do you mean?
Jonathan Frederic
@jdfreder
Sep 18 2014 22:30
I mean,
key: function(){ 
    if (A) {
        return 'Slider1';
    } else {
        return 'Slider2';
    }
};
If you implement your own, it's your responsibility to have a view
that knows how to create your slider
even if the view just overrides the key function and adds no additional logic to the view it inherits from
key: function(){ 
    if (A) {
        return 'CustomSlider1';
    } else {
        return this.super.key() //call base;
    }
};
Sylvain Corlay
@SylvainCorlay
Sep 18 2014 22:33
ok, we are on the same page
Jonathan Frederic
@jdfreder
Sep 18 2014 22:33
Sorry
I realized my first example wasn't conveying the full picture
Sylvain Corlay
@SylvainCorlay
Sep 18 2014 22:33
then the only question is what to use as the key in the registry and I will make a more decent implementation
Jonathan Frederic
@jdfreder
Sep 18 2014 22:34
Well can't we just model it the same way we deal with the registry in @takluyver 's PR
Have a dict of keys & classes, if the key isn't there, assume it's some sort of namespace the language could load
in the Python case, it would be blah.blah.module.classname
For the Jupyter shipped widgets, we'd use the registry so we could be back-end language agnostic
Sylvain Corlay
@SylvainCorlay
Sep 18 2014 22:37
other question. The Python to JavaScript loads the js path. Should the JavaScript to Python import the python module?
This sounds like something evil.
Jonathan Frederic
@jdfreder
Sep 18 2014 22:37
haha yeah, but yes, that's what I was suggesting
but only if it's not found in the explicit registry
Sylvain Corlay
@SylvainCorlay
Sep 18 2014 22:39
Ok. I will add meaningful keys in the case of Jupyter core widgets.
And have my decorator use the (full) class name when none is provided.