Collaboration with a coworker on a Jupyter notebook is driving me nuts. We're working on different versions (I would say "branches", but that's probably too fancy for what we're doing) of the same notebook. I try to merge (some of) the changes he introduces, into my version. Since diffing JSON files is a nightmare, I convert the two notebooks to .py
files (Download as\Python (.py file) from the File menu of the notebooks) and then compare the .py
files in PyCharm. This works nicely, also because all output is removed when exporting to .py
.
The problem now is to import the changed .py
file into Jupyter. Is this possible? The one thing that gives me hope of an affirmative answer, is that into the exported .py
files there are some # In[4]:
comments, which maybe the Jupyter interface may use to understand how the code is divided into cells. Or is it just impossible to go back? If so, do you have any other suggestions to merge some of changes between two different versions of a Jupyter notebook?