'Jupyter notebooks + pull requests in bitbucket

Can anyone here share some recommendations and best practices for working with Jupyter notebooks and Bitbucket/git? We have the Notebook viewer plugin installed, which allows us to view the notebooks.

However, we still have troubles in pull requests. It shows the raw JSON. We'd be happy to receive recommendations.



Solution 1:[1]

If the output does not have to be reviewed (say, you will use the notebook as a template), then jupytext is your best option: https://github.com/mwouts/jupytext. It will allow you to transparently open several formats (py, md, etc) as Jupyter notebooks. Users will work with them as they now do but your pull request will do diffs on text files, not JSON.

If you want to keep the ipynb format, there is an official tool to run diffs on notebooks called nbdime (https://github.com/jupyter/nbdime). You can integrate nbdime with the git CLI.

Solution 2:[2]

Several options -

  • nbdime for local diff & merge
  • jupytext for 2-way sync betweeb .ipynb & .py / .md
  • ReviewNB for reviewing notebook pull requests on GitHub & Bitbucket

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Edu
Solution 2 amirathi