From 706daf3859b77d209580cbe16dfb77abf540cac0 2015-03-28 00:42:09 From: Min RK Date: 2015-03-28 00:42:09 Subject: [PATCH] s/IPython.kernel/jupyter_client in jupyter_client --- diff --git a/jupyter_client/__init__.py b/jupyter_client/__init__.py index 0735425..69ab55f 100644 --- a/jupyter_client/__init__.py +++ b/jupyter_client/__init__.py @@ -1,8 +1,5 @@ """IPython kernels and associated utilities""" -# just for friendlier zmq version check -from . import zmq - from .connect import * from .launcher import * from .client import KernelClient diff --git a/jupyter_client/blocking/client.py b/jupyter_client/blocking/client.py index d695eeb..1315abe 100644 --- a/jupyter_client/blocking/client.py +++ b/jupyter_client/blocking/client.py @@ -11,8 +11,8 @@ except ImportError: from Queue import Empty # Python 2 from IPython.utils.traitlets import Type -from IPython.kernel.channels import HBChannel -from IPython.kernel.client import KernelClient +from jupyter_client.channels import HBChannel +from jupyter_client.client import KernelClient from .channels import ZMQSocketChannel class BlockingKernelClient(KernelClient): diff --git a/jupyter_client/channelsabc.py b/jupyter_client/channelsabc.py index b4f5c3d..e7f388a 100644 --- a/jupyter_client/channelsabc.py +++ b/jupyter_client/channelsabc.py @@ -29,7 +29,7 @@ class HBChannelABC(ChannelABC): The docstrings for this class can be found in the base implementation: - `IPython.kernel.channels.HBChannel` + `jupyter_client.channels.HBChannel` """ @abc.abstractproperty diff --git a/jupyter_client/client.py b/jupyter_client/client.py index bacca4b..6dc99c2 100644 --- a/jupyter_client/client.py +++ b/jupyter_client/client.py @@ -4,7 +4,7 @@ # Distributed under the terms of the Modified BSD License. from __future__ import absolute_import -from IPython.kernel.channels import major_protocol_version +from jupyter_client.channels import major_protocol_version from IPython.utils.py3compat import string_types, iteritems import zmq diff --git a/jupyter_client/clientabc.py b/jupyter_client/clientabc.py index 2b22351..af8339e 100644 --- a/jupyter_client/clientabc.py +++ b/jupyter_client/clientabc.py @@ -24,7 +24,7 @@ class KernelClientABC(with_metaclass(abc.ABCMeta, object)): The docstrings for this class can be found in the base implementation: - `IPython.kernel.client.KernelClient` + `jupyter_client.client.KernelClient` """ @abc.abstractproperty diff --git a/jupyter_client/connect.py b/jupyter_client/connect.py index fc0c641..ef5ca0e 100644 --- a/jupyter_client/connect.py +++ b/jupyter_client/connect.py @@ -151,7 +151,7 @@ def get_connection_file(app=None): If unspecified, the currently running app will be used """ if app is None: - from IPython.kernel.zmq.kernelapp import IPKernelApp + from jupyter_client.kernelapp import IPKernelApp if not IPKernelApp.initialized(): raise RuntimeError("app not specified, and not in a running Kernel") @@ -432,9 +432,9 @@ class ConnectionFileMixin(LoggingConfigurable): return [ getattr(self, name) for name in port_names ] # The Session to use for communication with the kernel. - session = Instance('IPython.kernel.zmq.session.Session') + session = Instance('jupyter_client.session.Session') def _session_default(self): - from IPython.kernel.zmq.session import Session + from jupyter_client.session import Session return Session(parent=self) #-------------------------------------------------------------------------- diff --git a/jupyter_client/ioloop/manager.py b/jupyter_client/ioloop/manager.py index e97fbd0..c8c42b1 100644 --- a/jupyter_client/ioloop/manager.py +++ b/jupyter_client/ioloop/manager.py @@ -20,7 +20,7 @@ from IPython.utils.traitlets import ( Instance ) -from IPython.kernel.manager import KernelManager +from jupyter_client.manager import KernelManager from .restarter import IOLoopKernelRestarter #----------------------------------------------------------------------------- @@ -40,7 +40,7 @@ class IOLoopKernelManager(KernelManager): def _loop_default(self): return ioloop.IOLoop.instance() - _restarter = Instance('IPython.kernel.ioloop.IOLoopKernelRestarter', allow_none=True) + _restarter = Instance('jupyter_client.ioloop.IOLoopKernelRestarter', allow_none=True) def start_restarter(self): if self.autorestart and self.has_kernel: diff --git a/jupyter_client/ioloop/restarter.py b/jupyter_client/ioloop/restarter.py index b627cc9..3f7b3e6 100644 --- a/jupyter_client/ioloop/restarter.py +++ b/jupyter_client/ioloop/restarter.py @@ -20,7 +20,7 @@ from __future__ import absolute_import from zmq.eventloop import ioloop -from IPython.kernel.restarter import KernelRestarter +from jupyter_client.restarter import KernelRestarter from IPython.utils.traitlets import ( Instance, ) diff --git a/jupyter_client/launcher.py b/jupyter_client/launcher.py index 4c9f026..e3c7cff 100644 --- a/jupyter_client/launcher.py +++ b/jupyter_client/launcher.py @@ -175,7 +175,7 @@ def launch_kernel(cmd, stdin=None, stdout=None, stderr=None, env=None, cwd = cast_bytes_py2(cwd, sys.getfilesystemencoding() or 'ascii') kwargs['cwd'] = cwd - from IPython.kernel.zmq.parentpoller import ParentPollerWindows + from jupyter_client.parentpoller import ParentPollerWindows # Create a Win32 event for interrupting the kernel # and store it in an environment variable. interrupt_event = ParentPollerWindows.create_interrupt_event() diff --git a/jupyter_client/manager.py b/jupyter_client/manager.py index b546653..7f74ce6 100644 --- a/jupyter_client/manager.py +++ b/jupyter_client/manager.py @@ -25,12 +25,12 @@ from IPython.utils.path import get_ipython_dir from IPython.utils.traitlets import ( Any, Instance, Unicode, List, Bool, Type, DottedObjectName ) -from IPython.kernel import ( +from jupyter_client import ( launch_kernel, kernelspec, ) from .connect import ConnectionFileMixin -from .zmq.session import Session +from .session import Session from .managerabc import ( KernelManagerABC ) @@ -48,7 +48,7 @@ class KernelManager(ConnectionFileMixin): return zmq.Context.instance() # the class to create with our `client` method - client_class = DottedObjectName('IPython.kernel.blocking.BlockingKernelClient') + client_class = DottedObjectName('jupyter_client.blocking.BlockingKernelClient') client_factory = Type(allow_none=True) def _client_class_changed(self, name, old, new): self.client_factory = import_item(str(new)) @@ -381,7 +381,7 @@ class KernelManager(ConnectionFileMixin): """ if self.has_kernel: if sys.platform == 'win32': - from .zmq.parentpoller import ParentPollerWindows as Poller + from .parentpoller import ParentPollerWindows as Poller Poller.send_interrupt(self.kernel.win32_interrupt_event) else: self.kernel.send_signal(signal.SIGINT) diff --git a/jupyter_client/managerabc.py b/jupyter_client/managerabc.py index 12248d7..7717007 100644 --- a/jupyter_client/managerabc.py +++ b/jupyter_client/managerabc.py @@ -13,7 +13,7 @@ class KernelManagerABC(with_metaclass(abc.ABCMeta, object)): The docstrings for this class can be found in the base implementation: - `IPython.kernel.kernelmanager.KernelManager` + `jupyter_client.kernelmanager.KernelManager` """ @abc.abstractproperty diff --git a/jupyter_client/multikernelmanager.py b/jupyter_client/multikernelmanager.py index 1a74a58..fede54c 100644 --- a/jupyter_client/multikernelmanager.py +++ b/jupyter_client/multikernelmanager.py @@ -49,7 +49,7 @@ class MultiKernelManager(LoggingConfigurable): ) kernel_manager_class = DottedObjectName( - "IPython.kernel.ioloop.IOLoopKernelManager", config=True, + "jupyter_client.ioloop.IOLoopKernelManager", config=True, help="""The kernel manager class. This is configurable to allow subclassing of the KernelManager for customized behavior. """ diff --git a/jupyter_client/restarter.py b/jupyter_client/restarter.py index dedb8f4..ca1c2ca 100644 --- a/jupyter_client/restarter.py +++ b/jupyter_client/restarter.py @@ -18,7 +18,7 @@ from IPython.utils.traitlets import ( class KernelRestarter(LoggingConfigurable): """Monitor and autorestart a kernel.""" - kernel_manager = Instance('IPython.kernel.KernelManager') + kernel_manager = Instance('jupyter_client.KernelManager') debug = Bool(False, config=True, help="""Whether to include every poll event in debugging output. diff --git a/jupyter_client/session.py b/jupyter_client/session.py index eb086eb..b830511 100644 --- a/jupyter_client/session.py +++ b/jupyter_client/session.py @@ -53,8 +53,8 @@ from IPython.utils.traitlets import (CBytes, Unicode, Bool, Any, Instance, Set, TraitError, ) from IPython.utils.pickleutil import PICKLE_PROTOCOL -from IPython.kernel.adapter import adapt from IPython.kernel.zmq.serialize import MAX_ITEMS, MAX_BYTES +from jupyter_client.adapter import adapt #----------------------------------------------------------------------------- # utility functions @@ -148,7 +148,7 @@ class SessionFactory(LoggingConfigurable): def _context_default(self): return zmq.Context.instance() - session = Instance('IPython.kernel.zmq.session.Session', + session = Instance('jupyter_client.session.Session', allow_none=True) loop = Instance('zmq.eventloop.ioloop.IOLoop') diff --git a/jupyter_client/tests/test_adapter.py b/jupyter_client/tests/test_adapter.py index 85a5335..fe74298 100644 --- a/jupyter_client/tests/test_adapter.py +++ b/jupyter_client/tests/test_adapter.py @@ -8,8 +8,8 @@ import json from unittest import TestCase import nose.tools as nt -from IPython.kernel.adapter import adapt, V4toV5, V5toV4, code_to_line -from IPython.kernel.zmq.session import Session +from jupyter_client.adapter import adapt, V4toV5, V5toV4, code_to_line +from jupyter_client.session import Session def test_default_version(): diff --git a/jupyter_client/tests/test_connect.py b/jupyter_client/tests/test_connect.py index 94e574b..16a14dc 100644 --- a/jupyter_client/tests/test_connect.py +++ b/jupyter_client/tests/test_connect.py @@ -26,8 +26,8 @@ from IPython.consoleapp import IPythonConsoleApp from IPython.core.application import BaseIPythonApplication from IPython.utils.tempdir import TemporaryDirectory, TemporaryWorkingDirectory from IPython.utils.py3compat import str_to_bytes -from IPython.kernel import connect -from IPython.kernel.zmq.session import Session +from jupyter_client import connect +from jupyter_client.session import Session #----------------------------------------------------------------------------- # Classes and functions diff --git a/jupyter_client/tests/test_kernelmanager.py b/jupyter_client/tests/test_kernelmanager.py index d633289..067dd4f 100644 --- a/jupyter_client/tests/test_kernelmanager.py +++ b/jupyter_client/tests/test_kernelmanager.py @@ -7,7 +7,7 @@ from unittest import TestCase from IPython.testing import decorators as dec from IPython.config.loader import Config -from IPython.kernel import KernelManager +from jupyter_client import KernelManager class TestKernelManager(TestCase): diff --git a/jupyter_client/tests/test_kernelspec.py b/jupyter_client/tests/test_kernelspec.py index 3693762..3625f34 100644 --- a/jupyter_client/tests/test_kernelspec.py +++ b/jupyter_client/tests/test_kernelspec.py @@ -5,7 +5,7 @@ import unittest from IPython.testing.decorators import onlyif from IPython.utils.tempdir import TemporaryDirectory -from IPython.kernel import kernelspec +from jupyter_client import kernelspec sample_kernel_json = {'argv':['cat', '{connection_file}'], 'display_name':'Test kernel', diff --git a/jupyter_client/tests/test_launcher.py b/jupyter_client/tests/test_launcher.py index ea262c5..363ff46 100644 --- a/jupyter_client/tests/test_launcher.py +++ b/jupyter_client/tests/test_launcher.py @@ -20,7 +20,7 @@ Authors import nose.tools as nt # Our own imports -from IPython.kernel.launcher import swallow_argv +from jupyter_client.launcher import swallow_argv #----------------------------------------------------------------------------- # Classes and functions diff --git a/jupyter_client/tests/test_multikernelmanager.py b/jupyter_client/tests/test_multikernelmanager.py index 3ae707c..4e99416 100644 --- a/jupyter_client/tests/test_multikernelmanager.py +++ b/jupyter_client/tests/test_multikernelmanager.py @@ -8,8 +8,8 @@ from IPython.testing import decorators as dec from IPython.config.loader import Config from IPython.utils.localinterfaces import localhost -from IPython.kernel import KernelManager -from IPython.kernel.multikernelmanager import MultiKernelManager +from jupyter_client import KernelManager +from jupyter_client.multikernelmanager import MultiKernelManager class TestKernelManager(TestCase): diff --git a/jupyter_client/tests/test_public_api.py b/jupyter_client/tests/test_public_api.py index b568d0b..66f57ef 100644 --- a/jupyter_client/tests/test_public_api.py +++ b/jupyter_client/tests/test_public_api.py @@ -1,4 +1,4 @@ -"""Test the IPython.kernel public API +"""Test the jupyter_client public API Authors ------- @@ -14,7 +14,7 @@ Authors import nose.tools as nt -from IPython.kernel import launcher, connect +from jupyter_client import launcher, connect from IPython import kernel #----------------------------------------------------------------------------- diff --git a/jupyter_client/tests/test_session.py b/jupyter_client/tests/test_session.py index 5526147..507be80 100644 --- a/jupyter_client/tests/test_session.py +++ b/jupyter_client/tests/test_session.py @@ -13,7 +13,7 @@ import zmq from zmq.tests import BaseZMQTestCase from zmq.eventloop.zmqstream import ZMQStream -from IPython.kernel.zmq import session as ss +from jupyter_client import session as ss from IPython.testing.decorators import skipif, module_not_available from IPython.utils.py3compat import string_types diff --git a/jupyter_client/threaded.py b/jupyter_client/threaded.py index 2e4f286..1a97e0b 100644 --- a/jupyter_client/threaded.py +++ b/jupyter_client/threaded.py @@ -14,9 +14,9 @@ from zmq.eventloop import ioloop, zmqstream # Local imports from IPython.utils.traitlets import Type, Instance -from IPython.kernel.channels import HBChannel -from IPython.kernel import KernelClient -from IPython.kernel.channels import HBChannel +from jupyter_client.channels import HBChannel +from jupyter_client import KernelClient +from jupyter_client.channels import HBChannel class ThreadedZMQSocketChannel(object): """A ZMQ socket invoking a callback in the ioloop"""