__init__.py
35 lines
| 1.1 KiB
| text/x-python
|
PythonLexer
|
r20952 | """ | ||
|
r20956 | Shim to maintain backwards compatibility with old IPython.kernel imports. | ||
""" | ||||
|
r20952 | # Copyright (c) IPython Development Team. | ||
# Distributed under the terms of the Modified BSD License. | ||||
import sys | ||||
from warnings import warn | ||||
warn("The `IPython.kernel` package has been deprecated. " | ||||
"You should import from ipython_kernel or jupyter_client instead.") | ||||
|
r20956 | from IPython.utils.shimmodule import ShimModule | ||
|
r20952 | |||
|
r20957 | # zmq subdir is gone | ||
|
r20990 | sys.modules['IPython.kernel.zmq.session'] = ShimModule( | ||
src='IPython.kernel.zmq.session', mirror='jupyter_client.session') | ||||
sys.modules['IPython.kernel.zmq'] = ShimModule( | ||||
src='IPython.kernel.zmq', mirror='ipython_kernel') | ||||
|
r20952 | |||
|
r20958 | for pkg in ('comm', 'inprocess'): | ||
|
r20990 | src = 'IPython.kernel.%s' % pkg | ||
sys.modules[src] = ShimModule(src=src, mirror='ipython_kernel.%s' % pkg) | ||||
|
r20957 | |||
|
r20956 | for pkg in ('ioloop', 'blocking'): | ||
|
r20990 | src = 'IPython.kernel.%s' % pkg | ||
sys.modules[src] = ShimModule(src=src, mirror='jupyter_client.%s' % pkg) | ||||
|
r20952 | |||
|
r20956 | # required for `from IPython.kernel import PKG` | ||
|
r20958 | from ipython_kernel import comm, inprocess | ||
|
r20956 | from jupyter_client import ioloop, blocking | ||
# public API | ||||
from ipython_kernel.connect import * | ||||
from jupyter_client import * | ||||