Output cell history / diff?

90 views
Skip to first unread message

Patrick Surry

unread,
Oct 27, 2016, 11:41:38 AM10/27/16
to Project Jupyter
One of the great things about Jupyter for data analysis is that it preserves the output of each cell within and between sessions as a "historical record".

I often find myself copying & pasting a cell to execute with small changes and then compare to a previous iteration, either while I'm exploring interactively, or because I'm re-running a previous analysis with updated data.

In those cases it'd be really handy if you could preserve a few prior versions of the output cell, so you could flip back & forth to compare and perhaps highlight differences automagically.

Has anyone experimented with anything like that? 

Cheers,
Patrick

Yuvi Panda

unread,
Oct 27, 2016, 3:35:11 PM10/27/16
to Project Jupyter
Haha, we just built something like this last Friday for a workshop we
did at UC Berkeley. I'm going to spend some more time polishing it and
making it better before publishing it. It's called 'nbhistory' - I'll
send a link as soon as I've a vague version up, and would love it for
you to test it up and give feedback!
> --
> You received this message because you are subscribed to the Google Groups
> "Project Jupyter" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to jupyter+u...@googlegroups.com.
> To post to this group, send email to jup...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jupyter/d32d8284-dd02-4f14-96e9-705c5d3d9adc%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
Yuvi Panda T
http://yuvi.in/blog

Yuvi Panda

unread,
Oct 27, 2016, 9:57:42 PM10/27/16
to Project Jupyter
I've extracted that code out into
https://github.com/yuvipanda/nbtimetravel. It doesn't have an UI to
explore yet - will add that next week, probably. I'm thinking of
mostly adding a slider for the whole notebook, and also one per-cell.
Ideas / patches welcome :D

I'm very interested in having this be installed with students' working
on learning to code - I feel a lot of insight can be gained by
analyzing the evolution of code over time as such students are working
towards their assignments or whatever. Just graphing the shape of the
AST of the answers to the same question by different students over
time seems like it would provide insights...

wwwald

unread,
Oct 28, 2016, 4:46:48 AM10/28/16
to Project Jupyter, yuvi...@gmail.com
Hello Yuvi,

Just thinking out loud here - wouldn't it be possible to use git as the backend for managing the cell's history?

I'm sure it would take quite some additional work and thinking. But I've been eager to find a decent solution to integrate git with our notebooks/JupyterHub setup for quite some time, I think this would be a great way to have fine-grained versioning, even at the cell level. And it would avoid notebooks blowing up in size.

Maybe it's a stupid idea - I'm not very familiar with notebook internals yet. Let me know what you think.

wwwald

Patrick Surry

unread,
Oct 28, 2016, 10:22:51 AM10/28/16
to Project Jupyter, yuvi...@gmail.com
Very cool!  

Looking forward to seeing your approach on UI, I was imagining just forward/back arrows under the "In [20]:" prompt in the margin to flip back/forth in the cell history, maybe highlight stuff that differs from the next version of the cell?

Not sure how a whole workbook slider would work - wouldn't each cell have potentially different amount of history?

Best,
Patrick

Lawrence D’Oliveiro

unread,
Nov 13, 2016, 3:06:18 AM11/13/16
to Project Jupyter
On Friday, October 28, 2016 at 4:41:38 AM UTC+13, Patrick Surry wrote:

I often find myself copying & pasting a cell to execute with small changes and then compare to a previous iteration, either while I'm exploring interactively, or because I'm re-running a previous analysis with updated data.
 
Isn’t that why you have more than one cell?

Patrick Surry

unread,
Nov 13, 2016, 8:24:32 PM11/13/16
to Project Jupyter
That's certainly my current approach, but it gets painful to keep multiple "old" versions of a calculation and remember not to re-run them when you come back with an updated dataset a month later.

--
You received this message because you are subscribed to a topic in the Google Groups "Project Jupyter" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jupyter/r3ylCNFYW30/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jupyter+u...@googlegroups.com.

To post to this group, send email to jup...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
--
hopper.comPatrick Surry
Chief Data Scientist
(857) 919 1700 | @patricksurry

Lawrence D’Oliveiro

unread,
Nov 13, 2016, 8:42:24 PM11/13/16
to Project Jupyter
On Monday, November 14, 2016 at 2:24:32 PM UTC+13, Patrick Surry wrote:

On Sun, Nov 13, 2016 at 3:06 AM Lawrence D’Oliveiro <lawren...@gmail.com> wrote:
On Friday, October 28, 2016 at 4:41:38 AM UTC+13, Patrick Surry wrote:

I often find myself copying & pasting a cell to execute with small changes and then compare to a previous iteration, either while I'm exploring interactively, or because I'm re-running a previous analysis with updated data.
 
Isn’t that why you have more than one cell?


That's certainly my current approach, but it gets painful to keep multiple "old" versions of a calculation and remember not to re-run them when you come back with an updated dataset a month later.

Is it because they trigger errors when you run them? Otherwise, a comment to the effect that this output is from an older version of the calculation should be sufficient.
 

Martin Sandve Alnæs

unread,
Nov 14, 2016, 8:49:15 AM11/14/16
to jup...@googlegroups.com, yuvi...@gmail.com, Vidar Tonaas Fauske, Min Ragan-Kelley
Hi guys,
a sidenote to the git integration comment: we're working
on getting the new project nbdime ready for a first release
soon, which is a tool for notebook diff and merge including
git integration. You can watch it here:


Be aware it still needs a little polish and some design work.

Martin


To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+unsubscribe@googlegroups.com.

To post to this group, send email to jup...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages