Пример #1
0
"""
Shim to maintain backwards compatibility with old yap_ipython.config imports.
"""
# Copyright (c) yap_ipython Development Team.
# Distributed under the terms of the Modified BSD License.

import sys
from warnings import warn

from yap_ipython.utils.shimmodule import ShimModule, ShimWarning

warn("The `yap_ipython.config` package has been deprecated since yap_ipython 4.0. "
     "You should import from traitlets.config instead.", ShimWarning)


# Unconditionally insert the shim into sys.modules so that further import calls
# trigger the custom attribute access above

sys.modules['yap_ipython.config'] = ShimModule(src='yap_ipython.config', mirror='traitlets.config')
Пример #2
0
Shim to maintain backwards compatibility with old yap_ipython.kernel imports.
"""
# Copyright (c) yap_ipython Development Team.
# Distributed under the terms of the Modified BSD License.

import sys
from warnings import warn

from yap_ipython.utils.shimmodule import ShimModule, ShimWarning

warn("The `yap_ipython.kernel` package has been deprecated since yap_ipython 4.0."
     "You should import from yap_kernel or jupyter_client instead.", ShimWarning)


# zmq subdir is gone
sys.modules['yap_ipython.kernel.zmq.session'] = ShimModule(
    src='yap_ipython.kernel.zmq.session', mirror='jupyter_client.session')
sys.modules['yap_ipython.kernel.zmq'] = ShimModule(
    src='yap_ipython.kernel.zmq', mirror='yap_kernel')

for pkg in ('comm', 'inprocess'):
    src = 'yap_ipython.kernel.%s' % pkg
    sys.modules[src] = ShimModule(src=src, mirror='yap_kernel.%s' % pkg)

for pkg in ('ioloop', 'blocking'):
    src = 'yap_ipython.kernel.%s' % pkg
    sys.modules[src] = ShimModule(src=src, mirror='jupyter_client.%s' % pkg)

# required for `from yap_ipython.kernel import PKG`
from yap_kernel import comm, inprocess
from jupyter_client import ioloop, blocking
# public API
Пример #3
0
"""
Shim to maintain backwards compatibility with old yap_ipython.html imports.
"""
# Copyright (c) yap_ipython Development Team.
# Distributed under the terms of the Modified BSD License.

import sys
from warnings import warn

from yap_ipython.utils.shimmodule import ShimModule, ShimWarning

warn("The `yap_ipython.html` package has been deprecated since yap_ipython 4.0. "
     "You should import from `notebook` instead. "
     "`yap_ipython.html.widgets` has moved to `ipywidgets`.", ShimWarning)

_widgets = sys.modules['yap_ipython.html.widgets'] = ShimModule(
    src='yap_ipython.html.widgets', mirror='ipywidgets')

_html = ShimModule(
    src='yap_ipython.html', mirror='notebook')

# hook up widgets
_html.widgets = _widgets
sys.modules['yap_ipython.html'] = _html

if __name__ == '__main__':
    from notebook import notebookapp as app
    app.launch_new_instance()
Пример #4
0
"""
Shim to maintain backwards compatibility with old frontend imports.

We have moved all contents of the old `frontend` subpackage into top-level
subpackages (`html`, `qt` and `terminal`), and flattened the notebook into
just `yap_ipython.html`, formerly `yap_ipython.frontend.html.notebook`.

This will let code that was making `from yap_ipython.frontend...` calls continue
working, though a warning will be printed.
"""

# Copyright (c) yap_ipython Development Team.
# Distributed under the terms of the Modified BSD License.

import sys
from warnings import warn

from yap_ipython.utils.shimmodule import ShimModule, ShimWarning

warn("The top-level `frontend` package has been deprecated since yap_ipython 1.0. "
     "All its subpackages have been moved to the top `yap_ipython` level.", ShimWarning)

# Unconditionally insert the shim into sys.modules so that further import calls
# trigger the custom attribute access above

sys.modules['yap_ipython.frontend.html.notebook'] = ShimModule(
    src='yap_ipython.frontend.html.notebook', mirror='yap_ipython.html')
sys.modules['yap_ipython.frontend'] = ShimModule(
    src='yap_ipython.frontend', mirror='yap_ipython')
Пример #5
0
"""
Shim to maintain backwards compatibility with old yap_ipython.nbconvert imports.
"""
# Copyright (c) yap_ipython Development Team.
# Distributed under the terms of the Modified BSD License.

import sys
from warnings import warn

from yap_ipython.utils.shimmodule import ShimModule, ShimWarning

warn("The `yap_ipython.nbconvert` package has been deprecated since yap_ipython 4.0. "
     "You should import from nbconvert instead.", ShimWarning)

# Unconditionally insert the shim into sys.modules so that further import calls
# trigger the custom attribute access above

sys.modules['yap_ipython.nbconvert'] = ShimModule(
    src='yap_ipython.nbconvert', mirror='nbconvert')
Пример #6
0
"""
Shim to maintain backwards compatibility with old yap_ipython.parallel imports.
"""
# Copyright (c) yap_ipython Development Team.
# Distributed under the terms of the Modified BSD License.

import sys
from warnings import warn

from yap_ipython.utils.shimmodule import ShimModule, ShimWarning

warn(
    "The `yap_ipython.parallel` package has been deprecated since yap_ipython 4.0. "
    "You should import from ipyparallel instead.", ShimWarning)

# Unconditionally insert the shim into sys.modules so that further import calls
# trigger the custom attribute access above

sys.modules['yap_ipython.parallel'] = ShimModule(src='yap_ipython.parallel',
                                                 mirror='ipyparallel')
Пример #7
0
"""
Shim to maintain backwards compatibility with old yap_ipython.nbformat imports.
"""
# Copyright (c) yap_ipython Development Team.
# Distributed under the terms of the Modified BSD License.

import sys
from warnings import warn

from yap_ipython.utils.shimmodule import ShimModule, ShimWarning

warn(
    "The `yap_ipython.nbformat` package has been deprecated since yap_ipython 4.0. "
    "You should import from nbformat instead.", ShimWarning)

# Unconditionally insert the shim into sys.modules so that further import calls
# trigger the custom attribute access above

sys.modules['yap_ipython.nbformat'] = ShimModule(src='yap_ipython.nbformat',
                                                 mirror='nbformat')
Пример #8
0
"""
Shim to maintain backwards compatibility with old yap_ipython.qt imports.
"""
# Copyright (c) yap_ipython Development Team.
# Distributed under the terms of the Modified BSD License.

import sys
from warnings import warn

from yap_ipython.utils.shimmodule import ShimModule, ShimWarning

warn(
    "The `yap_ipython.qt` package has been deprecated since yap_ipython 4.0. "
    "You should import from qtconsole instead.", ShimWarning)

# Unconditionally insert the shim into sys.modules so that further import calls
# trigger the custom attribute access above

_console = sys.modules['yap_ipython.qt.console'] = ShimModule(
    src='yap_ipython.qt.console', mirror='qtconsole')

_qt = ShimModule(src='yap_ipython.qt', mirror='qtconsole')

_qt.console = _console
sys.modules['yap_ipython.qt'] = _qt