-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #105 from mcg1969/discovery
Jupyter 6.0 kernel provider mechanism
- Loading branch information
Showing
14 changed files
with
184 additions
and
325 deletions.
There are no files selected for viewing
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: "t\u00ebst env2" | ||
name: "t\u00c6st env2" | ||
dependencies: | ||
- ipykernel | ||
- python=3 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
from jupyter_client import kernelspec | ||
from .manager import CondaKernelSpecManager | ||
kernelspec.KernelSpecManager = CondaKernelSpecManager | ||
from jupyter_client.kernelspecapp import KernelSpecApp | ||
from jupyter_client.kernelspecapp import KernelSpecApp # noqa | ||
KernelSpecApp.launch_instance() |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Initial support for the kernel provider mechanism | ||
# to be introduced in jupyter_client 6.0; see | ||
# https://jupyter-client.readthedocs.io/en/latest/kernel_providers.html | ||
|
||
try: | ||
from jupyter_client.discovery import KernelProviderBase | ||
except ImportError: | ||
# Silently fail for version of jupyter_client that do not | ||
# yet have the discovery module. This allows us to do some | ||
# simple testing of this code even with jupyter_client<6 | ||
KernelProviderBase = object | ||
|
||
from jupyter_client.manager import KernelManager | ||
from .manager import CondaKernelSpecManager | ||
|
||
|
||
class CondaKernelProvider(KernelProviderBase): | ||
id = 'conda' | ||
|
||
def __init__(self): | ||
self.cksm = CondaKernelSpecManager(conda_only=True) | ||
|
||
def find_kernels(self): | ||
for name, data in self.cksm.get_all_specs().items(): | ||
yield name, data['spec'] | ||
|
||
def make_manager(self, name): | ||
return KernelManager(kernel_spec_manager=self.cksm, kernel_name=name) |
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
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
Oops, something went wrong.