These are chat archives for ipython/ipython

15th
Jul 2015
Dietmar Winkler
@dietmarw
Jul 15 2015 09:13
I'm trying to figure out to scale an image in the markdown cell. Doing it via <img src='...' width='...'> is unfortunately not an option since nbconvert ignores those images and the are not included in the resultant pdf. So I need to inlude images using ![](image.png) for nbconvert's sake.
Sylvain Corlay
@SylvainCorlay
Jul 15 2015 12:50
tests on widgets started not passing again yesterday, although they pass locally on my machine.
Might be some npm package used in the travis build that got updated
Sylvain Corlay
@SylvainCorlay
Jul 15 2015 13:00
Actually, there were some test changes in the notebook
Anton Akhmerov
@akhmerov
Jul 15 2015 13:10
@takluyver don't want to spam the ML, but thanks for recombinecm. It looks very useful. I imagine difflib is a placeholder, or is it a sufficiently good differ?
Sylvain Corlay
@SylvainCorlay
Jul 15 2015 13:13
OK, the culprit is a recent merge in ipykernel, probably the hardcore widget thing
@minrk @jdfreder fyi
that is it.
Jonathan Frederic
@jdfreder
Jul 15 2015 14:57
Ah yeah
I need to finish that PR today
that should clear things up
Andreas Klostermann
@akloster
Jul 15 2015 15:02
I'm looking forward to EuroPython ;-)
Thomas Kluyver
@takluyver
Jul 15 2015 16:53
@akhmerov thanks! I think difflib is probably good enough for this purpose - what I'm using it for is not very complex. But if you find something where it fails but another subsequence matching algorithm could do better, we can certainly look at that.
But restoring any outputs when the notebook has been modified is total guesswork - there's no particular reason to think that running the notebook again would generate the same output in the same places.
Anton Akhmerov
@akhmerov
Jul 15 2015 16:55
Sure, I rather meant more advanced diffing for better friendship with VCS. We touched the topic of nbdiff vs json diff vs ??? a while ago.
Thomas Kluyver
@takluyver
Jul 15 2015 16:57
recombinecm doesn't do any diffing for that. You could still use nbdiff or a json diff tool on the .ipynb.clean notebook
merging changes will still run into the issues with VCSs not knowing about JSON, but at least they won't be compounded by having output blobs in the notebook
Anton Akhmerov
@akhmerov
Jul 15 2015 17:00
Indeed. So then recombinecm is not friendship all the way.
Jason Grout
@jasongrout
Jul 15 2015 17:33
it does bring up the possibility of the file contents manager storing a diff-friendly version of the notebook on disk, and transparently reconstructing the json from disk when reading the file back. For example, saving to disk a yaml version of the notebook, or a special version of the .py export that has magic comments storing metadata.
Ryan Morshead
@rmorshea
Jul 15 2015 17:36
Have you guys experienced any difficulties with the traitlets metaclass and super in terms of multiple inheritance with other classes which use a metaclass? Additionally does HasTraits need to appear as the last class on the MRO before object to keep things from breaking?
Thomas Kluyver
@takluyver
Jul 15 2015 18:26
difficulties with metaclasses: yep, look for MetaQObjectHasTraits in the Qt console code
not sure about the MRO question with HasTraits. I didn't think it needed that, but it's possible.
Min RK
@minrk
Jul 15 2015 18:32
I doubt it's needed, but I'm not sure how to avoid it.
Ryan Morshead
@rmorshea
Jul 15 2015 18:58
@takluyver is MetaQObjectHasTraits a patchwork solution or do you think it's extendable to other scenarios? I'm working with the matplotlib people on traitlet integration. Most of the concerns I'm seeing are probably resolvable, however I'm not familiar enough with the metaclasses to know if the issues they bring up might be intractable.
Thomas Kluyver
@takluyver
Jul 15 2015 19:00
the concept can probably be reused, but... multiple inheritance with metaclasses is one of those things where, if that's the solution, you're probably solving the wrong problem
Ryan Morshead
@rmorshea
Jul 15 2015 19:01
So then probably something that'll have to be solved on a case by case basis?
Thomas Kluyver
@takluyver
Jul 15 2015 19:02
I'd avoid combining metaclasses unless I really have to. It makes the logic almost impossible to follow when reading the code.
Because there's indirection going off in so many directions, and you can't keep them all in your head at once.
Ryan Morshead
@rmorshea
Jul 15 2015 19:04
Gotcha, this isn't something that's come up yet, but it's foreseeable when working with the backends which is making them nervous about the idea of traitlets.
Min RK
@minrk
Jul 15 2015 19:04
Do the backends use metaclasses?
Ryan Morshead
@rmorshea
Jul 15 2015 19:12
It's a bit difficult to tell because the meta stuff I've seen goes on mostly in factories rather than classes, but according to one of the devs I've been talking to they're quote, "unavoidable".
Ryan Morshead
@rmorshea
Jul 15 2015 19:21
I'll try to get some clarification on that.