jupyter / jupyter_client

Jupyter protocol client APIs
https://jupyter-client.readthedocs.io
BSD 3-Clause "New" or "Revised" License
383 stars 283 forks source link

Add `jupyter kernelspec list/remove --missing` to list/remove all missing kernels. #1018

Open wpk-nist-gov opened 6 months ago

wpk-nist-gov commented 6 months ago

I often install kernels from project virtualenvs (my-project/.venv/) that eventually get removed. I can manually remove a kernelspec with jupyter kernelspec remove my-project but forget to do this, then forget the missing kernel name, etc. Instead, I use a script that checks if the python executable the kernel points to exists, and if it doesn't, removes the kernel. A command jupyter kernelspec remove --missing would save users (myself) some pain.

Alternatively, it might be simpler to add jupyter kernelspec list --missing which would list out kernels with missing python interpreters, and a user can pipe this to jupyter kernelspec remove.

I'd be happy to attempt a PR with one or both of these features if you agree. Thanks!