-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Description
#14780 released in IPython 9.1 added support for saving outputs when exporting a notebook from IPython session:
However, the exported notebooks are not properly syntax-highlighted when first opened in JupyterLab or Notebook:
because the metadata does not include the langauge_info:
Additionally the "select kernel" dialog shows up, suggesting potentially irrelevant kernels (if kernels other than ipykernel are installed):
We should pre-populate the metadata with language_info reflecting the Python version used by IPython, and potentially with kernelspec too:
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.4"
}
},I think that hard-coding display_name to "Python 3 (ipykernel)" and name to python3 makes sense for now, but we could also explore how to get the "default" kernelspec if ipykernel is installed (but we should make no assumption about its availability on the machine where ipython is executing!)