jupyter_notebook imports

This commit is contained in:
Min RK 2015-04-08 12:40:26 -07:00
parent 4a97b2a410
commit 61341fdf4d
44 changed files with 66 additions and 66 deletions

View File

@ -1,3 +1,3 @@
if __name__ == '__main__':
from IPython.html import notebookapp as app
from jupyter_notebook import notebookapp as app
app.launch_new_instance()

View File

@ -29,9 +29,9 @@ from IPython.utils.sysinfo import get_sys_info
from IPython.config import Application
from IPython.utils.path import filefind
from IPython.utils.py3compat import string_types
from IPython.html.utils import is_hidden, url_path_join, url_escape
from jupyter_notebook.utils import is_hidden, url_path_join, url_escape
from IPython.html.services.security import csp_report_uri
from jupyter_notebook.services.security import csp_report_uri
#-----------------------------------------------------------------------------
# Top-level handlers

View File

@ -90,7 +90,7 @@ WS_PING_INTERVAL = 30000
if os.environ.get('IPYTHON_ALLOW_DRAFT_WEBSOCKETS_FOR_PHANTOMJS', False):
warnings.warn("""Allowing draft76 websocket connections!
This should only be done for testing with phantomjs!""")
from IPython.html import allow76
from jupyter_notebook import allow76
WebSocketHandler = allow76.AllowDraftWebSocketHandler
# draft 76 doesn't support ping
WS_PING_INTERVAL = 0

View File

@ -10,7 +10,7 @@ import base64
from tornado import web
from IPython.html.base.handlers import IPythonHandler
from jupyter_notebook.base.handlers import IPythonHandler
class FilesHandler(IPythonHandler):
"""serve files via ContentsManager"""

View File

@ -8,8 +8,8 @@ import shutil
import requests
from IPython.html.utils import url_path_join
from IPython.html.tests.launchnotebook import NotebookTestBase, assert_http_error
from jupyter_notebook.utils import url_path_join
from jupyter_notebook.tests.launchnotebook import NotebookTestBase, assert_http_error
from IPython.nbformat import write
from IPython.nbformat.v4 import (
new_notebook, new_markdown_cell, new_code_cell, new_output,

View File

@ -49,7 +49,7 @@ from tornado import httpserver
from tornado import web
from tornado.log import LogFormatter, app_log, access_log, gen_log
from IPython.html import (
from jupyter_notebook import (
DEFAULT_STATIC_FILES_PATH,
DEFAULT_TEMPLATE_PATH_LIST,
)
@ -116,7 +116,7 @@ def random_ports(port, n):
def load_handlers(name):
"""Load the (URL pattern, handler) tuples for each component."""
name = 'IPython.html.' + name
name = 'jupyter_notebook.' + name
mod = __import__(name, fromlist=['default_handlers'])
return mod.default_handlers
@ -576,7 +576,7 @@ class NotebookApp(BaseIPythonApplication):
extra_template_paths = List(Unicode, config=True,
help="""Extra paths to search for serving jinja templates.
Can be used to override templates from IPython.html.templates."""
Can be used to override templates from jupyter_notebook.templates."""
)
def _extra_template_paths_default(self):
return []

View File

@ -5,8 +5,8 @@ import json
import requests
from IPython.html.utils import url_path_join
from IPython.html.tests.launchnotebook import NotebookTestBase
from jupyter_notebook.utils import url_path_join
from jupyter_notebook.tests.launchnotebook import NotebookTestBase
class ConfigAPI(object):

View File

@ -15,7 +15,7 @@ import tempfile
from tornado.web import HTTPError
from IPython.html.utils import (
from jupyter_notebook.utils import (
to_api_path,
to_os_path,
)

View File

@ -20,7 +20,7 @@ from IPython.utils.importstring import import_item
from IPython.utils.traitlets import Any, Unicode, Bool, TraitError
from IPython.utils.py3compat import getcwd, string_types
from IPython.utils import tz
from IPython.html.utils import (
from jupyter_notebook.utils import (
is_hidden,
to_api_path,
)

View File

@ -7,10 +7,10 @@ import json
from tornado import gen, web
from IPython.html.utils import url_path_join, url_escape
from jupyter_notebook.utils import url_path_join, url_escape
from jupyter_client.jsonutil import date_default
from IPython.html.base.handlers import (
from jupyter_notebook.base.handlers import (
IPythonHandler, json_errors, path_regex,
)

View File

@ -16,8 +16,8 @@ import requests
from ..filecheckpoints import GenericFileCheckpoints
from IPython.config import Config
from IPython.html.utils import url_path_join, url_escape, to_os_path
from IPython.html.tests.launchnotebook import NotebookTestBase, assert_http_error
from jupyter_notebook.utils import url_path_join, url_escape, to_os_path
from jupyter_notebook.tests.launchnotebook import NotebookTestBase, assert_http_error
from IPython.nbformat import read, write, from_dict
from IPython.nbformat.v4 import (
new_notebook, new_markdown_cell,

View File

@ -11,7 +11,7 @@ from tornado.ioloop import IOLoop
from jupyter_client.jsonutil import date_default
from IPython.utils.py3compat import cast_unicode
from IPython.html.utils import url_path_join, url_escape
from jupyter_notebook.utils import url_path_join, url_escape
from ...base.handlers import IPythonHandler, json_errors
from ...base.zmqhandlers import AuthenticatedZMQStreamHandler, deserialize_binary_message

View File

@ -14,7 +14,7 @@ from tornado import web
from IPython.kernel.multikernelmanager import MultiKernelManager
from IPython.utils.traitlets import List, Unicode, TraitError
from IPython.html.utils import to_os_path
from jupyter_notebook.utils import to_os_path
from IPython.utils.py3compat import getcwd

View File

@ -5,8 +5,8 @@ import requests
from jupyter_client.kernelspec import NATIVE_KERNEL_NAME
from IPython.html.utils import url_path_join
from IPython.html.tests.launchnotebook import NotebookTestBase, assert_http_error
from jupyter_notebook.utils import url_path_join
from jupyter_notebook.tests.launchnotebook import NotebookTestBase, assert_http_error
class KernelAPI(object):
"""Wrapper for kernel REST API requests"""

View File

@ -12,8 +12,8 @@ pjoin = os.path.join
import requests
from IPython.kernel.kernelspec import NATIVE_KERNEL_NAME
from IPython.html.utils import url_path_join
from IPython.html.tests.launchnotebook import NotebookTestBase, assert_http_error
from jupyter_notebook.utils import url_path_join
from jupyter_notebook.tests.launchnotebook import NotebookTestBase, assert_http_error
# Copied from IPython.kernel.tests.test_kernelspec so updating that doesn't
# break these tests

View File

@ -1,7 +1,7 @@
import requests
from IPython.html.utils import url_path_join
from IPython.html.tests.launchnotebook import NotebookTestBase
from jupyter_notebook.utils import url_path_join
from jupyter_notebook.tests.launchnotebook import NotebookTestBase
class NbconvertAPI(object):
"""Wrapper for nbconvert API calls."""

View File

@ -9,7 +9,7 @@ from tornado import web
from ...base.handlers import IPythonHandler, json_errors
from jupyter_client.jsonutil import date_default
from IPython.html.utils import url_path_join, url_escape
from jupyter_notebook.utils import url_path_join, url_escape
from IPython.kernel.kernelspec import NoSuchKernel

View File

@ -15,8 +15,8 @@ from IPython.utils.traitlets import Instance
class SessionManager(LoggingConfigurable):
kernel_manager = Instance('IPython.html.services.kernels.kernelmanager.MappingKernelManager')
contents_manager = Instance('IPython.html.services.contents.manager.ContentsManager')
kernel_manager = Instance('jupyter_notebook.services.kernels.kernelmanager.MappingKernelManager')
contents_manager = Instance('jupyter_notebook.services.contents.manager.ContentsManager')
# Session database initialized below
_cursor = None

View File

@ -5,8 +5,8 @@ from unittest import TestCase
from tornado import web
from ..sessionmanager import SessionManager
from IPython.html.services.kernels.kernelmanager import MappingKernelManager
from IPython.html.services.contents.manager import ContentsManager
from jupyter_notebook.services.kernels.kernelmanager import MappingKernelManager
from jupyter_notebook.services.contents.manager import ContentsManager
class DummyKernel(object):
def __init__(self, kernel_name='python'):

View File

@ -10,8 +10,8 @@ import time
pjoin = os.path.join
from IPython.html.utils import url_path_join
from IPython.html.tests.launchnotebook import NotebookTestBase, assert_http_error
from jupyter_notebook.utils import url_path_join
from jupyter_notebook.tests.launchnotebook import NotebookTestBase, assert_http_error
from IPython.nbformat.v4 import new_notebook
from IPython.nbformat import write

View File

@ -299,7 +299,7 @@ define([
* JS:
* IPython.notebook.kernel.widget_manager.create_model({
* model_name: 'WidgetModel',
* widget_class: 'IPython.html.widgets.widget_int.IntSlider'})
* widget_class: 'jupyter_notebook.widgets.widget_int.IntSlider'})
* .then(function(model) { console.log('Create success!', model); },
* $.proxy(console.error, console));
*

View File

@ -8,7 +8,7 @@ if not check_version(terminado.__version__, '0.3.3'):
from terminado import NamedTermManager
from tornado.log import app_log
from IPython.html.utils import url_path_join as ujoin
from jupyter_notebook.utils import url_path_join as ujoin
from .handlers import TerminalHandler, TermSocket
from . import api_handlers

View File

@ -15,7 +15,7 @@ from IPython.nbformat.v4 import (new_notebook,
new_markdown_cell, new_code_cell,
new_output)
from IPython.html.utils import url_path_join
from jupyter_notebook.utils import url_path_join
from .launchnotebook import NotebookTestBase
from IPython.utils import py3compat

View File

@ -22,8 +22,8 @@ except ImportError:
import IPython.testing.decorators as dec
from IPython.utils import py3compat
from IPython.utils.tempdir import TemporaryDirectory
from IPython.html import nbextensions
from IPython.html.nbextensions import install_nbextension, check_nbextension
from jupyter_notebook import nbextensions
from jupyter_notebook.nbextensions import install_nbextension, check_nbextension
def touch(file, mtime=None):

View File

@ -11,13 +11,13 @@ from traitlets.tests.utils import check_help_all_output
from IPython.utils.tempdir import TemporaryDirectory
from IPython.utils.traitlets import TraitError
from IPython.html import notebookapp
from jupyter_notebook import notebookapp
NotebookApp = notebookapp.NotebookApp
def test_help_output():
"""ipython notebook --help-all works"""
check_help_all_output('IPython.html')
check_help_all_output('jupyter_notebook')
def test_server_info_file():
nbapp = NotebookApp(profile='nbserver_file_test', log=logging.getLogger())

View File

@ -2,7 +2,7 @@
import re
import nose.tools as nt
from IPython.html.base.handlers import path_regex
from jupyter_notebook.base.handlers import path_regex
try: # py3
assert_regex = nt.assert_regex

View File

@ -8,14 +8,14 @@ import os
import nose.tools as nt
from traitlets.tests.utils import check_help_all_output
from IPython.html.utils import url_escape, url_unescape, is_hidden
from jupyter_notebook.utils import url_escape, url_unescape, is_hidden
from IPython.utils.tempdir import TemporaryDirectory
def test_help_output():
"""jupyter notebook --help-all works"""
# FIXME: will be jupyter_notebook
check_help_all_output('IPython.html')
check_help_all_output('jupyter_notebook')
def test_url_escape():

View File

@ -18,7 +18,7 @@ casper.notebook_test(function () {
this.evaluate(function() {
IPython.notebook.kernel.widget_manager.create_model({
model_name: 'WidgetModel',
widget_class: 'IPython.html.widgets.widget_int.IntSlider'})
widget_class: 'jupyter_notebook.widgets.widget_int.IntSlider'})
.then(function(model) {
console.log('Create success!', model);
window.slider_id = model.id;
@ -34,7 +34,7 @@ casper.notebook_test(function () {
});
index = this.append_cell(
'from IPython.html.widgets import Widget\n' +
'from jupyter_notebook.widgets import Widget\n' +
'widget = list(Widget.widgets.values())[0]\n' +
'print(widget.model_id)');
this.execute_cell_then(index, function(index) {
@ -45,7 +45,7 @@ casper.notebook_test(function () {
// Widget persistence tests.
index = this.append_cell(
'from IPython.html.widgets import HTML\n' +
'from jupyter_notebook.widgets import HTML\n' +
'from IPython.display import display\n' +
'display(HTML(value="<div id=\'hello\'></div>"))');
this.execute_cell_then(index, function() {});

View File

@ -40,7 +40,7 @@ casper.notebook_test(function () {
var index;
index = this.append_cell(
['from IPython.html import widgets',
['from jupyter_notebook import widgets',
'from IPython.display import display, clear_output',
'print("Success")'].join('\n'));
this.execute_cell_then(index);
@ -184,7 +184,7 @@ casper.notebook_test(function () {
var testwidget = {};
this.append_cell_execute_then([
'from IPython.html import widgets',
'from jupyter_notebook import widgets',
'from IPython.utils.traitlets import Unicode, Instance, List',
'from IPython.display import display',
'from array import array',

View File

@ -4,7 +4,7 @@ casper.notebook_test(function () {
// Create a checkbox and togglebutton.
var bool_index = this.append_cell(
'from IPython.html import widgets\n' +
'from jupyter_notebook import widgets\n' +
'from IPython.display import display, clear_output\n' +
'bool_widgets = [widgets.Checkbox(description="Title", value=True),\n' +
' widgets.ToggleButton(description="Title", value=True)]\n' +

View File

@ -3,7 +3,7 @@ casper.notebook_test(function () {
// Create a box widget.
var container_index = this.append_cell(
'from IPython.html import widgets\n' +
'from jupyter_notebook import widgets\n' +
'from IPython.display import display, clear_output\n' +
'container = widgets.Box()\n' +
'button = widgets.Button()\n'+

View File

@ -1,7 +1,7 @@
// Test widget button class
casper.notebook_test(function () {
var button_index = this.append_cell(
'from IPython.html import widgets\n' +
'from jupyter_notebook import widgets\n' +
'from IPython.display import display, clear_output\n' +
'button = widgets.Button(description="Title")\n' +
'display(button)\n' +

View File

@ -3,7 +3,7 @@ casper.notebook_test(function () {
var float_text = {};
float_text.query = '.widget-area .widget-subarea .my-second-float-text input';
float_text.index = this.append_cell(
'from IPython.html import widgets\n' +
'from jupyter_notebook import widgets\n' +
'from IPython.display import display, clear_output\n' +
'float_widget = widgets.FloatText()\n' +
'display(float_widget)\n' +

View File

@ -2,7 +2,7 @@
casper.notebook_test(function () {
"use strict";
var index = this.append_cell(
'from IPython.html import widgets\n' +
'from jupyter_notebook import widgets\n' +
'from IPython.display import display, clear_output\n' +
'print("Success")');
this.execute_cell_then(index);

View File

@ -3,7 +3,7 @@ casper.notebook_test(function () {
var int_text = {};
int_text.query = '.widget-area .widget-subarea .my-second-int-text input';
int_text.index = this.append_cell(
'from IPython.html import widgets\n' +
'from jupyter_notebook import widgets\n' +
'from IPython.display import display, clear_output\n' +
'int_widget = widgets.IntText()\n' +
'display(int_widget)\n' +

View File

@ -1,7 +1,7 @@
// Test selection class
casper.notebook_test(function () {
index = this.append_cell(
'from IPython.html import widgets\n' +
'from jupyter_notebook import widgets\n' +
'from IPython.display import display, clear_output\n' +
'print("Success")');
this.execute_cell_then(index);

View File

@ -1,7 +1,7 @@
// Test multicontainer class
casper.notebook_test(function () {
index = this.append_cell(
'from IPython.html import widgets\n' +
'from jupyter_notebook import widgets\n' +
'from IPython.display import display, clear_output\n' +
'print("Success")');
this.execute_cell_then(index);

View File

@ -1,7 +1,7 @@
// Test widget string class
casper.notebook_test(function () {
var string_index = this.append_cell(
'from IPython.html import widgets\n' +
'from jupyter_notebook import widgets\n' +
'from IPython.display import display, clear_output\n' +
'string_widget = [widgets.Text(value = "xyz", placeholder = "abc"),\n' +
' widgets.Textarea(value = "xyz", placeholder = "def"),\n' +

View File

@ -1,13 +1,13 @@
"""Test the /tree handlers"""
import os
import io
from IPython.html.utils import url_path_join
from jupyter_notebook.utils import url_path_join
from IPython.nbformat import write
from IPython.nbformat.v4 import new_notebook
import requests
from IPython.html.tests.launchnotebook import NotebookTestBase
from jupyter_notebook.tests.launchnotebook import NotebookTestBase
class TreeTest(NotebookTestBase):
def setUp(self):

View File

@ -31,10 +31,10 @@ from .widget_string import HTMLWidget, LatexWidget, TextWidget, TextareaWidget
# To ignore this warning, do:
#
# from warnings import filterwarnings
# filterwarnings('ignore', module='IPython.html.widgets')
# filterwarnings('ignore', module='jupyter_notebook.widgets')
from warnings import warn_explicit
__warningregistry__ = {}
warn_explicit("IPython widgets are experimental and may change in the future.",
FutureWarning, '', 0, module = 'IPython.html.widgets',
FutureWarning, '', 0, module = 'jupyter_notebook.widgets',
registry = __warningregistry__, module_globals = globals)

View File

@ -12,7 +12,7 @@ except ImportError:
from inspect import getcallargs
from IPython.core.getipython import get_ipython
from IPython.html.widgets import (Widget, Text,
from jupyter_notebook.widgets import (Widget, Text,
FloatSlider, IntSlider, Checkbox, Dropdown,
Box, Button, DOMWidget)
from IPython.display import display, clear_output

View File

@ -13,8 +13,8 @@ except ImportError:
import nose.tools as nt
from IPython.kernel.comm import Comm
from IPython.html import widgets
from IPython.html.widgets import interact, interactive, Widget, interaction
from jupyter_notebook import widgets
from jupyter_notebook.widgets import interact, interactive, Widget, interaction
from IPython.utils.py3compat import annotate
#-----------------------------------------------------------------------------

View File

@ -6,7 +6,7 @@
from unittest import TestCase
from IPython.utils.traitlets import HasTraits
from traitlets.tests.test_traitlets import TraitTestBase
from IPython.html.widgets import Color, EventfulDict, EventfulList
from jupyter_notebook.widgets import Color, EventfulDict, EventfulList
class ColorTrait(HasTraits):

View File

@ -21,7 +21,7 @@ class Output(DOMWidget):
displayed in it instead of the standard output area.
Example
from IPython.html import widgets
from jupyter_notebook import widgets
from IPython.display import display
out = widgets.Output()
display(out)