__init__.py 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. """
  2. Shim to maintain backwards compatibility with old IPython.kernel imports.
  3. """
  4. # Copyright (c) IPython Development Team.
  5. # Distributed under the terms of the Modified BSD License.
  6. import sys
  7. from warnings import warn
  8. from IPython.utils.shimmodule import ShimModule, ShimWarning
  9. warn("The `IPython.kernel` package has been deprecated since IPython 4.0."
  10. "You should import from ipykernel or jupyter_client instead.", ShimWarning)
  11. # zmq subdir is gone
  12. sys.modules['IPython.kernel.zmq.session'] = ShimModule(
  13. src='IPython.kernel.zmq.session', mirror='jupyter_client.session')
  14. sys.modules['IPython.kernel.zmq'] = ShimModule(
  15. src='IPython.kernel.zmq', mirror='ipykernel')
  16. for pkg in ('comm', 'inprocess'):
  17. src = 'IPython.kernel.%s' % pkg
  18. sys.modules[src] = ShimModule(src=src, mirror='ipykernel.%s' % pkg)
  19. for pkg in ('ioloop', 'blocking'):
  20. src = 'IPython.kernel.%s' % pkg
  21. sys.modules[src] = ShimModule(src=src, mirror='jupyter_client.%s' % pkg)
  22. # required for `from IPython.kernel import PKG`
  23. from ipykernel import comm, inprocess
  24. from jupyter_client import ioloop, blocking
  25. # public API
  26. from ipykernel.connect import *
  27. from jupyter_client import *