millejoh / emacs-ipython-notebook

Jupyter notebook client in Emacs
http://millejoh.github.io/emacs-ipython-notebook/
GNU General Public License v3.0
1.47k stars 122 forks source link

Cell ID changes on save for every cell #840

Closed natsirtguy closed 2 years ago

natsirtguy commented 2 years ago

The id field changes for every cell when I save the notebook. It looks like EIN is generating a new uuid every time I go to save. Presumably this is where the new uuid is being generated.

This is primarily a problem when working with source control systems like git, because it looks like every cell changes with every commit.

dickmao commented 2 years ago

Source control is precisely why jupyter is a non-starter for real work, but I sympathize with the proletariat whose corporate overlords forego brick houses when straw ones will suffice until the next promotion.

I don't see an id field in my .ipynb files. When I C-x C-s willy-nilly, a diff shows no changes to the .ipynb contents.

vvkisil commented 2 years ago

I have seen this issue with id tag and version control before as well, but now it gone. Probably the developers had recognised that it was a bad idea and had dropt it with some update.

Off: I am using the opportunity to say "many thanks" to the developers for maintaining wonderful ein.

natsirtguy commented 2 years ago

I think Jupyter implemented the cell ID JEP relatively recently, is it possible you are using old versions of the notebook format somehow?

Here's the reference json schema for the most recent notebook format for reference.

Source control with Jupyter is definitely a pain, but there are some tools out there that make it bearable :-)

dickmao commented 2 years ago

In c629877 I attempted a quick, untested fix. Sorry I can't be bothered to upgrade my jupyter to test it.

If that fails to keep your cell id's stable across sessions, I hope you can tweak the fix for the win.

natsirtguy commented 2 years ago

Hi @dickmao , thanks for this. It almost solved the problem, but the notebook wasn't saving the cell IDs that you now load into the cell objects. #850 fixes that, take a look if you get the chance.