Skip to content

Commit

Permalink
Add kernelspec tool
Browse files Browse the repository at this point in the history
  • Loading branch information
jakevdp committed Dec 1, 2016
1 parent 80f4f56 commit c05a84a
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tools/fix_kernelspec.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import os

import nbformat

from generate_contents import iter_notebooks, NOTEBOOK_DIR

def fix_kernelspec():
for nb_name in iter_notebooks():
nb_file = os.path.join(NOTEBOOK_DIR, nb_name)
nb = nbformat.read(nb_file, as_version=4)

print("- Updating kernelspec for {0}".format(nb_name))
nb['metadata']['kernelspec']['display_name'] = 'Python 3'

nbformat.write(nb, nb_file)


if __name__ == '__main__':
fix_kernelspec()

0 comments on commit c05a84a

Please sign in to comment.