Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Copilot Lvl 2
Message 1 of 2

Use nbdime as diff tool for Jupyter Notebook

Below are direct quotes from nbdime's documentation page, as it eloquently states the problem and how it solves it.

 

Jupyter notebooks are useful, rich media documents stored in a plain text JSON format. This format is relatively easy to parse. However, primitive line-based diff and merge tools do not handle well the logical structure of notebook documents. These tools yield diffs like this:

 

diff example using traditional line-based diff tool

 

nbdime, on the other hand, provides “content-aware” diffing and merging of Jupyter notebooks. It understands the structure of notebook documents. Therefore, it can make intelligent decisions when diffing and merging notebooks, such as:

 

  • eliding base64-encoded images for terminal output
  • using existing diff tools for inputs and outputs
  • rendering image diffs in a web view
  • auto-resolving conflicts on generated values such as execution counters

 

nbdime yields diffs like this:

example of nbdime's content-aware diff

 

Here are my own words on the problem:

Jupyter Notebook is an extremely popular file format on Github; as of the time of writing, there are several millions of them hosted on Github. However, the generic diff tool used by Github when doing version control is not very effective, as seen above.

 

Github has done a great job to display Jupyter Notebook in rendered form instead of its source code when viewed in repository online. Could it do it one more time and use nbdime as the default option of file comparison instead of diff? It would make the life of developers much easier when collaborating on Jupyter Notebook.

1 Reply
Ground Controller Lvl 1
Message 2 of 2

Re: Use nbdime as diff tool for Jupyter Notebook

it really would make a lot of sense for github to show differences in notebooks using nbdime

+1 on this one