diff --git a/IPython/__init__.py b/IPython/__init__.py index 626fb67..86d5610 100644 --- a/IPython/__init__.py +++ b/IPython/__init__.py @@ -81,5 +81,5 @@ def embed_kernel(module=None, local_ns=None, **kwargs): local_ns = caller_locals # Only import .zmq when we really need it - from .zmq.embed import embed_kernel as real_embed_kernel + from IPython.kernel.zmq.embed import embed_kernel as real_embed_kernel real_embed_kernel(module=module, local_ns=local_ns, **kwargs) diff --git a/IPython/frontend/qt/inprocess_kernelmanager.py b/IPython/frontend/qt/inprocess_kernelmanager.py index 3f70062..326a5e1 100644 --- a/IPython/frontend/qt/inprocess_kernelmanager.py +++ b/IPython/frontend/qt/inprocess_kernelmanager.py @@ -2,7 +2,7 @@ """ # Local imports. -from IPython.inprocess.kernelmanager import \ +from IPython.kernel.inprocess.kernelmanager import \ InProcessShellChannel, InProcessIOPubChannel, InProcessStdInChannel, \ InProcessHBChannel, InProcessKernelManager from IPython.utils.traitlets import Type diff --git a/IPython/inprocess/__init__.py b/IPython/kernel/inprocess/__init__.py similarity index 100% rename from IPython/inprocess/__init__.py rename to IPython/kernel/inprocess/__init__.py diff --git a/IPython/inprocess/blockingkernelmanager.py b/IPython/kernel/inprocess/blockingkernelmanager.py similarity index 100% rename from IPython/inprocess/blockingkernelmanager.py rename to IPython/kernel/inprocess/blockingkernelmanager.py diff --git a/IPython/inprocess/ipkernel.py b/IPython/kernel/inprocess/ipkernel.py similarity index 96% rename from IPython/inprocess/ipkernel.py rename to IPython/kernel/inprocess/ipkernel.py index a5a3e28..1470986 100644 --- a/IPython/inprocess/ipkernel.py +++ b/IPython/kernel/inprocess/ipkernel.py @@ -1,4 +1,4 @@ -""" An in-process kernel. """ +"""An in-process kernel""" #----------------------------------------------------------------------------- # Copyright (C) 2012 The IPython Development Team @@ -16,14 +16,15 @@ from contextlib import contextmanager import logging import sys -# Local imports. +# Local imports from IPython.core.interactiveshell import InteractiveShellABC -from IPython.inprocess.socket import DummySocket from IPython.utils.jsonutil import json_clean from IPython.utils.traitlets import Any, Enum, Instance, List, Type from IPython.kernel.zmq.ipkernel import Kernel from IPython.kernel.zmq.zmqshell import ZMQInteractiveShell +from .socket import DummySocket + #----------------------------------------------------------------------------- # Main kernel class #----------------------------------------------------------------------------- @@ -36,7 +37,7 @@ class InProcessKernel(Kernel): # The frontends connected to this kernel. frontends = List( - Instance('IPython.inprocess.kernelmanager.InProcessKernelManager')) + Instance('IPython.kernel.inprocess.kernelmanager.InProcessKernelManager')) # The GUI environment that the kernel is running under. This need not be # specified for the normal operation for the kernel, but is required for @@ -151,7 +152,7 @@ class InProcessKernel(Kernel): class InProcessInteractiveShell(ZMQInteractiveShell): - kernel = Instance('IPython.inprocess.ipkernel.InProcessKernel') + kernel = Instance('IPython.kernel.inprocess.ipkernel.InProcessKernel') #------------------------------------------------------------------------- # InteractiveShell interface diff --git a/IPython/inprocess/kernelmanager.py b/IPython/kernel/inprocess/kernelmanager.py similarity index 99% rename from IPython/inprocess/kernelmanager.py rename to IPython/kernel/inprocess/kernelmanager.py index 60021fd..1848ab6 100644 --- a/IPython/inprocess/kernelmanager.py +++ b/IPython/kernel/inprocess/kernelmanager.py @@ -13,7 +13,6 @@ # Local imports. from IPython.config.configurable import Configurable -from IPython.inprocess.socket import DummySocket from IPython.utils.traitlets import Any, Instance, Type from IPython.kernel import ( ShellChannelABC, IOPubChannelABC, @@ -21,6 +20,8 @@ from IPython.kernel import ( KernelManagerABC ) +from .socket import DummySocket + #----------------------------------------------------------------------------- # Channel classes #----------------------------------------------------------------------------- @@ -197,7 +198,7 @@ class InProcessKernelManager(Configurable): return Session(config=self.config) # The kernel process with which the KernelManager is communicating. - kernel = Instance('IPython.inprocess.ipkernel.InProcessKernel') + kernel = Instance('IPython.kernel.inprocess.ipkernel.InProcessKernel') # The classes to use for the various channels. shell_channel_class = Type(InProcessShellChannel) @@ -272,7 +273,7 @@ class InProcessKernelManager(Configurable): #-------------------------------------------------------------------------- def start_kernel(self, **kwds): - from IPython.inprocess.ipkernel import InProcessKernel + from IPython.kernel.inprocess.ipkernel import InProcessKernel self.kernel = InProcessKernel() self.kernel.frontends.append(self) diff --git a/IPython/inprocess/socket.py b/IPython/kernel/inprocess/socket.py similarity index 100% rename from IPython/inprocess/socket.py rename to IPython/kernel/inprocess/socket.py diff --git a/IPython/inprocess/tests/__init__.py b/IPython/kernel/inprocess/tests/__init__.py similarity index 100% rename from IPython/inprocess/tests/__init__.py rename to IPython/kernel/inprocess/tests/__init__.py diff --git a/IPython/inprocess/tests/test_kernel.py b/IPython/kernel/inprocess/tests/test_kernel.py similarity index 97% rename from IPython/inprocess/tests/test_kernel.py rename to IPython/kernel/inprocess/tests/test_kernel.py index b40ed60..bc0657f 100644 --- a/IPython/inprocess/tests/test_kernel.py +++ b/IPython/kernel/inprocess/tests/test_kernel.py @@ -16,9 +16,9 @@ import sys import unittest # Local imports -from IPython.inprocess.blockingkernelmanager import \ +from IPython.kernel.inprocess.blockingkernelmanager import \ BlockingInProcessKernelManager -from IPython.inprocess.ipkernel import InProcessKernel +from IPython.kernel.inprocess.ipkernel import InProcessKernel from IPython.testing.decorators import skipif_not_matplotlib from IPython.utils.io import capture_output from IPython.utils import py3compat diff --git a/IPython/inprocess/tests/test_kernelmanager.py b/IPython/kernel/inprocess/tests/test_kernelmanager.py similarity index 97% rename from IPython/inprocess/tests/test_kernelmanager.py rename to IPython/kernel/inprocess/tests/test_kernelmanager.py index 3a2b9e9..df1ad24 100644 --- a/IPython/inprocess/tests/test_kernelmanager.py +++ b/IPython/kernel/inprocess/tests/test_kernelmanager.py @@ -14,9 +14,9 @@ from __future__ import print_function import unittest # Local imports -from IPython.inprocess.blockingkernelmanager import \ +from IPython.kernel.inprocess.blockingkernelmanager import \ BlockingInProcessKernelManager -from IPython.inprocess.ipkernel import InProcessKernel +from IPython.kernel.inprocess.ipkernel import InProcessKernel #----------------------------------------------------------------------------- # Test case diff --git a/IPython/kernel/zmq/tests/test_kernelmanager.py b/IPython/kernel/tests/test_kernelmanager.py similarity index 100% rename from IPython/kernel/zmq/tests/test_kernelmanager.py rename to IPython/kernel/tests/test_kernelmanager.py diff --git a/IPython/kernel/zmq/datapub.py b/IPython/kernel/zmq/datapub.py index 2bd8a30..1d48ae4 100644 --- a/IPython/kernel/zmq/datapub.py +++ b/IPython/kernel/zmq/datapub.py @@ -13,7 +13,7 @@ #----------------------------------------------------------------------------- from IPython.config import Configurable -from IPython.inprocess.socket import SocketABC +from IPython.kernel.inprocess.socket import SocketABC from IPython.utils.jsonutil import json_clean from IPython.utils.traitlets import Instance, Dict, CBytes from IPython.kernel.zmq.serialize import serialize_object diff --git a/IPython/kernel/zmq/displayhook.py b/IPython/kernel/zmq/displayhook.py index 3d31f23..bcfd01a 100644 --- a/IPython/kernel/zmq/displayhook.py +++ b/IPython/kernel/zmq/displayhook.py @@ -2,7 +2,7 @@ import __builtin__ import sys from IPython.core.displayhook import DisplayHook -from IPython.inprocess.socket import SocketABC +from IPython.kernel.inprocess.socket import SocketABC from IPython.utils.jsonutil import encode_images from IPython.utils.traitlets import Instance, Dict from session import extract_header, Session diff --git a/IPython/kernel/zmq/zmqshell.py b/IPython/kernel/zmq/zmqshell.py index 8bc7c0b..3015f59 100644 --- a/IPython/kernel/zmq/zmqshell.py +++ b/IPython/kernel/zmq/zmqshell.py @@ -34,7 +34,7 @@ from IPython.core.error import UsageError from IPython.core.magics import MacroToEdit, CodeMagics from IPython.core.magic import magics_class, line_magic, Magics from IPython.core.payloadpage import install_payload_page -from IPython.inprocess.socket import SocketABC +from IPython.kernel.inprocess.socket import SocketABC from IPython.kernel import ( get_connection_file, get_connection_info, connect_qtconsole ) diff --git a/IPython/testing/iptest.py b/IPython/testing/iptest.py index 2fd4b4c..4680305 100644 --- a/IPython/testing/iptest.py +++ b/IPython/testing/iptest.py @@ -238,6 +238,9 @@ def make_exclude(): if not have['wx']: exclusions.append(ipjoin('lib', 'inputhookwx')) + if 'IPython.kernel.inprocess' not in sys.argv: + exclusions.append(ipjoin('kernel', 'inprocess')) + # FIXME: temporarily disable autoreload tests, as they can produce # spurious failures in subsequent tests (cythonmagic). exclusions.append(ipjoin('extensions', 'autoreload')) @@ -246,7 +249,7 @@ def make_exclude(): # We do this unconditionally, so that the test suite doesn't import # gtk, changing the default encoding and masking some unicode bugs. exclusions.append(ipjoin('lib', 'inputhookgtk')) - exclusions.append(ipjoin('zmq', 'gui', 'gtkembed')) + exclusions.append(ipjoin('kernel', 'zmq', 'gui', 'gtkembed')) # These have to be skipped on win32 because the use echo, rm, cd, etc. # See ticket https://github.com/ipython/ipython/issues/87 @@ -261,7 +264,7 @@ def make_exclude(): ]) if not have['zmq']: - exclusions.append(ipjoin('zmq')) + exclusions.append(ipjoin('kernel')) exclusions.append(ipjoin('frontend', 'qt')) exclusions.append(ipjoin('frontend', 'html')) exclusions.append(ipjoin('frontend', 'consoleapp.py')) @@ -277,7 +280,7 @@ def make_exclude(): if not have['matplotlib']: exclusions.extend([ipjoin('core', 'pylabtools'), ipjoin('core', 'tests', 'test_pylabtools'), - ipjoin('zmq', 'pylab'), + ipjoin('kernel', 'zmq', 'pylab'), ]) if not have['cython']: @@ -430,11 +433,12 @@ def make_runners(inc_slow=False): """ # Packages to be tested via nose, that only depend on the stdlib - nose_pkg_names = ['config', 'core', 'extensions', 'frontend', 'kernel', 'lib', - 'testing', 'utils', 'nbformat', 'inprocess' ] + nose_pkg_names = ['config', 'core', 'extensions', 'frontend', 'lib', + 'testing', 'utils', 'nbformat' ] if have['zmq']: - nose_pkg_names.append('zmq') + nose_pkg_names.append('kernel') + nose_pkg_names.append('kernel.inprocess') if inc_slow: nose_pkg_names.append('parallel') @@ -502,7 +506,7 @@ def run_iptest(): # assumptions about what needs to be a singleton and what doesn't (app # objects should, individual shells shouldn't). But for now, this # workaround allows the test suite for the inprocess module to complete. - if not 'IPython.inprocess' in sys.argv: + if not 'IPython.kernel.inprocess' in sys.argv: globalipapp.start_ipython() # Now nose can run