Skip to content

Commit

Permalink
Allow for white space in kernelspec regex
Browse files Browse the repository at this point in the history
Before this fix, updating the kernelspec would fail if there was no
whitespace after the colon following "kernelspec", e.g. if the JSON was
minified
  • Loading branch information
ana-v-espinoza committed Oct 14, 2024
1 parent 05486e2 commit 821ab4f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion jupyter-images/shared/default_kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def update_kernelspec_in_notebooks(directory, new_name):
# (including nested structures), preserving the overall structure
# and formatting of the file.
updated_contents = re.sub(
r'"kernelspec": \{.*?\}',
r'"kernelspec": *\{.*?\}',
f'"kernelspec": {updated_kernelspec}',
file_contents, flags=re.DOTALL
)
Expand Down

0 comments on commit 821ab4f

Please # to comment.