##// END OF EJS Templates
jupyter_notebook imports
Min RK -
Show More
@@ -1,3 +1,3
1 1 if __name__ == '__main__':
2 from IPython.html import notebookapp as app
2 from jupyter_notebook import notebookapp as app
3 3 app.launch_new_instance()
@@ -29,9 +29,9 from IPython.utils.sysinfo import get_sys_info
29 29 from IPython.config import Application
30 30 from IPython.utils.path import filefind
31 31 from IPython.utils.py3compat import string_types
32 from IPython.html.utils import is_hidden, url_path_join, url_escape
32 from jupyter_notebook.utils import is_hidden, url_path_join, url_escape
33 33
34 from IPython.html.services.security import csp_report_uri
34 from jupyter_notebook.services.security import csp_report_uri
35 35
36 36 #-----------------------------------------------------------------------------
37 37 # Top-level handlers
@@ -90,7 +90,7 WS_PING_INTERVAL = 30000
90 90 if os.environ.get('IPYTHON_ALLOW_DRAFT_WEBSOCKETS_FOR_PHANTOMJS', False):
91 91 warnings.warn("""Allowing draft76 websocket connections!
92 92 This should only be done for testing with phantomjs!""")
93 from IPython.html import allow76
93 from jupyter_notebook import allow76
94 94 WebSocketHandler = allow76.AllowDraftWebSocketHandler
95 95 # draft 76 doesn't support ping
96 96 WS_PING_INTERVAL = 0
@@ -10,7 +10,7 import base64
10 10
11 11 from tornado import web
12 12
13 from IPython.html.base.handlers import IPythonHandler
13 from jupyter_notebook.base.handlers import IPythonHandler
14 14
15 15 class FilesHandler(IPythonHandler):
16 16 """serve files via ContentsManager"""
@@ -8,8 +8,8 import shutil
8 8
9 9 import requests
10 10
11 from IPython.html.utils import url_path_join
12 from IPython.html.tests.launchnotebook import NotebookTestBase, assert_http_error
11 from jupyter_notebook.utils import url_path_join
12 from jupyter_notebook.tests.launchnotebook import NotebookTestBase, assert_http_error
13 13 from IPython.nbformat import write
14 14 from IPython.nbformat.v4 import (
15 15 new_notebook, new_markdown_cell, new_code_cell, new_output,
@@ -49,7 +49,7 from tornado import httpserver
49 49 from tornado import web
50 50 from tornado.log import LogFormatter, app_log, access_log, gen_log
51 51
52 from IPython.html import (
52 from jupyter_notebook import (
53 53 DEFAULT_STATIC_FILES_PATH,
54 54 DEFAULT_TEMPLATE_PATH_LIST,
55 55 )
@@ -116,7 +116,7 def random_ports(port, n):
116 116
117 117 def load_handlers(name):
118 118 """Load the (URL pattern, handler) tuples for each component."""
119 name = 'IPython.html.' + name
119 name = 'jupyter_notebook.' + name
120 120 mod = __import__(name, fromlist=['default_handlers'])
121 121 return mod.default_handlers
122 122
@@ -576,7 +576,7 class NotebookApp(BaseIPythonApplication):
576 576 extra_template_paths = List(Unicode, config=True,
577 577 help="""Extra paths to search for serving jinja templates.
578 578
579 Can be used to override templates from IPython.html.templates."""
579 Can be used to override templates from jupyter_notebook.templates."""
580 580 )
581 581 def _extra_template_paths_default(self):
582 582 return []
@@ -5,8 +5,8 import json
5 5
6 6 import requests
7 7
8 from IPython.html.utils import url_path_join
9 from IPython.html.tests.launchnotebook import NotebookTestBase
8 from jupyter_notebook.utils import url_path_join
9 from jupyter_notebook.tests.launchnotebook import NotebookTestBase
10 10
11 11
12 12 class ConfigAPI(object):
@@ -15,7 +15,7 import tempfile
15 15
16 16 from tornado.web import HTTPError
17 17
18 from IPython.html.utils import (
18 from jupyter_notebook.utils import (
19 19 to_api_path,
20 20 to_os_path,
21 21 )
@@ -20,7 +20,7 from IPython.utils.importstring import import_item
20 20 from IPython.utils.traitlets import Any, Unicode, Bool, TraitError
21 21 from IPython.utils.py3compat import getcwd, string_types
22 22 from IPython.utils import tz
23 from IPython.html.utils import (
23 from jupyter_notebook.utils import (
24 24 is_hidden,
25 25 to_api_path,
26 26 )
@@ -7,10 +7,10 import json
7 7
8 8 from tornado import gen, web
9 9
10 from IPython.html.utils import url_path_join, url_escape
10 from jupyter_notebook.utils import url_path_join, url_escape
11 11 from jupyter_client.jsonutil import date_default
12 12
13 from IPython.html.base.handlers import (
13 from jupyter_notebook.base.handlers import (
14 14 IPythonHandler, json_errors, path_regex,
15 15 )
16 16
@@ -16,8 +16,8 import requests
16 16 from ..filecheckpoints import GenericFileCheckpoints
17 17
18 18 from IPython.config import Config
19 from IPython.html.utils import url_path_join, url_escape, to_os_path
20 from IPython.html.tests.launchnotebook import NotebookTestBase, assert_http_error
19 from jupyter_notebook.utils import url_path_join, url_escape, to_os_path
20 from jupyter_notebook.tests.launchnotebook import NotebookTestBase, assert_http_error
21 21 from IPython.nbformat import read, write, from_dict
22 22 from IPython.nbformat.v4 import (
23 23 new_notebook, new_markdown_cell,
@@ -11,7 +11,7 from tornado.ioloop import IOLoop
11 11
12 12 from jupyter_client.jsonutil import date_default
13 13 from IPython.utils.py3compat import cast_unicode
14 from IPython.html.utils import url_path_join, url_escape
14 from jupyter_notebook.utils import url_path_join, url_escape
15 15
16 16 from ...base.handlers import IPythonHandler, json_errors
17 17 from ...base.zmqhandlers import AuthenticatedZMQStreamHandler, deserialize_binary_message
@@ -14,7 +14,7 from tornado import web
14 14 from IPython.kernel.multikernelmanager import MultiKernelManager
15 15 from IPython.utils.traitlets import List, Unicode, TraitError
16 16
17 from IPython.html.utils import to_os_path
17 from jupyter_notebook.utils import to_os_path
18 18 from IPython.utils.py3compat import getcwd
19 19
20 20
@@ -5,8 +5,8 import requests
5 5
6 6 from jupyter_client.kernelspec import NATIVE_KERNEL_NAME
7 7
8 from IPython.html.utils import url_path_join
9 from IPython.html.tests.launchnotebook import NotebookTestBase, assert_http_error
8 from jupyter_notebook.utils import url_path_join
9 from jupyter_notebook.tests.launchnotebook import NotebookTestBase, assert_http_error
10 10
11 11 class KernelAPI(object):
12 12 """Wrapper for kernel REST API requests"""
@@ -12,8 +12,8 pjoin = os.path.join
12 12 import requests
13 13
14 14 from IPython.kernel.kernelspec import NATIVE_KERNEL_NAME
15 from IPython.html.utils import url_path_join
16 from IPython.html.tests.launchnotebook import NotebookTestBase, assert_http_error
15 from jupyter_notebook.utils import url_path_join
16 from jupyter_notebook.tests.launchnotebook import NotebookTestBase, assert_http_error
17 17
18 18 # Copied from IPython.kernel.tests.test_kernelspec so updating that doesn't
19 19 # break these tests
@@ -1,7 +1,7
1 1 import requests
2 2
3 from IPython.html.utils import url_path_join
4 from IPython.html.tests.launchnotebook import NotebookTestBase
3 from jupyter_notebook.utils import url_path_join
4 from jupyter_notebook.tests.launchnotebook import NotebookTestBase
5 5
6 6 class NbconvertAPI(object):
7 7 """Wrapper for nbconvert API calls."""
@@ -9,7 +9,7 from tornado import web
9 9
10 10 from ...base.handlers import IPythonHandler, json_errors
11 11 from jupyter_client.jsonutil import date_default
12 from IPython.html.utils import url_path_join, url_escape
12 from jupyter_notebook.utils import url_path_join, url_escape
13 13 from IPython.kernel.kernelspec import NoSuchKernel
14 14
15 15
@@ -15,8 +15,8 from IPython.utils.traitlets import Instance
15 15
16 16 class SessionManager(LoggingConfigurable):
17 17
18 kernel_manager = Instance('IPython.html.services.kernels.kernelmanager.MappingKernelManager')
19 contents_manager = Instance('IPython.html.services.contents.manager.ContentsManager')
18 kernel_manager = Instance('jupyter_notebook.services.kernels.kernelmanager.MappingKernelManager')
19 contents_manager = Instance('jupyter_notebook.services.contents.manager.ContentsManager')
20 20
21 21 # Session database initialized below
22 22 _cursor = None
@@ -5,8 +5,8 from unittest import TestCase
5 5 from tornado import web
6 6
7 7 from ..sessionmanager import SessionManager
8 from IPython.html.services.kernels.kernelmanager import MappingKernelManager
9 from IPython.html.services.contents.manager import ContentsManager
8 from jupyter_notebook.services.kernels.kernelmanager import MappingKernelManager
9 from jupyter_notebook.services.contents.manager import ContentsManager
10 10
11 11 class DummyKernel(object):
12 12 def __init__(self, kernel_name='python'):
@@ -10,8 +10,8 import time
10 10
11 11 pjoin = os.path.join
12 12
13 from IPython.html.utils import url_path_join
14 from IPython.html.tests.launchnotebook import NotebookTestBase, assert_http_error
13 from jupyter_notebook.utils import url_path_join
14 from jupyter_notebook.tests.launchnotebook import NotebookTestBase, assert_http_error
15 15 from IPython.nbformat.v4 import new_notebook
16 16 from IPython.nbformat import write
17 17
@@ -299,7 +299,7 define([
299 299 * JS:
300 300 * IPython.notebook.kernel.widget_manager.create_model({
301 301 * model_name: 'WidgetModel',
302 * widget_class: 'IPython.html.widgets.widget_int.IntSlider'})
302 * widget_class: 'jupyter_notebook.widgets.widget_int.IntSlider'})
303 303 * .then(function(model) { console.log('Create success!', model); },
304 304 * $.proxy(console.error, console));
305 305 *
@@ -8,7 +8,7 if not check_version(terminado.__version__, '0.3.3'):
8 8
9 9 from terminado import NamedTermManager
10 10 from tornado.log import app_log
11 from IPython.html.utils import url_path_join as ujoin
11 from jupyter_notebook.utils import url_path_join as ujoin
12 12 from .handlers import TerminalHandler, TermSocket
13 13 from . import api_handlers
14 14
@@ -15,7 +15,7 from IPython.nbformat.v4 import (new_notebook,
15 15 new_markdown_cell, new_code_cell,
16 16 new_output)
17 17
18 from IPython.html.utils import url_path_join
18 from jupyter_notebook.utils import url_path_join
19 19 from .launchnotebook import NotebookTestBase
20 20 from IPython.utils import py3compat
21 21
@@ -22,8 +22,8 except ImportError:
22 22 import IPython.testing.decorators as dec
23 23 from IPython.utils import py3compat
24 24 from IPython.utils.tempdir import TemporaryDirectory
25 from IPython.html import nbextensions
26 from IPython.html.nbextensions import install_nbextension, check_nbextension
25 from jupyter_notebook import nbextensions
26 from jupyter_notebook.nbextensions import install_nbextension, check_nbextension
27 27
28 28
29 29 def touch(file, mtime=None):
@@ -11,13 +11,13 from traitlets.tests.utils import check_help_all_output
11 11
12 12 from IPython.utils.tempdir import TemporaryDirectory
13 13 from IPython.utils.traitlets import TraitError
14 from IPython.html import notebookapp
14 from jupyter_notebook import notebookapp
15 15 NotebookApp = notebookapp.NotebookApp
16 16
17 17
18 18 def test_help_output():
19 19 """ipython notebook --help-all works"""
20 check_help_all_output('IPython.html')
20 check_help_all_output('jupyter_notebook')
21 21
22 22 def test_server_info_file():
23 23 nbapp = NotebookApp(profile='nbserver_file_test', log=logging.getLogger())
@@ -2,7 +2,7
2 2 import re
3 3 import nose.tools as nt
4 4
5 from IPython.html.base.handlers import path_regex
5 from jupyter_notebook.base.handlers import path_regex
6 6
7 7 try: # py3
8 8 assert_regex = nt.assert_regex
@@ -8,14 +8,14 import os
8 8 import nose.tools as nt
9 9
10 10 from traitlets.tests.utils import check_help_all_output
11 from IPython.html.utils import url_escape, url_unescape, is_hidden
11 from jupyter_notebook.utils import url_escape, url_unescape, is_hidden
12 12 from IPython.utils.tempdir import TemporaryDirectory
13 13
14 14
15 15 def test_help_output():
16 16 """jupyter notebook --help-all works"""
17 17 # FIXME: will be jupyter_notebook
18 check_help_all_output('IPython.html')
18 check_help_all_output('jupyter_notebook')
19 19
20 20
21 21 def test_url_escape():
@@ -18,7 +18,7 casper.notebook_test(function () {
18 18 this.evaluate(function() {
19 19 IPython.notebook.kernel.widget_manager.create_model({
20 20 model_name: 'WidgetModel',
21 widget_class: 'IPython.html.widgets.widget_int.IntSlider'})
21 widget_class: 'jupyter_notebook.widgets.widget_int.IntSlider'})
22 22 .then(function(model) {
23 23 console.log('Create success!', model);
24 24 window.slider_id = model.id;
@@ -34,7 +34,7 casper.notebook_test(function () {
34 34 });
35 35
36 36 index = this.append_cell(
37 'from IPython.html.widgets import Widget\n' +
37 'from jupyter_notebook.widgets import Widget\n' +
38 38 'widget = list(Widget.widgets.values())[0]\n' +
39 39 'print(widget.model_id)');
40 40 this.execute_cell_then(index, function(index) {
@@ -45,7 +45,7 casper.notebook_test(function () {
45 45
46 46 // Widget persistence tests.
47 47 index = this.append_cell(
48 'from IPython.html.widgets import HTML\n' +
48 'from jupyter_notebook.widgets import HTML\n' +
49 49 'from IPython.display import display\n' +
50 50 'display(HTML(value="<div id=\'hello\'></div>"))');
51 51 this.execute_cell_then(index, function() {});
@@ -40,7 +40,7 casper.notebook_test(function () {
40 40 var index;
41 41
42 42 index = this.append_cell(
43 ['from IPython.html import widgets',
43 ['from jupyter_notebook import widgets',
44 44 'from IPython.display import display, clear_output',
45 45 'print("Success")'].join('\n'));
46 46 this.execute_cell_then(index);
@@ -184,7 +184,7 casper.notebook_test(function () {
184 184
185 185 var testwidget = {};
186 186 this.append_cell_execute_then([
187 'from IPython.html import widgets',
187 'from jupyter_notebook import widgets',
188 188 'from IPython.utils.traitlets import Unicode, Instance, List',
189 189 'from IPython.display import display',
190 190 'from array import array',
@@ -4,7 +4,7 casper.notebook_test(function () {
4 4
5 5 // Create a checkbox and togglebutton.
6 6 var bool_index = this.append_cell(
7 'from IPython.html import widgets\n' +
7 'from jupyter_notebook import widgets\n' +
8 8 'from IPython.display import display, clear_output\n' +
9 9 'bool_widgets = [widgets.Checkbox(description="Title", value=True),\n' +
10 10 ' widgets.ToggleButton(description="Title", value=True)]\n' +
@@ -3,7 +3,7 casper.notebook_test(function () {
3 3
4 4 // Create a box widget.
5 5 var container_index = this.append_cell(
6 'from IPython.html import widgets\n' +
6 'from jupyter_notebook import widgets\n' +
7 7 'from IPython.display import display, clear_output\n' +
8 8 'container = widgets.Box()\n' +
9 9 'button = widgets.Button()\n'+
@@ -1,7 +1,7
1 1 // Test widget button class
2 2 casper.notebook_test(function () {
3 3 var button_index = this.append_cell(
4 'from IPython.html import widgets\n' +
4 'from jupyter_notebook import widgets\n' +
5 5 'from IPython.display import display, clear_output\n' +
6 6 'button = widgets.Button(description="Title")\n' +
7 7 'display(button)\n' +
@@ -3,7 +3,7 casper.notebook_test(function () {
3 3 var float_text = {};
4 4 float_text.query = '.widget-area .widget-subarea .my-second-float-text input';
5 5 float_text.index = this.append_cell(
6 'from IPython.html import widgets\n' +
6 'from jupyter_notebook import widgets\n' +
7 7 'from IPython.display import display, clear_output\n' +
8 8 'float_widget = widgets.FloatText()\n' +
9 9 'display(float_widget)\n' +
@@ -2,7 +2,7
2 2 casper.notebook_test(function () {
3 3 "use strict";
4 4 var index = this.append_cell(
5 'from IPython.html import widgets\n' +
5 'from jupyter_notebook import widgets\n' +
6 6 'from IPython.display import display, clear_output\n' +
7 7 'print("Success")');
8 8 this.execute_cell_then(index);
@@ -3,7 +3,7 casper.notebook_test(function () {
3 3 var int_text = {};
4 4 int_text.query = '.widget-area .widget-subarea .my-second-int-text input';
5 5 int_text.index = this.append_cell(
6 'from IPython.html import widgets\n' +
6 'from jupyter_notebook import widgets\n' +
7 7 'from IPython.display import display, clear_output\n' +
8 8 'int_widget = widgets.IntText()\n' +
9 9 'display(int_widget)\n' +
@@ -1,7 +1,7
1 1 // Test selection class
2 2 casper.notebook_test(function () {
3 3 index = this.append_cell(
4 'from IPython.html import widgets\n' +
4 'from jupyter_notebook import widgets\n' +
5 5 'from IPython.display import display, clear_output\n' +
6 6 'print("Success")');
7 7 this.execute_cell_then(index);
@@ -1,7 +1,7
1 1 // Test multicontainer class
2 2 casper.notebook_test(function () {
3 3 index = this.append_cell(
4 'from IPython.html import widgets\n' +
4 'from jupyter_notebook import widgets\n' +
5 5 'from IPython.display import display, clear_output\n' +
6 6 'print("Success")');
7 7 this.execute_cell_then(index);
@@ -1,7 +1,7
1 1 // Test widget string class
2 2 casper.notebook_test(function () {
3 3 var string_index = this.append_cell(
4 'from IPython.html import widgets\n' +
4 'from jupyter_notebook import widgets\n' +
5 5 'from IPython.display import display, clear_output\n' +
6 6 'string_widget = [widgets.Text(value = "xyz", placeholder = "abc"),\n' +
7 7 ' widgets.Textarea(value = "xyz", placeholder = "def"),\n' +
@@ -1,13 +1,13
1 1 """Test the /tree handlers"""
2 2 import os
3 3 import io
4 from IPython.html.utils import url_path_join
4 from jupyter_notebook.utils import url_path_join
5 5 from IPython.nbformat import write
6 6 from IPython.nbformat.v4 import new_notebook
7 7
8 8 import requests
9 9
10 from IPython.html.tests.launchnotebook import NotebookTestBase
10 from jupyter_notebook.tests.launchnotebook import NotebookTestBase
11 11
12 12 class TreeTest(NotebookTestBase):
13 13 def setUp(self):
@@ -31,10 +31,10 from .widget_string import HTMLWidget, LatexWidget, TextWidget, TextareaWidget
31 31 # To ignore this warning, do:
32 32 #
33 33 # from warnings import filterwarnings
34 # filterwarnings('ignore', module='IPython.html.widgets')
34 # filterwarnings('ignore', module='jupyter_notebook.widgets')
35 35
36 36 from warnings import warn_explicit
37 37 __warningregistry__ = {}
38 38 warn_explicit("IPython widgets are experimental and may change in the future.",
39 FutureWarning, '', 0, module = 'IPython.html.widgets',
39 FutureWarning, '', 0, module = 'jupyter_notebook.widgets',
40 40 registry = __warningregistry__, module_globals = globals)
@@ -12,7 +12,7 except ImportError:
12 12 from inspect import getcallargs
13 13
14 14 from IPython.core.getipython import get_ipython
15 from IPython.html.widgets import (Widget, Text,
15 from jupyter_notebook.widgets import (Widget, Text,
16 16 FloatSlider, IntSlider, Checkbox, Dropdown,
17 17 Box, Button, DOMWidget)
18 18 from IPython.display import display, clear_output
@@ -13,8 +13,8 except ImportError:
13 13 import nose.tools as nt
14 14
15 15 from IPython.kernel.comm import Comm
16 from IPython.html import widgets
17 from IPython.html.widgets import interact, interactive, Widget, interaction
16 from jupyter_notebook import widgets
17 from jupyter_notebook.widgets import interact, interactive, Widget, interaction
18 18 from IPython.utils.py3compat import annotate
19 19
20 20 #-----------------------------------------------------------------------------
@@ -6,7 +6,7
6 6 from unittest import TestCase
7 7 from IPython.utils.traitlets import HasTraits
8 8 from traitlets.tests.test_traitlets import TraitTestBase
9 from IPython.html.widgets import Color, EventfulDict, EventfulList
9 from jupyter_notebook.widgets import Color, EventfulDict, EventfulList
10 10
11 11
12 12 class ColorTrait(HasTraits):
@@ -21,7 +21,7 class Output(DOMWidget):
21 21 displayed in it instead of the standard output area.
22 22
23 23 Example
24 from IPython.html import widgets
24 from jupyter_notebook import widgets
25 25 from IPython.display import display
26 26 out = widgets.Output()
27 27 display(out)
General Comments 0
You need to be logged in to leave comments. Login now