Is there any way to generate a diff between two ve

2019-07-07 02:07发布

I have started using IPython notebook quite a bit for writing up draft sections for my dissertation. However, given two versions of a draft (i.e., notebook), I would like to be able to generate some form of diff output to show what has changed. Does anyone know if this is currently possible, either through IPython notebook itself, or through some extension?

4条回答
Rolldiameter
2楼-- · 2019-07-07 02:23

Since this question was answered, NBdiff, a diffing and merging tool for the IPython Notebook appeared on GitHub. Unfortunately, it has yet to be updated for Jupyter / IPython 3 Notebook format.

查看更多
啃猪蹄的小仙女
3楼-- · 2019-07-07 02:32

Another utility from the git issue that looks to have gotten official traction is nbdime.

查看更多
我只想做你的唯一
4楼-- · 2019-07-07 02:38

Notebook diff can be generated with nbdime. After installing nbdime you can run following to see notebook diff in browser:

> nbdiff-web notebook_1.ipynb notebook_2.ipynb

If you are using Github for version control you can use ReviewNB for Notebook diff. It lets you login via Github and browse commits/pull-request diff on your repo. You'll see visual diff like below:

enter image description here

查看更多
对你真心纯属浪费
5楼-- · 2019-07-07 02:39

Not yet. This is a often a requested feature, but there are different "level" of diff you might want. Do you want only diff of codecell, or also output, what about prompt number ? etc, etc.

Lots of people have chimed in but nobody really took the time to wrote anything, even if notebook are pretty "simple" json file where cell "just" need to be "aligned" then produce a diffed-json notebook.

查看更多
登录 后发表回答