-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support notebook format 4.5, adding cell IDs #9729
Comments
Tagging as 4.0, though it would be great if we released this in the 3.x releases. |
From #9064 (comment): Doing some experiments, it's actually quite easy to accidentally get an invalid notebook 4.5 file. For example, There already is some code to handle format differences in https://github.com/jupyterlab/jupyterlab/blob/master/packages/notebook/src/model.ts#L242-L243 - perhaps that should handle the case where we have a 4.5 format file. |
@jasongrout When you get to planning for 4.0 could you post updates here on timeline for support for this ticket? |
If I end up doing this, I'll definitely post here. |
Is it possible for this fix to be higher priority? Per the problem described in #9645, this is very annoying and generates an immense amount of diff noise for every cell of every notebook any time a notebook has to be committed to VCS. This was fixed for Jupyter Notebook back in early January. jupyter/notebook#5928 Frankly I consider this a bug rather than an "enhancement" as this is highly undesirable behavior. |
The best (most helpful) way to make something a higher priority in an open-source project like this is to work on a PR (or sponsor someone to work on a PR). |
It's unclear to me @jayqi if you are objecting to JupyterLab's current status or to the cell id JEP that was opened in August 2020 and approved in September 2020. We've been using nbformat version 4.5 without issue. The benefits of cell id have been demonstrated in the JEP. Following @jasongrout's comment makes sense for open source projects. |
I think the objection is that merely saving in Lab causes all the cell ids to change. In the example below (from the binder link in this repo's README), all I did between the two grep commands is press Ctrl-S in the tab where my notebook is open. I suppose a careful reading of the JEP doesn't expressly forbid this, but it does seem to contradict the spirit of e.g. question 6 ("Would cell ID be changed if the cell content changes, or just created one time when the cell is created?" -- "It stays the same once created.").
|
Yes, @jeffyjefflabs is correctly capturing my intent. I have no problem with the JEP or the merits of having a cell ID—the issue is that the current behavior of Jupyter Lab interacting with the cell ID causes it to change on every save, which causes a lot of diff noise, and as pointed out, does not seem consistent with the general understanding of Question 6 in the JEP.
In this quote, I was referring to the fact that this issue is tagged on GitHub with the label I understand that projects in the Jupyter ecosystem are free and open-source, and everyone should be the change they want to see, so I am willing to take a look at contributing a fix when I have time if someone hasn't already addressed it by then. However, I think there is still some room for improvement here on how this issue is classified and viewed by the maintainers that is in the maintainer-level project management purview. |
Yes, that is pretty painful :(. For now, downgrading nbformat should be able to work around the problem until JLab gets support for maintaining cell ids. It's slated for 4.0 at the latest, but I'm hoping it can go in 3.1 if it doesn't break APIs. |
I'm happy to help someone get started on this issue if someone wants to start looking into it. |
@jasongrout could you please describe high-level what would need to be done? |
This issue has been mentioned on Jupyter Community Forum. There might be relevant details there: https://discourse.jupyter.org/t/cell-id-changes-when-notebook-rerun-only-in-jupyterlab/8489/3 |
Hi 👋 That was me, and I can say that there isn't necessarily more relevant info there, beyond a Gist and Binder that reproduces the cell IDs changing with each run of the notebook in JupyterLab for
So you can probably ignore it.
That's awesome news. 👍 Thanks! I'll try to find the version of |
Ah, about as simple as it gets.
should be sufficient for the time being to avoid the versioning problems 👍 |
I haven't dived too much into what would be needed to change in jlab, but here's where I would start:
I would also try to understand where cell ids are getting dropped by jlab and make sure they were carried through in the model. My guess is that they are getting dropped in one of the above two places. |
My guess is that the PR that fixed the same issue in Jupyter Notebook may be relevant as an example: jupyter/notebook#5928 |
That PR is just a few lines. It would be awesome if this PR was that easy too! |
We currently support notebook format 4.4. Notebook format 4.5 adds a new
id
field to cells. This issue is about supporting this newest version of the notebook format.Related issues:
The text was updated successfully, but these errors were encountered: