__init__.py
31 lines
| 1.1 KiB
| text/x-python
|
PythonLexer
Min RK
|
r20952 | """ | ||
Min RK
|
r20956 | Shim to maintain backwards compatibility with old IPython.kernel imports. | ||
""" | ||||
Min RK
|
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.") | ||||
Min RK
|
r20956 | from IPython.utils.shimmodule import ShimModule | ||
Min RK
|
r20952 | |||
Min RK
|
r20957 | # zmq subdir is gone | ||
Min RK
|
r20956 | sys.modules['IPython.kernel.zmq.session'] = ShimModule('session', mirror='jupyter_client.session') | ||
Min RK
|
r20957 | sys.modules['IPython.kernel.zmq'] = ShimModule('zmq', mirror='ipython_kernel') | ||
Min RK
|
r20952 | |||
Min RK
|
r20958 | for pkg in ('comm', 'inprocess'): | ||
Min RK
|
r20956 | sys.modules['IPython.kernel.%s' % pkg] = ShimModule(pkg, mirror='ipython_kernel.%s' % pkg) | ||
Min RK
|
r20957 | |||
Min RK
|
r20956 | for pkg in ('ioloop', 'blocking'): | ||
sys.modules['IPython.kernel.%s' % pkg] = ShimModule(pkg, mirror='jupyter_client.%s' % pkg) | ||||
Min RK
|
r20952 | |||
Min RK
|
r20956 | # required for `from IPython.kernel import PKG` | ||
Min RK
|
r20958 | from ipython_kernel import comm, inprocess | ||
Min RK
|
r20956 | from jupyter_client import ioloop, blocking | ||
# public API | ||||
from ipython_kernel.connect import * | ||||
from jupyter_client import * | ||||