-
Notifications
You must be signed in to change notification settings - Fork 396
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
How to provide round trip consistency for notebooks in nbformat version 4.5 (with cell ids)? #735
Comments
Actually, Jupytext already preserves the cell id if one uses either |
Apologies for reviving an old thread, but while implementing a feature of linking to cell by ID for jupyter-book (already present in JupyterLab and in nbconvert) here executablebooks/MyST-NB#519 I came up against a challenge of cell IDs being dropped by jupytext during conversion to Just to highlight, while myst has a support for cell-level metadata cell ID is one level higher in hierarchy, i.e.: {
"cell_type": "code",
"execution_count": 1,
"id": "2e32aa7d", # ← this is getting lost
"metadata": { # ← this is supported
"load": "mystnb_codecell_file.py"
},
"outputs": [],
"source": [
"# flake8: noqa\n",
"\n",
"import numpy as np\n"
]
} |
Hey @krassowski , yes you're right, Jupytext does not store the cell id in the text notebooks. The cell ids are preserved only in |
As reported at #715 , the new cell ids introduced in notebooks in nbformat version 4.5 causes trouble with Jupytext. Indeed, the text representation does not store the cell id, and in that case
nbformat
regenerate a (random) cell id, contributing random differences on text <-> ipynb round trips.I see at least two possible approaches to address this issue:
nbformat
to generate non-random cell idsAnyone is welcome to contribute ideas or comments!
The text was updated successfully, but these errors were encountered: