Skip to content

Commit e1412e2

Browse files
committed
fixes #1553
1 parent c910823 commit e1412e2

File tree

11 files changed

+18
-21
lines changed

11 files changed

+18
-21
lines changed

nbdev/clean.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def nbdev_trust(
2626
fname:str=None, # A notebook name or glob to trust
2727
force_all:bool=False # Also trust notebooks that haven't changed
2828
):
29-
"Trust notebooks matching `fname`"
29+
"Trust notebooks matching `fname`."
3030
try: from nbformat.sign import NotebookNotary
3131
except:
3232
import warnings
@@ -100,6 +100,8 @@ def clean_nb(
100100
if nb.get('metadata', {}).get('kernelspec', {}).get('name', None):
101101
nb['metadata']['kernelspec']['display_name'] = nb["metadata"]["kernelspec"]["name"]
102102
nb['metadata'] = {k:v for k,v in nb['metadata'].items() if k in metadata_keys}
103+
# Cell IDs were added in nbformat 4.5
104+
if nb.get('nbformat') == 4 and nb.get('nbformat_minor', 0) < 5: nb['nbformat_minor'] = 5
103105

104106
# %% ../nbs/api/11_clean.ipynb #604d83e6
105107
def _reconfigure(*strms):

nbs/api/04_export.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,5 +392,5 @@
392392
}
393393
},
394394
"nbformat": 4,
395-
"nbformat_minor": 4
395+
"nbformat_minor": 5
396396
}

nbs/api/07_merge.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -676,5 +676,5 @@
676676
}
677677
},
678678
"nbformat": 4,
679-
"nbformat_minor": 4
679+
"nbformat_minor": 5
680680
}

nbs/api/11_clean.ipynb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
" fname:str=None, # A notebook name or glob to trust\n",
8484
" force_all:bool=False # Also trust notebooks that haven't changed\n",
8585
"):\n",
86-
" \"Trust notebooks matching `fname`\"\n",
86+
" \"Trust notebooks matching `fname`.\"\n",
8787
" try: from nbformat.sign import NotebookNotary\n",
8888
" except:\n",
8989
" import warnings\n",
@@ -221,7 +221,9 @@
221221
" for c in nb['cells']: _clean_cell(c, clear_all, cell_metadata_keys, clean_ids)\n",
222222
" if nb.get('metadata', {}).get('kernelspec', {}).get('name', None):\n",
223223
" nb['metadata']['kernelspec']['display_name'] = nb[\"metadata\"][\"kernelspec\"][\"name\"]\n",
224-
" nb['metadata'] = {k:v for k,v in nb['metadata'].items() if k in metadata_keys}"
224+
" nb['metadata'] = {k:v for k,v in nb['metadata'].items() if k in metadata_keys}\n",
225+
" # Cell IDs were added in nbformat 4.5\n",
226+
" if nb.get('nbformat') == 4 and nb.get('nbformat_minor', 0) < 5: nb['nbformat_minor'] = 5"
225227
]
226228
},
227229
{

nbs/api/18_release.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -939,5 +939,5 @@
939939
}
940940
},
941941
"nbformat": 4,
942-
"nbformat_minor": 4
942+
"nbformat_minor": 5
943943
}

nbs/explanations/config.ipynb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@
116116
"| jupyter_hooks | bool_arg | False | Run Jupyter hooks? |\n",
117117
"| clean_ids | bool_arg | True | Remove ids from plaintext reprs? |\n",
118118
"| clear_all | bool_arg | False | Remove all cell metadata and cell outputs? |\n",
119-
"| cell_number | bool_arg | True | Add cell number to the exported file |\n",
120119
"| put_version_in_init | bool_arg | True | Add the version to the main __init__.py in nbdev_export |\n",
121120
"| skip_procs | str | | A list of processors that you want to skip |"
122121
],
@@ -170,5 +169,5 @@
170169
}
171170
},
172171
"nbformat": 4,
173-
"nbformat_minor": 4
172+
"nbformat_minor": 5
174173
}

nbs/explanations/directives.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -787,5 +787,5 @@
787787
}
788788
},
789789
"nbformat": 4,
790-
"nbformat_minor": 4
790+
"nbformat_minor": 5
791791
}

nbs/explanations/docs.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -602,5 +602,5 @@
602602
}
603603
},
604604
"nbformat": 4,
605-
"nbformat_minor": 4
605+
"nbformat_minor": 5
606606
}

nbs/getting_started.ipynb

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"source": [
4040
"- **Documentation** is automatically generated using [Quarto](https://quarto.org/) and hosted on [GitHub Pages](https://pages.github.com/). Docs support LaTeX, are searchable, and are automatically hyperlinked (including out-of-the-box support for many packages via [`nbdev-index`](https://github.com/fastai/nbdev-index))\n",
4141
"- **Publish packages to PyPI and conda** as well as tools to simplify package releases. Python best practices are automatically followed, for example, only exported objects are included in `__all__`\n",
42-
"- **Two-way sync between notebooks and plaintext source code** allowing you to use your IDE for code navigation or quick edits\n",
42+
"- **Two-way sync between notebooks and plaintext source code** allowing you to use your IDE for code navigation or quick edits. Sync is robust: each exported cell is tagged with its unique notebook cell ID, so `nbdev_update` always updates the correct cell\n",
4343
"- **Tests** written as ordinary notebook cells are run in parallel with a single command\n",
4444
"- **Continuous integration** out-of-the-box with [GitHub Actions](https://github.com/features/actions) that run your tests and rebuild your docs\n",
4545
"- **Git-friendly notebooks** with [Jupyter/Git hooks](https://nbdev.fast.ai/tutorials/git_friendly_jupyter.html) that clean unwanted metadata and render merge conflicts in a human-readable format\n",
@@ -294,13 +294,7 @@
294294
]
295295
}
296296
],
297-
"metadata": {
298-
"kernelspec": {
299-
"display_name": "python3",
300-
"language": "python",
301-
"name": "python3"
302-
}
303-
},
297+
"metadata": {},
304298
"nbformat": 4,
305-
"nbformat_minor": 4
299+
"nbformat_minor": 5
306300
}

nbs/tutorials/migrating.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,5 +268,5 @@
268268
}
269269
},
270270
"nbformat": 4,
271-
"nbformat_minor": 4
271+
"nbformat_minor": 5
272272
}

0 commit comments

Comments
 (0)