Skip to content

Set default values for name and display_name in kernelspec #141

@sp-fm

Description

@sp-fm

Jupyter Version

$ jupyter --version

jupyter core     : 4.6.3
jupyter-notebook : 6.1.4
qtconsole        : not installed
ipython          : 7.19.0
ipykernel        : 5.3.4
jupyter client   : 6.1.7
jupyter lab      : not installed
nbconvert        : 6.0.7
ipywidgets       : not installed
nbformat         : 5.0.8
traitlets        : 5.0.5

NOTE: The latest version of jupyter changed metadata.kernel_spec to metadata.kernelspec.

Problem

I stripped the kernelspec metadata using the following command:

git config --global filter.nbstripout.extrakeys '
  metadata.kernelspec.name
  metadata.kernelspec.display_name'

On doing so I encountered two problems:

  1. Git cannot render the notebook properly
  2. When I make changes to a code and then do git checkout to undo those changes it removes the kernelspec name and display_name metadata. This is as expected. But when I try to rerun the notebook it throws the following errors:
    a. Kernel not found
    b. Notebook validation failed: 'name' is a required property:
    c. Notebook validation failed: 'display_name' is a required property:

Change Request

Is it possible to set the name and display_name to a default value such as:

{
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  }
 }
}

Metadata

Metadata

Assignees

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions