jupyter / nbformat

Reference implementation of the Jupyter Notebook format
http://nbformat.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
265 stars 152 forks source link

cell id changes on save #209

Closed teucer closed 3 years ago

teucer commented 3 years ago

I wanted to test the new cell id functionality:

  1. Opened a new jupyter notebook
  2. Added a cell with content print("hello") and saved the notebook
  3. Stored the cell id
  4. Added a second cell with the content print("world") and saved the notebook
  5. Compared the cell id of the first cell with the one stored on step 3: they are different!

Is this the intended functionality? I was under the impression that the cell id would not change once the cell is created.

MSeal commented 3 years ago

Cell ids should not be changing once made. There was a known issue with jupyter UIs having this behavior and we left the nbformat changes in alpha / beta status for a couple months to give time to fix that behavior. I believe the issue is fixed but I'm not sure if it's released yet. Try updating to the latest jupyter notebook version and see if it corrects, otherwise I'd open an issue there to see when that will be shipped / if there's any remaining work for it to be correctly behaving.

teucer commented 3 years ago

I have tested again (python 3.8.5, jupyterlab 3.0.5) in a clean virtual environment, the issue persists.

MSeal commented 3 years ago

Probably worth opening an issue on jupyterlab if there's not already one. I know folks over there are aware of the root issue at a minimum but my not all realize it's impacting people past beta releases of libraries.

teucer commented 3 years ago

I confirm that this is jupyterlab issue, submitted an issue

jasongrout commented 3 years ago

Cell ids should not be changing once made.

I'll just highlight Matt's careful and technical use of language here: note that this is not a requirement of the spec (i.e., not a MUST in RFC language), but it is strongly implied in the JEP (hence a SHOULD).

jasongrout commented 3 years ago

I think we can close this issue and shift the discussion to the jlab issue. At this time, jlab does not support cell ids (see also https://github.com/jupyterlab/jupyterlab/issues/9064)