Skip to content

Add nbstripout to pre-commit#83

Merged
dcherian merged 2 commits into
mainfrom
nbstripout
Jun 22, 2022
Merged

Add nbstripout to pre-commit#83
dcherian merged 2 commits into
mainfrom
nbstripout

Conversation

@dcherian
Copy link
Copy Markdown
Contributor

Implements @zmoon's suggestion to use nbstripout to delete kernel info.

This builds successfully locally, but asks you to choose a kernel when opening a notebook:
image

@review-notebook-app
Copy link
Copy Markdown

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@dcherian dcherian requested a review from scottyhq June 18, 2022 02:55
* main:
  Split up plotting notebooks (#90)
  Add sphinx-notfound-page and sphinx-rediraffe for 404 and redirect handling (#87)
@scottyhq
Copy link
Copy Markdown
Contributor

This builds successfully locally, but asks you to choose a kernel when opening a notebook:

I find that kind of annoying and possibly confusing to newcomers. Wish there was a way to simply overwrite kernelname="python3"...

Is it the case that following instructions here https://github.com/xarray-contrib/xarray-tutorial/blob/main/CONTRIBUTING.md#create-a-python-environment, you'll still end up with the different kernel names if nb_conda_kernels is installed?

also noting that this PR addresses #78

@zmoon
Copy link
Copy Markdown
Contributor

zmoon commented Jun 21, 2022

If write a script to add name and display_name back to data.metadata.kernelspec, could set it up as a local pre-commit hook after nbstripout.

If using Jupyter Lab from the xarray-tutorial conda environment, name should be the default python3.

@dcherian
Copy link
Copy Markdown
Contributor Author

AH I just checked.

  1. If I run from my base environment with nb-conda-kernels installed it asks to choose a kernel.
  2. If I run from xarray-tutorial it just opens up the "default" kernel. I assume this will happen on binder too, but we can triple-check after merging.

Seems like we could recommend tutorial users open jupyter lab or jupyter notebook in the xarray-tutorial environment and then things will work well?

@scottyhq
Copy link
Copy Markdown
Contributor

I assume this will happen on binder too, but we can triple-check after merging.

You can just launch binder pointing to this nbstripout branch: https://mybinder.org/v2/gh/xarray-contrib/xarray-tutorial/nbstripout?urlpath=lab

@dcherian
Copy link
Copy Markdown
Contributor Author

image

Sweet got the default kernel on binder.

@dcherian dcherian merged commit de5471c into main Jun 22, 2022
@dcherian dcherian deleted the nbstripout branch June 22, 2022 02:07
This was referenced Jun 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants