-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Monkeypatching jupyter_client.kernelspec #104
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I'm well aware that newer versions of the See this documentation for a description of this proposed new approach. |
mcg1969
changed the title
WIP: patching capability
WIP: patching jupyter_client.kernelspec
Sep 8, 2018
mcg1969
force-pushed
the
patch
branch
5 times, most recently
from
September 8, 2018 22:57
74dba90
to
b6942c9
Compare
mcg1969
force-pushed
the
patch
branch
3 times, most recently
from
November 30, 2018 16:47
ff2bd39
to
efcb46d
Compare
mcg1969
changed the title
WIP: patching jupyter_client.kernelspec
Patch jupyter_client.kernelspec
Nov 30, 2018
mcg1969
changed the title
Patch jupyter_client.kernelspec
Monkeypatching jupyter_client.kernelspec
Nov 30, 2018
# Conflicts: # conda-recipe/post-link.bat # conda-recipe/post-link.sh
Not pursuing this anymore, will revisit afresh if there is time. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is an idea that up with trying to resolve issues like #77.
The way
nb_conda_kernels
currently works is to add a configuration setting tojupyter_notebook_config.json
that tells thenotebook
application to use an alternate kernel spec manager. Unfortunately, this means that it will only work for applications which respect this configuration, and that is onlynotebook
, notnbconvert
, notconsole
, and so forth. Evenjupyter kernelspec list
doesn't work withnb_conda_kernels
.=What I've done here is create a new approach, which is effectively to patch the
kernelspec.py
file. The patch attempts to importnb_conda_kernels.manager
, and if it succeeds, replacesKernelSpecManger
with its subclassCondaKernelSpecManager
.Is this kosher? Well, no. Does it work? Seems to.
Currently, I don't have this configured to work by default; it has to be manually enabled. Fortunately, enabling is simple: in the environment where
nb_conda_kernels
is installed, typeIt tries to be very safe about the file modification itself. For one thing, the modification involves a simple append to the original file. Furthermore, the modification is first performed in a temporary file, and a multiple verifications are performed on the result; and only if those verifications pass, the file is moved into place.
An easy functional check to see if the patch is successful is to run
after the patch is applied. It should see all of the same kernels that notebooks can.