From 52c324020c4ca7e0c4e0906c1cd247b86f4ded2b 2013-01-29 22:19:57 From: MinRK Date: 2013-01-29 22:19:57 Subject: [PATCH] move zmq.KernelManagers into IPython.kernel --- diff --git a/IPython/frontend/consoleapp.py b/IPython/frontend/consoleapp.py index 2079652..aefbfed 100644 --- a/IPython/frontend/consoleapp.py +++ b/IPython/frontend/consoleapp.py @@ -34,8 +34,8 @@ import uuid from IPython.config.application import boolean_flag from IPython.config.configurable import Configurable from IPython.core.profiledir import ProfileDir -from IPython.zmq.blockingkernelmanager import BlockingKernelManager -from IPython.zmq.kernelmanager import KernelManager +from IPython.kernel.blockingkernelmanager import BlockingKernelManager +from IPython.kernel.kernelmanager import KernelManager from IPython.kernel import tunnel_to_kernel, find_connection_file, swallow_argv from IPython.utils.path import filefind from IPython.utils.py3compat import str_to_bytes diff --git a/IPython/frontend/html/notebook/kernelmanager.py b/IPython/frontend/html/notebook/kernelmanager.py index 9bfd22a..9f288db 100644 --- a/IPython/frontend/html/notebook/kernelmanager.py +++ b/IPython/frontend/html/notebook/kernelmanager.py @@ -41,7 +41,7 @@ class MultiKernelManager(LoggingConfigurable): """A class for managing multiple kernels.""" kernel_manager_class = DottedObjectName( - "IPython.zmq.blockingkernelmanager.BlockingKernelManager", config=True, + "IPython.kernel.blockingkernelmanager.BlockingKernelManager", config=True, help="""The kernel manager class. This is configurable to allow subclassing of the KernelManager for customized behavior. """ diff --git a/IPython/frontend/html/notebook/tests/test_kernelmanager.py b/IPython/frontend/html/notebook/tests/test_kernelmanager.py index 9b6f0b3..8d1ea3b 100644 --- a/IPython/frontend/html/notebook/tests/test_kernelmanager.py +++ b/IPython/frontend/html/notebook/tests/test_kernelmanager.py @@ -9,7 +9,7 @@ from IPython.testing import decorators as dec from IPython.config.loader import Config from IPython.frontend.html.notebook.kernelmanager import MultiKernelManager from IPython.utils.localinterfaces import LOCALHOST -from IPython.zmq.kernelmanager import KernelManager +from IPython.kernel.kernelmanager import KernelManager class TestKernelManager(TestCase): diff --git a/IPython/frontend/qt/kernelmanager.py b/IPython/frontend/qt/kernelmanager.py index 7a1086d..bded7fc 100644 --- a/IPython/frontend/qt/kernelmanager.py +++ b/IPython/frontend/qt/kernelmanager.py @@ -3,7 +3,7 @@ # Local imports. from IPython.utils.traitlets import Type -from IPython.zmq.kernelmanager import ShellChannel, IOPubChannel, \ +from IPython.kernel.kernelmanager import ShellChannel, IOPubChannel, \ StdInChannel, HBChannel, KernelManager from base_kernelmanager import QtShellChannelMixin, QtIOPubChannelMixin, \ QtStdInChannelMixin, QtHBChannelMixin, QtKernelManagerMixin diff --git a/IPython/frontend/terminal/console/tests/test_image_handler.py b/IPython/frontend/terminal/console/tests/test_image_handler.py index b10df00..5de7195 100644 --- a/IPython/frontend/terminal/console/tests/test_image_handler.py +++ b/IPython/frontend/terminal/console/tests/test_image_handler.py @@ -10,7 +10,7 @@ import sys import unittest import base64 -from IPython.zmq.kernelmanager import KernelManager +from IPython.kernel.kernelmanager import KernelManager from IPython.frontend.terminal.console.interactiveshell \ import ZMQTerminalInteractiveShell from IPython.utils.tempdir import TemporaryDirectory diff --git a/IPython/inprocess/blockingkernelmanager.py b/IPython/inprocess/blockingkernelmanager.py index 38a2a08..e001073 100644 --- a/IPython/inprocess/blockingkernelmanager.py +++ b/IPython/inprocess/blockingkernelmanager.py @@ -19,7 +19,7 @@ from IPython.utils.io import raw_print from IPython.utils.traitlets import Type from kernelmanager import InProcessKernelManager, InProcessShellChannel, \ InProcessIOPubChannel, InProcessStdInChannel -from IPython.zmq.blockingkernelmanager import BlockingChannelMixin +from IPython.kernel.blockingkernelmanager import BlockingChannelMixin #----------------------------------------------------------------------------- diff --git a/IPython/inprocess/kernelmanager.py b/IPython/inprocess/kernelmanager.py index 9b78605..9d95a04 100644 --- a/IPython/inprocess/kernelmanager.py +++ b/IPython/inprocess/kernelmanager.py @@ -76,7 +76,7 @@ class InProcessChannel(object): class InProcessShellChannel(InProcessChannel): - """See `IPython.zmq.kernelmanager.ShellChannel` for docstrings.""" + """See `IPython.kernel.kernelmanager.ShellChannel` for docstrings.""" # flag for whether execute requests should be allowed to call raw_input allow_stdin = True @@ -141,14 +141,14 @@ class InProcessShellChannel(InProcessChannel): class InProcessIOPubChannel(InProcessChannel): - """See `IPython.zmq.kernelmanager.IOPubChannel` for docstrings.""" + """See `IPython.kernel.kernelmanager.IOPubChannel` for docstrings.""" def flush(self, timeout=1.0): pass class InProcessStdInChannel(InProcessChannel): - """See `IPython.zmq.kernelmanager.StdInChannel` for docstrings.""" + """See `IPython.kernel.kernelmanager.StdInChannel` for docstrings.""" def input(self, string): kernel = self.manager.kernel @@ -158,7 +158,7 @@ class InProcessStdInChannel(InProcessChannel): class InProcessHBChannel(InProcessChannel): - """See `IPython.zmq.kernelmanager.HBChannel` for docstrings.""" + """See `IPython.kernel.kernelmanager.HBChannel` for docstrings.""" time_to_dead = 3.0 @@ -187,7 +187,7 @@ class InProcessKernelManager(Configurable): `IPython.kernel.kernelmanagerabc.KernelManagerABC` and allows (asynchronous) frontends to be used seamlessly with an in-process kernel. - See `IPython.zmq.kernelmanager.KernelManager` for docstrings. + See `IPython.kernel.kernelmanager.KernelManager` for docstrings. """ # The Session to use for building messages. diff --git a/IPython/zmq/blockingkernelmanager.py b/IPython/kernel/blockingkernelmanager.py similarity index 100% rename from IPython/zmq/blockingkernelmanager.py rename to IPython/kernel/blockingkernelmanager.py diff --git a/IPython/zmq/kernelmanager.py b/IPython/kernel/kernelmanager.py similarity index 98% rename from IPython/zmq/kernelmanager.py rename to IPython/kernel/kernelmanager.py index 013482c..2f60c1a 100644 --- a/IPython/zmq/kernelmanager.py +++ b/IPython/kernel/kernelmanager.py @@ -15,7 +15,7 @@ TODO # Imports #----------------------------------------------------------------------------- -# Standard library imports. +# Standard library imports import atexit import errno import json @@ -26,14 +26,14 @@ import sys from threading import Thread import time -# System library imports. +# System library imports import zmq # import ZMQError in top-level namespace, to avoid ugly attribute-error messages # during garbage collection of threads at exit: from zmq import ZMQError from zmq.eventloop import ioloop, zmqstream -# Local imports. +# Local imports from IPython.config.configurable import Configurable from IPython.utils.localinterfaces import LOCALHOST, LOCAL_IPS from IPython.utils.traitlets import ( @@ -45,7 +45,7 @@ from IPython.kernel import ( make_ipkernel_cmd, launch_kernel, ) -from session import Session +from IPython.zmq.session import Session from IPython.kernel import ( ShellChannelABC, IOPubChannelABC, HBChannelABC, StdInChannelABC, diff --git a/IPython/kernel/kernelmanagerabc.py b/IPython/kernel/kernelmanagerabc.py index 61ba1ca..038e4de 100644 --- a/IPython/kernel/kernelmanagerabc.py +++ b/IPython/kernel/kernelmanagerabc.py @@ -42,7 +42,7 @@ class ShellChannelABC(ChannelABC): The docstrings for this class can be found in the base implementation: - `IPython.zmq.kernelmanager.ShellChannel` + `IPython.kernel.kernelmanager.ShellChannel` """ @abc.abstractproperty @@ -80,7 +80,7 @@ class IOPubChannelABC(ChannelABC): The docstrings for this class can be found in the base implementation: - `IPython.zmq.kernelmanager.IOPubChannel` + `IPython.kernel.kernelmanager.IOPubChannel` """ @abc.abstractmethod @@ -93,7 +93,7 @@ class StdInChannelABC(ChannelABC): The docstrings for this class can be found in the base implementation: - `IPython.zmq.kernelmanager.StdInChannel` + `IPython.kernel.kernelmanager.StdInChannel` """ @abc.abstractmethod @@ -106,7 +106,7 @@ class HBChannelABC(ChannelABC): The docstrings for this class can be found in the base implementation: - `IPython.zmq.kernelmanager.HBChannel` + `IPython.kernel.kernelmanager.HBChannel` """ @abc.abstractproperty @@ -135,7 +135,7 @@ class KernelManagerABC(object): The docstrings for this class can be found in the base implementation: - `IPython.zmq.kernelmanager.KernelManager` + `IPython.kernel.kernelmanager.KernelManager` """ __metaclass__ = abc.ABCMeta diff --git a/IPython/zmq/tests/test_message_spec.py b/IPython/kernel/tests/test_message_spec.py similarity index 100% rename from IPython/zmq/tests/test_message_spec.py rename to IPython/kernel/tests/test_message_spec.py diff --git a/IPython/zmq/__init__.py b/IPython/zmq/__init__.py index 230d221..183f345 100644 --- a/IPython/zmq/__init__.py +++ b/IPython/zmq/__init__.py @@ -45,7 +45,7 @@ def check_for_zmq(minimum_version, module='IPython.zmq'): check_for_zmq('2.1.11') patch_pyzmq() -from .blockingkernelmanager import BlockingKernelManager -from .kernelmanager import * +from IPython.kernel.blockingkernelmanager import BlockingKernelManager +from IPython.kernel.kernelmanager import * from .session import Session diff --git a/IPython/zmq/tests/test_embed_kernel.py b/IPython/zmq/tests/test_embed_kernel.py index dfb6938..e1cddab 100644 --- a/IPython/zmq/tests/test_embed_kernel.py +++ b/IPython/zmq/tests/test_embed_kernel.py @@ -22,7 +22,7 @@ from subprocess import Popen, PIPE import nose.tools as nt -from IPython.zmq.blockingkernelmanager import BlockingKernelManager +from IPython.kernel.blockingkernelmanager import BlockingKernelManager from IPython.utils import path, py3compat #------------------------------------------------------------------------------- diff --git a/IPython/zmq/tests/test_kernelmanager.py b/IPython/zmq/tests/test_kernelmanager.py index 1561722..44fbabf 100644 --- a/IPython/zmq/tests/test_kernelmanager.py +++ b/IPython/zmq/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.zmq.kernelmanager import KernelManager +from IPython.kernel.kernelmanager import KernelManager class TestKernelManager(TestCase):