[IPython-dev] Notebook diffing tool by Matthew

Matthias BUSSONNIER bussonniermatthias@gmail....
Sun Nov 18 05:45:47 CST 2012


Le 18 nov. 2012 à 12:15, Fernando Perez a écrit :

> Hi folks,
> 
> Matthew just wrote up a notebook-diff tool.  Eventually we'll want
> this kind of capability nicely integrated into nbconvert, but in the
> meantime here it is:
> 
> https://github.com/fperez/nipy-notebooks/blob/master/notebook_diff.py
> 
> Does crude unified diff on notebooks after stripping output and input
> line numbers.  You've got to search through the text to see the bit to
> which the diff refers, but at least it gives an idea...

One thing that can be done is adding cell ID.
This help to do a per-cell diff (or find splitted/merged cells)
The advantage is that diff notebook is still a real ipynb file. 
http://nbviewer.ipython.org/urls/raw.github.com/Carreau/ipython/58d78fce482cfc907e85de3e86850e8e448d94dd/docs/examples/notebooks/octave_diff.ipynb

(nbviewer does not render the cell correctly with the right color, added text should be green and removed red, without input prompt.) 



> Actually piping this through wdiff is particularly nice:
> 
> ./notebook_diff.py exploring_r_formula.ipynb jbs_r_formula.ipynb | wdiff -d -a
> 
> 
> Cheers,
> 
> f
> _______________________________________________
> IPython-dev mailing list
> IPython-dev@scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev



More information about the IPython-dev mailing list