These are chat archives for ipython/ipython

9th
Oct 2014
Brian E. Granger
@ellisonbg
Oct 09 2014 00:11
@takluyver and @jdfreder could you summarize the main discussion points about the two PRs that are open for the widget registry to use require.js in the hackpad?
Not the python side registry, but the PRs of @takluyver and @SylvainCorlay
Jonathan Frederic
@jdfreder
Oct 09 2014 00:23
sure
Thomas Kluyver
@takluyver
Oct 09 2014 00:24
I've had a go at summarising them
Brian E. Granger
@ellisonbg
Oct 09 2014 00:29
Thanks :)
Jonathan Frederic
@jdfreder
Oct 09 2014 00:37
@takluyver @SylvainCorlay I've tried to list the pros and cons of both, but you two would probably be better at arguing for your own work :)
Sylvain Corlay
@SylvainCorlay
Oct 09 2014 01:16
hey
we could have a hangout on this tomorrow.
@ellisonbg btw, on a loosely related subject why not Jupyter as a namespace in the Python-side registry?
It is the name by which the backend implementation "module" of a widget is referred to from the frontend.
Sylvain Corlay
@SylvainCorlay
Oct 09 2014 01:47

...
Back to the requirejs registry,

0) There is a big common point between thomas's pr and the other proposal: people using the "create_child_view" function will all have to change their widget code (in the same way for both cases).
1) In thomas's pr, the use of requirejs module name's are not yet supported for models, only for views. If you were to adopt his proposal, I think that it should be done for both at once to avoid the pain of changing client code in multiple iterations. Besides, we are really fond of the ability to overload models, and the extension points for extending models are as important as the ones for extending views.
2) In my case, there is an additional "registration" step, the RequireJS module name does not make it into the Python widget class. This contains abstraction leaking. The same usual widget registry is used. This registration step triggers the loading of the frontend implementation.
3) In my case, the requirejs modules (for models and views) are loaded via this registration mechanism rather than at display time. I like the symmetry of loading the front-end implementation when you load the backend implementation, not at first use.

Jonathan Frederic
@jdfreder
Oct 09 2014 01:57
nice 0 based list
reading..
Jonathan Frederic
@jdfreder
Oct 09 2014 02:02
It looks like we got them, but can you check to make sure they span the range of what you're saying here?
@SylvainCorlay
Jonathan Frederic
@jdfreder
Oct 09 2014 04:02
@minrk do you know how to trigger Travis on a commit that it hasn't run on?
i.e. I've pushed two commits, by default only the second is tested. How do I tell GH&Travis to test the first one?
Min RK
@minrk
Oct 09 2014 04:03
push the same commit to another branch, I think
Jonathan Frederic
@jdfreder
Oct 09 2014 04:04
ahh ok I'll give that a test
tkx
Andreas Klostermann
@akloster
Oct 09 2014 09:46
I watched some of the lab meeting on youtube, and one of the developers was afraid that IPython is developing a whole application framework, with state saving and the like... Well... We're waaay beyond that already..... For example I have managed to integrate Django Forms into the notebook
Sylvain Corlay
@SylvainCorlay
Oct 09 2014 14:20
Hello, is there any blocking point to upgrade font-awesome to 4.2 ?
Matthias Bussonnier
@Carreau
Oct 09 2014 14:46
@SylvainCorlay I guess we can, what's new on 4.2 ?
Kyle Kelley
@rgbkrk
Oct 09 2014 14:48
@akloster Do you have a demo of that?
Sylvain Corlay
@SylvainCorlay
Oct 09 2014 14:50
@Carreau Some cool charts icons
Matthias Bussonnier
@Carreau
Oct 09 2014 14:50
ok, no big changes.
I suppose I smell a PR :-)
Sylvain Corlay
@SylvainCorlay
Oct 09 2014 14:51
Do you want me to do this?
Matthias Bussonnier
@Carreau
Oct 09 2014 14:52
If you like.
I suppose it can maybe even go into 2.4
I don't remember if 2.x was font awesome 4.
Sylvain Corlay
@SylvainCorlay
Oct 09 2014 14:53
it does not matter for me. I am fine with changing the bower and all. Just thought that this is not the kind of stuff that non-core devs could touch.
Kyle Kelley
@rgbkrk
Oct 09 2014 14:54
I think we're all open to yak shaving
Just opposed to mass refactorings using automated code checkers.
Sylvain Corlay
@SylvainCorlay
Oct 09 2014 14:56
My vim refuses to save a file that is not pep8. I must desactivate it when changing core IPython files :)
Kyle Kelley
@rgbkrk
Oct 09 2014 14:57
yeah...
I run into the same thing when making PRs against ipython/ipython proper
Every other project I work on is strict about most pep8 compliance
Sylvain Corlay
@SylvainCorlay
Oct 09 2014 14:57
Although this checker is really dumb and considers that imports in __init__.py are unused...
Kyle Kelley
@rgbkrk
Oct 09 2014 14:58
That's lame
Technically true
It's all unused until run
Matthias Bussonnier
@Carreau
Oct 09 2014 14:58
Yeah, some time this happen to me to.
Kyle Kelley
@rgbkrk
Oct 09 2014 14:59
init of course is the silliest case
Matthias Bussonnier
@Carreau
Oct 09 2014 14:59
I like the new pep8radar, that slowly uniformise code.
but only the code you changed.
Sylvain Corlay
@SylvainCorlay
Oct 09 2014 14:59
I should try that.
although now that I have a vimrc+bashrc that works, not very eager to modify it
Matthias Bussonnier
@Carreau
Oct 09 2014 15:00
:-)
I think there might even be a way to ask travis to check pep8 only on new code since last merge. So we would be certain that new code is pep8.
Andreas Klostermann
@akloster
Oct 09 2014 15:02
Kyle Kelley
@rgbkrk
Oct 09 2014 15:08
@akloster cool
No widget there of course
but it was nice to read
see what you're up to
Andreas Klostermann
@akloster
Oct 09 2014 15:10
I'm using a widget there
Jonathan Frederic
@jdfreder
Oct 09 2014 15:14
@minrk just as an FYI, pushing the commit to a separate branch alone didn't trigger GH/Travis, I had to open a PR with that branch to get it to trigger (and the results rendered in both PRs that had the commit).
Min RK
@minrk
Oct 09 2014 16:19
@jdfreder ah, that's probably because you don't have Travis set up on your fork. If you do, you can test your own branches without a PR.
Sylvain Corlay
@SylvainCorlay
Oct 09 2014 16:45
hey, fab update actually also updates some things in bower modules for which I have not modified anything, and also changes the git paths from git to https, is it expected?
Matthias Bussonnier
@Carreau
Oct 09 2014 16:49
hum, no I don't think it is is expected.
Sylvain Corlay
@SylvainCorlay
Oct 09 2014 16:49
it is not human generated
Matthias Bussonnier
@Carreau
Oct 09 2014 16:50
ah, I don't thing we fab-update usually, we just bower install --save to update component individually.
cause in your PR, you also update backbone and jquery
Sylvain Corlay
@SylvainCorlay
Oct 09 2014 16:51
ok
Matthias Bussonnier
@Carreau
Oct 09 2014 16:51
at least that's what I do.
Sylvain Corlay
@SylvainCorlay
Oct 09 2014 16:53
ok, let me reset and redo that commit
thanks
Jessica B. Hamrick
@jhamrick
Oct 09 2014 16:59
Good morning! Or evening, for @Carreau
Jonathan Frederic
@jdfreder
Oct 09 2014 17:00
I hear something ringing
somewhere...
Fernando Perez
@fperez
Oct 09 2014 17:01
hi all..
Jonathan Frederic
@jdfreder
Oct 09 2014 17:01
lol
Fernando Perez
@fperez
Oct 09 2014 17:01
url somewhere?
or an invite?
Jonathan Frederic
@jdfreder
Oct 09 2014 17:01
+1 for a url
Matthias Bussonnier
@Carreau
Oct 09 2014 17:01
hey @jhamrick hope you had a good night :-)
Jason Grout
@jasongrout
Oct 09 2014 17:02
all right. I should go pop some popcorn for the show :)
Damian Avila
@damianavila
Oct 09 2014 17:04
wow... it is full
I guess, you have to be quickly right now... je...
Jason Grout
@jasongrout
Oct 09 2014 17:05
youtube link?
Jason Grout
@jasongrout
Oct 09 2014 17:08
Sylvain is coming to join in a few minutes
and it doesn't have to be our file structure. Using require, we can map any path to any other path
using aliases
Sylvain is getting on in a minute or two.
he has to go to another room to use his laptop
@ellisonbg...
Kyle Kelley
@rgbkrk
Oct 09 2014 17:11
How about I hop out during Widget discussions
Later stuff is more for me
I like knowing, but I can watch on YouTube for that section
Matthias Bussonnier
@Carreau
Oct 09 2014 17:11
I'LL PING YOU
Kyle Kelley
@rgbkrk
Oct 09 2014 17:11
k
Jason Grout
@jasongrout
Oct 09 2014 17:11
I'm not decided which approach I like better. Sylvain should be on any minute now.
Brian E. Granger
@ellisonbg
Oct 09 2014 17:12
We will let you know when we are talking about the plushy
Kyle Kelley
@rgbkrk
Oct 09 2014 17:12
lol
Theres some latency with the actual live feed. I watched myself for 30 seconds
Sylvain Corlay
@SylvainCorlay
Oct 09 2014 17:13
hello, we still cannot connect
not your fault
Kyle Kelley
@rgbkrk
Oct 09 2014 17:15
well, 8
Sylvain Corlay
@SylvainCorlay
Oct 09 2014 17:15
bloomberg' s firewall
Matthias Bussonnier
@Carreau
Oct 09 2014 17:15
ssh tunnel ?
Kyle Kelley
@rgbkrk
Oct 09 2014 17:15
Starbucks for dev meetings
Brian E. Granger
@ellisonbg
Oct 09 2014 17:17
There is a Starbucks about 2 blocks down Lexington :)
Sylvain Corlay
@SylvainCorlay
Oct 09 2014 17:17
besides it handles models
Jason Grout
@jasongrout
Oct 09 2014 17:18
Having control on the custom.js means you can also load a specific set of widgets from there.
Sylvain Corlay
@SylvainCorlay
Oct 09 2014 17:18
if you were to use the approach of thomas it would need to support models
Matthias Bussonnier
@Carreau
Oct 09 2014 17:18
@rgbkrk design part.
Jonathan Frederic
@jdfreder
Oct 09 2014 17:19
@SylvainCorlay if you connect we can revisit the discussion. Maybe try connecting with your phone?
Via the google hangouts app
I don't know if it supports this though... but worth a try.
Jason Grout
@jasongrout
Oct 09 2014 17:27
I'm readonly for now
Jonathan Frederic
@jdfreder
Oct 09 2014 17:28
battery about to die, brb need to get charger!!
Brian E. Granger
@ellisonbg
Oct 09 2014 17:28
ok
Jonathan Frederic
@jdfreder
Oct 09 2014 17:30
ipython/ipython#6665
Should make it easier !!
Jason Grout
@jasongrout
Oct 09 2014 17:32
+1 to having views and model requirejs changes in the same pr
Jason Grout
@jasongrout
Oct 09 2014 17:45
I think Brian has a really good point that some things might crop up when doing model requirejs loading that may influence the view requirejs pr
Matthias Bussonnier
@Carreau
Oct 09 2014 17:46
@rgbkrk did PAckt contacted you ?
Brian E. Granger
@ellisonbg
Oct 09 2014 17:47
me?
Ahh, doh
I can't read
Jonathan Frederic
@jdfreder
Oct 09 2014 17:48
Just to clarify @SylvainCorlay , there isn't anything you can't do with @takluyver 's implementation, other than choosing to load time for the front-end widgets, right?
Matthias Bussonnier
@Carreau
Oct 09 2014 17:50
No, Pack was supposed to give some of Cyrile books for MozFest.
Jason Grout
@jasongrout
Oct 09 2014 17:55
@takluyver - I'm curious if you've looked at how William Stein implemented the terminal in SageMathCloud. Are you using a drastically different thing?
(oh, I guess Fernando asked basically the same.)
Brian E. Granger
@ellisonbg
Oct 09 2014 18:00
It is the same term.js code
But we are using a python/tornado backend, he is using node.js
Andreas Klostermann
@akloster
Oct 09 2014 18:01
I'd like to create a %%coffeescript magic
Jason Grout
@jasongrout
Oct 09 2014 18:03
is there a way to ask Google for a bigger allocation of hangout slots?
Jonathan Frederic
@jdfreder
Oct 09 2014 18:10
@minrk @minrk @minrk #6665 passed !
Matthias Bussonnier
@Carreau
Oct 09 2014 18:10
:-P
Jonathan Frederic
@jdfreder
Oct 09 2014 18:10
(with the changes, merge?)
Sylvain Corlay
@SylvainCorlay
Oct 09 2014 18:13
@jdfreder I did not see your question on what it does not allow.
I think that Thomas nailed it when he mentioned the problem of reloading modules on page reload.
The only think that it would "not allow" is specify different module path for different frontend, which is solved by having a separate registry. A solution could be, rather than being a string, the _view_module could be dict.
@takluyver
Jonathan Frederic
@jdfreder
Oct 09 2014 18:14
ah got it
Kyle Kelley
@rgbkrk
Oct 09 2014 18:17
@Carreau Packt has not reached me at all
Matthias Bussonnier
@Carreau
Oct 09 2014 18:17
:rage: Not good from them.
Kyle Kelley
@rgbkrk
Oct 09 2014 18:17
O'Reilly now has my :heart:
;)
Matthias Bussonnier
@Carreau
Oct 09 2014 18:18
:-)
called docker.
Matthias Bussonnier
@Carreau
Oct 09 2014 18:27
can't we just finish the two last points ?
Nicholas Bollweg
@bollwyvl
Oct 09 2014 18:27
@akloster %%coffeescript
it's slow :(
Sylvain Corlay
@SylvainCorlay
Oct 09 2014 18:29
@minrk : @Carreau 's PR on codemirror is alreadu merged in components
but not in IPython
Matthias Bussonnier
@Carreau
Oct 09 2014 18:30
Yep, there is just a branch
Sylvain Corlay
@SylvainCorlay
Oct 09 2014 18:30
it is in master in componenets
hence, I cannot open a PR to component that would not incorporate these commits
Matthias Bussonnier
@Carreau
Oct 09 2014 18:31
yes, it was merged long ago
you can, just temporarily checkout an old version of coponent.
Sylvain Corlay
@SylvainCorlay
Oct 09 2014 18:31
Yes, but my PR will conflict
Matthias Bussonnier
@Carreau
Oct 09 2014 18:32
Oh, you mean a PR against IPython ?
there are a few wainting for codemirror one to be merged. hence the please test at the end of the meeting, cause it's blocking.
Sylvain Corlay
@SylvainCorlay
Oct 09 2014 18:33
no, what I mean is that to update fontawesome, I need to upodate it in components. But there, you have already merged the upgrade of codemirror
I don't want to put it on top of your change
because when updating the submodule commit number in IPython, this will require your IPython PR to be merged
Matthias Bussonnier
@Carreau
Oct 09 2014 18:35
Yes, and there are a few PR waiting for ipython/ipython#6221 to be merged. Hence the request to try this soon for it to be merged quickly
Jonathan Frederic
@jdfreder
Oct 09 2014 18:35
:+1:
Sylvain Corlay
@SylvainCorlay
Oct 09 2014 18:35
what is holding it ?
Matthias Bussonnier
@Carreau
Oct 09 2014 18:36
@jdfreder tags PR also needs mine to to be merged too.
Just testing, people need to grab it, play for a day and report bugs
Sylvain Corlay
@SylvainCorlay
Oct 09 2014 18:36
ok
Matthias Bussonnier
@Carreau
Oct 09 2014 18:36
like can't complete, shfit tabs select previous cell
hitting alt twice get deamon out of my nose
alt-shift-l eat my laundry.
Sylvain Corlay
@SylvainCorlay
Oct 09 2014 18:38
ok, if there was any blocking point, we could have reverted the changes in components/master, make them in a separate branch of the main repo, components/bookmark, (so that the revision is in the tree) and let other simpler PRs depending on updating other components to be merged.
You see what I mean?
Jonathan Frederic
@jdfreder
Oct 09 2014 18:47
Yeah, I think the intention was for it to be merged before any other components PRs were opened, but everyone got distracted to the main PR didn't get merged.
Sylvain Corlay
@SylvainCorlay
Oct 09 2014 18:49
ok, min replied in the PR. Thanks. It is a good motivation for me to test the codemirror update :smile:
Min RK
@minrk
Oct 09 2014 18:50
Also, components PRs are super rare, so we didn't expect it to be an issue...There just happened to be 4 this week.
Just puts pressure on to finish the CM4 PR, which we should do anyway.
Andreas Klostermann
@akloster
Oct 09 2014 19:12
is there any interest in putting a %%coffeescript cell magic into ipython notebook?
I am writing a simple asset manager for third party libraries, so I'll probably write that magic myself, it would just be nice to know if there are such plans
my current code can load coffeescript files into the notebook and correctly configure the source-mapping for chrome dev tools.... which is all kinds of useful in widget development
Thomas Kluyver
@takluyver
Oct 09 2014 19:17
@akloster I think we'd encourage you to offer it as an extension, rather than trying to get it into IPython core
we're trying to keep as few things like that as practical in core IPython, while making it as easy as possible to use them as extensions
Andreas Klostermann
@akloster
Oct 09 2014 19:18
yes, that sounds ok
Thomas Kluyver
@takluyver
Oct 09 2014 19:19
great :)
we have an extensions index on the wiki that you're welcome to add it to, and there's a 'Framework :: IPython' classifier you can use if you make a PyPI package forit
Andreas Klostermann
@akloster
Oct 09 2014 19:20
yes
Thomas Kluyver
@takluyver
Oct 09 2014 19:20
I see there's already a brython magic in a similar vein
Andreas Klostermann
@akloster
Oct 09 2014 19:23
I was experimenting with IPython widgets a lot in the past few weeks, and putting javascript code into the python source code is just a mess...
and the existing python asset frameworks don't seem to mix well with ipython, so I am trying to work out something better
Jonathan Frederic
@jdfreder
Oct 09 2014 19:24
That would be great!
Thomas Kluyver
@takluyver
Oct 09 2014 19:24
cool
Jason Grout
@jasongrout
Oct 09 2014 19:24
@jdfreder: I'm about to work on having multiple kinds of children. Any thoughts you want to share before I dive in?
Thomas Kluyver
@takluyver
Oct 09 2014 19:25
we're also working on better ways to get JS loaded. See PR #6494
Jason Grout
@jasongrout
Oct 09 2014 19:25
multiple kinds of children views in widgets, i.e., you have multiple lists, and can independently keep track of each list of children
What does "nbextensions" mean? Are these extensions to be installed into the profile directory, or modules to be loaded by notebook scripts inside the kernel?
Thomas Kluyver
@takluyver
Oct 09 2014 19:29
nbextensions are pure client side extensions (i.e. JS and CSS)
Andreas Klostermann
@akloster
Oct 09 2014 19:29
I currently prefer to put widgets in the third party libraries and importing these in a notebook, instead of having external extensions that have to be installed to the user's profile to work. For example the livereveal.js
ah ok
Thomas Kluyver
@takluyver
Oct 09 2014 19:29
they're installed into the profile directory, and (for now) loaded by a custom.js file - but we plan to make better ways to load them
Andreas Klostermann
@akloster
Oct 09 2014 19:29
no livereveal.js, I meant damian avila's live_reveal
Jason Grout
@jasongrout
Oct 09 2014 19:30
@akloster: looks like you too want a way to save the state of the widgets in a notebook format so that nbviewer can use it.
Thomas Kluyver
@takluyver
Oct 09 2014 19:30
things like livereveal should be nbextensions, so that they can work independently of the kernel language
Andreas Klostermann
@akloster
Oct 09 2014 19:30
@jasongrout yes, but I wasn't referring to that
Jason Grout
@jasongrout
Oct 09 2014 19:30
but it looks like you save the state by explicitly constructing script tags, rather than saving it in the notebook metadata?
(I know---I just finished reading your PyMCMC notebook and am starting a new topic...)
Thomas Kluyver
@takluyver
Oct 09 2014 19:30
things like third party widgets are likely to be Python packages which load JS files (which may themselves be nbextensions)
Andreas Klostermann
@akloster
Oct 09 2014 19:30
ah ok, sorry, yes I tried that
but nbviewer doesn't pick it up
in that particular case I would like to show the last frame of the animation, and it works when opening the notebook
Jason Grout
@jasongrout
Oct 09 2014 19:31
Does nbviewer execute arbitrary script tags embedded in the notebook? That would seem to be a security problem, maybe
when you open the notebook, it's a trusted notebook, right?
Andreas Klostermann
@akloster
Oct 09 2014 19:32
yes
Jason Grout
@jasongrout
Oct 09 2014 19:32
I bet if you open the notebook as an untrusted notebook, it won't work.
Andreas Klostermann
@akloster
Oct 09 2014 19:33
but actually for nbviewer there are no security concerns because it doesn't talk back to a python kernel
Thomas Kluyver
@takluyver
Oct 09 2014 19:33
nbviewer does run script tags - it's untrusted content, but it's an untrusted domain, so that's OK
Jason Grout
@jasongrout
Oct 09 2014 19:33
ah, right.
and no authentication credentials to steal, etc.
Andreas Klostermann
@akloster
Oct 09 2014 19:33
bokeh without animations doesn't work without javascript execution itself
it would be nice if there was a clearer way to modify what is stored in the notebook file, both from javascript and from inside the kernel
Thomas Kluyver
@takluyver
Oct 09 2014 19:36
we are thinking about adding save/load hooks in the JS
doing it from the kernel is a bit trickier, because we want to keep the kernel knowing as little about the frontend as possible
Andreas Klostermann
@akloster
Oct 09 2014 19:39
one of my issues with how I understand this works currently is: The Python code needs to insert javascript code, for example for widgets, but this code is also passed into nbviewer, because it has to be in the output divs
and to me it seems notebook and nbviewer output are two very different things
and to me it seems notebook and nbviewer output are two very different things
Jonathan Frederic
@jdfreder
Oct 09 2014 19:42
@jasongrout I'm sorry, how does that differ from support for widget traitlet serialization (which we support now) ?
Jason Grout
@jasongrout
Oct 09 2014 19:43
For example, for pythreejs, I could distinguish between the children lights and the objects (that's a made-up example)
In other words, I want to have two different traitlets, each having a list of children. And then an easy way to do the do_diff to update each list of views independently
and then the Box.children attribute becomes just a special case of this.
So I'm thinking that each child widget is associated with a namespace, which basically is a list of children.
and then I can easily update that namespace of children as the trait is updated
Jonathan Frederic
@jdfreder
Oct 09 2014 19:45
But you can have two lists of children now... Basically you're just simplifying/automating the do_diff stuff?
Jason Grout
@jasongrout
Oct 09 2014 19:46
basically, and moving it up to widget.js
Jonathan Frederic
@jdfreder
Oct 09 2014 19:46
Ah
Jason Grout
@jasongrout
Oct 09 2014 19:46
no reason for Box to hog all the nice logic for updating children :)
Sylvain Corlay
@SylvainCorlay
Oct 09 2014 19:46
We already handle this kind of multiple children lists actually / but it is on an ad hoc basis.
Jason Grout
@jasongrout
Oct 09 2014 19:46
right---I want to make it a more general thing and part of the architecture.
Jonathan Frederic
@jdfreder
Oct 09 2014 19:47
So something like this:
Jason Grout
@jasongrout
Oct 09 2014 19:47
(I was just starting to do another ad-hoc handling of a list of children, and though, "What am I doing? This again?!")
Jonathan Frederic
@jdfreder
Oct 09 2014 19:50


        update_children: function(old_list, new_list) {
            // Called when the children list changes.
            this.do_diff(old_list, new_list, 
                $.proxy(this.remove_child_model, this),
                $.proxy(this.add_child_model, this));
        },

        remove_child_model: function(model) {
            // Called when a model is removed from the children list.
            this.pop_child_view(model).remove();
        },

        add_child_model: function(model) {
            // Called when a model is added to the children list.
            var view = this.create_child_view(model);
            this.$box.append(view.$el);

            // Trigger the displayed event of the child view.
            this.after_displayed(function() {
                view.trigger('displayed');
            });
        },
converted to this

        _handle_children_remove: function(view) {
            // Called when a model is removed from the children list.
            view.$el.remove();
        },

        _handle_children_add: function(view) {
            // Called when a model is added to the children list.
            this.$box.append(view.$el);
        },
Jason Grout
@jasongrout
Oct 09 2014 19:50
no, I wasn't thinking of automating it that much.
i.e., I wasn't thinking of magical method names
because what if I want to dynamically create lists of children?
Jonathan Frederic
@jdfreder
Oct 09 2014 19:51
then maybe you can register a list as a model list using something like this
this.register_child_list('children', this._handle_children_remove, this._handle_children_add, this)
Jason Grout
@jasongrout
Oct 09 2014 19:52
that's more like it.
Jonathan Frederic
@jdfreder
Oct 09 2014 19:52
Seems reasonable too me
Jason Grout
@jasongrout
Oct 09 2014 19:52
though it would probably be something like:
this.register_child_list('unique-key', remove_handler, add_handler)
Sylvain Corlay
@SylvainCorlay
Oct 09 2014 19:53
Maybe using some specific base class for that would work.
Not in WidgetView itself.
Jason Grout
@jasongrout
Oct 09 2014 19:53
and then this.update_child_list('unique-key', newlist)
Sylvain Corlay
@SylvainCorlay
Oct 09 2014 19:53
besides, the list has to come from an existing widget attribute in the model.
Jason Grout
@jasongrout
Oct 09 2014 19:54
and then manually hooking up this.model.on('change:children') to the update_child_list function
Jonathan Frederic
@jdfreder
Oct 09 2014 19:54
What's the point of the update_child_list? Seems like the backbone model.set and corresponding events should suffice.
Jason Grout
@jasongrout
Oct 09 2014 19:55
what if my list of children is not exactly a model attribute?
Jonathan Frederic
@jdfreder
Oct 09 2014 19:55
Example of when that would be the case?
Jason Grout
@jasongrout
Oct 09 2014 19:55
I want that extra step so the child-tracking and model updates are separated
a model attribute that is a dict, with key 'unique-namespace' and value [list, of, children]
@SylvainCorlay - do you not want this in the base widgetview class for some reason?
Jonathan Frederic
@jdfreder
Oct 09 2014 19:59
Okay, I think I see why you'd want to separate the update method. I still think register_child_list would be a higher level method, just designed to work with a simple list of models.
Jason Grout
@jasongrout
Oct 09 2014 20:00
that's fine to have a higher-level function that does the 3 lines of code to hook up the change events
probably most people would use that.
Jonathan Frederic
@jdfreder
Oct 09 2014 20:00
Yeah, maybe I just need to see your implementation to fully understand
Jason Grout
@jasongrout
Oct 09 2014 20:01
working on it..
Jonathan Frederic
@jdfreder
Oct 09 2014 20:01
@SylvainCorlay why implement it anywhere other than the base?
Sylvain Corlay
@SylvainCorlay
Oct 09 2014 20:06
Because we may want to have multiple types of children lists, like unique and unordered (set) and non-unique (list). Eventually, a container will be a mixin of
  • potentially a layout (or layouts) if it is a visual component (Flexbox, Floating layout)
  • a children handling mechanism.
    This is too much for WidgetView, which is already pretty big.
Jason Grout
@jasongrout
Oct 09 2014 20:07
where do you propose we put this? Already do_diff is in WidgetView, along with the create_child_view and pop_child_view, which this affects
Sylvain Corlay
@SylvainCorlay
Oct 09 2014 20:08
In a class inheriting from WidgetView. Besides, the top level (global) children lists should probably remain right ?
Jason Grout
@jasongrout
Oct 09 2014 20:08
What do you mean top-level children?
I was thinking the current "children" attribute of the Box would be in the "children" namespace for child views
Sylvain Corlay
@SylvainCorlay
Oct 09 2014 20:09
top level list, not children.
a list of all children regardless of their type.
Jason Grout
@jasongrout
Oct 09 2014 20:10
a top-level list of all children views, perhaps keyed to the view id?
Sylvain Corlay
@SylvainCorlay
Oct 09 2014 20:10
yes exactly
Jason Grout
@jasongrout
Oct 09 2014 20:10
yes, I was planning to keep this.child_views[child_view.id] = child_view
perhaps the namespaces will just contain the child_view.id.
okay, how about you have to create a namespace before using it, if you want to use something other than the default list type of namespace
Jason Grout
@jasongrout
Oct 09 2014 20:19
A namespace has an add and delete method, each taking a model_id and returning a view (or null in case of error);
Sylvain Corlay
@SylvainCorlay
Oct 09 2014 20:22
A view or a view id.
Jason Grout
@jasongrout
Oct 09 2014 20:23
how about we just go the whole way and split out the containers from the widget.
this.children = ChildListContainer();
this.children.update([new,list,of,model_ids])
why exactly does the widget need to have a handle to all of it's children views directly?
this.children.value is [list,of,child, view, objects]
Sylvain Corlay
@SylvainCorlay
Oct 09 2014 20:26
  • parent-child relationship in custom logic / pretty much anywhere.
  • the handling of the dom insertion / removal. In the right place decided by the parent.
Jason Grout
@jasongrout
Oct 09 2014 20:26
this.children.update([new,list,of,model_ids], remove_handler, add_handler) for extra logic on updates
the widget also knows that its child views are in this.children, this.othercontainer, etc.
Sylvain Corlay
@SylvainCorlay
Oct 09 2014 20:27
we always have our specific remove handlers and add handlers
Jason Grout
@jasongrout
Oct 09 2014 20:28
or even better: this.children = ChildListContainer(add_handler, remove_handler)
just put those handlers right in with the container
then this.children.update([new,list]) automatically calls the handlers
this takes all of the logic out of the WidgetView, which I really like, and makes it easy to swap in other types of containers.
Sylvain Corlay
@SylvainCorlay
Oct 09 2014 20:30
sounds good
ChildListContainer -> ChildList ?
Jonathan Frederic
@jdfreder
Oct 09 2014 20:40
Sorry, just catching up. So you are suggesting a completely separate class (Widget) that can be used to generically manage children?
Jason Grout
@jasongrout
Oct 09 2014 20:42
a completely separate ChildList class, not a widget
and it just handles a child list, yes
Jonathan Frederic
@jdfreder
Oct 09 2014 20:44
hmm
Sylvain Corlay
@SylvainCorlay
Oct 09 2014 20:44
@jasongrout I might need a handler for a global operation once the add / remove have completed.
Jason Grout
@jasongrout
Oct 09 2014 20:56
ChildList(add_handler, remove_handler)
add is called when something is added, remove is called when something is removed
Sylvain Corlay
@SylvainCorlay
Oct 09 2014 20:58
yes
Jason Grout
@jasongrout
Oct 09 2014 21:00
(I just had another vote against deprecating set_css from my neighbor :)
Jonathan Frederic
@jdfreder
Oct 09 2014 21:04
Are there style attributes he's using that are generic enough to consider adding additional traitlets for them?
Like display, left, right, top, and bottom could use traitlets
Sylvain Corlay
@SylvainCorlay
Oct 09 2014 21:07
i would prefer going the other way. Not adding new attributes that would naturally conflict with already existing names in widgets.
because this is really cluttering the namespace of possible attributes for a widget.
Thomas Kluyver
@takluyver
Oct 09 2014 21:18
Can someone add me to the Trello organisation, by the way? My username is thomaskluyver
most of you are admins on there, so no excuses
jasongrout @jasongrout whistles :)
Thomas Kluyver
@takluyver
Oct 09 2014 21:21
And do we have a board with our plans for 3.0? I can't see it, which I guess means it's either not there, or not public.
Jason Grout
@jasongrout
Oct 09 2014 21:21
+1 to Sylvain -- these lightweight top-level classes became somewhat heavyweight with all these css attributes
It may have been better to make them all part of a style attribute: mywidget.style.width = 4
then there is just one new widget attribute, instead of 10-15.
(I guess it's not too late to change :)
Thomas Kluyver
@takluyver
Oct 09 2014 21:23
(OK, I found it, it's under jupyter/notebook)
Damian Avila
@damianavila
Oct 09 2014 21:25
hey Thomas... can you add me too... I guess you are in now...
Thomas Kluyver
@takluyver
Oct 09 2014 21:27
I am
sure
what's your username?
found you
Damian Avila
@damianavila
Oct 09 2014 21:29
great
Jonathan Frederic
@jdfreder
Oct 09 2014 21:30
@takluyver and @damianavila I added you both to the widget board. You can remove yourselves if it's too noisey
Thomas Kluyver
@takluyver
Oct 09 2014 21:30
thanks
Damian Avila
@damianavila
Oct 09 2014 21:34
I don't see any notification... are you sure you added me? my user is damianavila1
Thomas Kluyver
@takluyver
Oct 09 2014 21:35
ah...there's a user damianavila with your profile picture
Damian Avila
@damianavila
Oct 09 2014 21:36
mmm... really? maybe an old account I don't remember?
Thomas Kluyver
@takluyver
Oct 09 2014 21:36
or an impostor
there, now I've added the real you ;-)
Damian Avila
@damianavila
Oct 09 2014 21:36
jajaja...
Damian Avila
@damianavila
Oct 09 2014 21:57
well... my alter ego was the guy working for Continuum, jaja... I completely forgot about that account... keeping things separate is always good, I will use this new account just for Jupyter/IPython
Jonathan Frederic
@jdfreder
Oct 09 2014 23:17
Outputs and Widgets successfully interleaved! Without persistence! See #6670
Thomas Kluyver
@takluyver
Oct 09 2014 23:19
congratulations