Remove the hardcoded jupyterlab in favor of a server extension

pull/1506/head
Steven Silvester 10 years ago
parent 5d0790c7dc
commit bc001b8062

@ -1,31 +0,0 @@
"""Tornado handlers for the tree view."""
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
import os
from tornado import web
from ..base.handlers import IPythonHandler, FileFindHandler
class LabHandler(IPythonHandler):
"""Render the Jupyter Lab View."""
@web.authenticated
def get(self):
self.write(self.render_template('lab.html',
page_title='Jupyter Lab',
terminals_available=self.settings['terminals_available'],
mathjax_url=self.mathjax_url,
mathjax_config=self.mathjax_config))
#-----------------------------------------------------------------------------
# URL to handler mappings
#-----------------------------------------------------------------------------
default_handlers = [
(r"/lab", LabHandler),
(r"/lab/(.*)", FileFindHandler,
{'path': os.path.join(os.path.dirname(__file__), 'build')}),
]

@ -1,37 +0,0 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
'use strict';
// Load CSS.
require('font-awesome/css/font-awesome.min.css');
require('jupyter-js-plugins/lib/default-theme/index.css');
// ES6 Promise polyfill
require('es6-promise').polyfill();
var phosphide = require('phosphide/lib/core/application');
var app = new phosphide.Application({
extensions: [
require('phosphide/lib/extensions/commandpalette').commandPaletteExtension,
require('jupyter-js-plugins/lib/terminal/plugin').terminalExtension,
require('jupyter-js-plugins/lib/filehandler/plugin').fileHandlerExtension,
require('jupyter-js-plugins/lib/filebrowser/plugin').fileBrowserExtension,
require('jupyter-js-plugins/lib/imagehandler/plugin').imageHandlerExtension,
require('jupyter-js-plugins/lib/help/plugin').helpHandlerExtension,
require('jupyter-js-plugins/lib/notebook/plugin').notebookHandlerExtension,
require('jupyter-js-plugins/lib/shortcuts/plugin').shortcutsExtension,
require('jupyter-js-plugins/lib/about/plugin').aboutExtension,
require('jupyter-js-plugins/lib/landing/plugin').landingExtension,
require('jupyter-js-plugins/lib/main/plugin').mainExtension,
],
providers: [
require('jupyter-js-plugins/lib/filehandler/plugin').fileHandlerProvider,
require('jupyter-js-plugins/lib/services/plugin').servicesProvider,
require('jupyter-js-plugins/lib/rendermime/plugin').renderMimeProvider
]
});
window.onload = function() {
app.run();
}

@ -1,32 +0,0 @@
{
"private": true,
"name": "jupyter-js-lab",
"version": "0.1.0",
"description": "JupyterLab",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
"dependencies": {
"es6-promise": "^3.1.2",
"font-awesome": "^4.6.1",
"jupyter-js-plugins": "^0.11.13",
"phosphide": "^0.9.4"
},
"devDependencies": {
"css-loader": "^0.23.1",
"file-loader": "^0.8.5",
"json-loader": "^0.5.4",
"rimraf": "^2.5.0",
"style-loader": "^0.13.0",
"typescript": "^1.7.5",
"url-loader": "^0.5.7",
"webpack": "^1.12.11"
},
"scripts": {
"clean": "rimraf build",
"build": "npm update jupyter-js-plugins && webpack --config webpack.conf.js",
"postinstall": "npm dedupe",
"test": "echo 'no tests specified'"
},
"author": "Project Jupyter",
"license": "BSD-3-Clause"
}

@ -1,38 +0,0 @@
// Support for Node 0.10
// See https://github.com/webpack/css-loader/issues/144
require('es6-promise').polyfill();
module.exports = {
entry: './index.js',
output: {
path: __dirname + "/build",
filename: "bundle.js",
publicPath: "lab/"
},
node: {
fs: "empty"
},
debug: true,
bail: true,
devtool: 'source-map',
module: {
loaders: [
{ test: /\.css$/, loader: 'style-loader!css-loader' },
{ test: /\.json$/, loader: 'json-loader' },
{ test: /\.html$/, loader: 'file'},
// jquery-ui loads some images
{ test: /\.(jpg|png|gif)$/, loader: "file" },
// required to load font-awesome
{ test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&minetype=application/font-woff" },
{ test: /\.woff(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&minetype=application/font-woff" },
{ test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&minetype=application/octet-stream" },
{ test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: "file" },
{ test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&minetype=image/svg+xml" }
]
},
externals: {
"base/js/namespace": "base/js/namespace",
"notebook/js/outputarea": "notebook/js/outputarea",
"services/kernels/comm": "services/kernels/comm"
}
}

@ -1,100 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>{{page_title}}</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<script src="{{static_url("components/requirejs/require.js") }}" type="text/javascript" charset="utf-8"></script>
<script>
require.config({
{% if version_hash %}
urlArgs: "v={{version_hash}}",
{% endif %}
baseUrl: '{{static_url("", include_version=False)}}',
paths: {
{% if ignore_minified_js %}
'auth/js/main': 'auth/js/main',
{% else %}
'auth/js/main': 'auth/js/main.min',
{% endif %}
custom : '{{ base_url }}custom',
nbextensions : '{{ base_url }}nbextensions',
kernelspecs : '{{ base_url }}kernelspecs',
underscore : 'components/underscore/underscore-min',
backbone : 'components/backbone/backbone-min',
jquery: 'components/jquery/jquery.min',
bootstrap: 'components/bootstrap/js/bootstrap.min',
bootstraptour: 'components/bootstrap-tour/build/js/bootstrap-tour.min',
'jquery-ui': 'components/jquery-ui/ui/minified/jquery-ui.min',
moment: 'components/moment/moment',
codemirror: 'components/codemirror',
termjs: 'components/term.js/src/term',
typeahead: 'components/jquery-typeahead/dist/jquery.typeahead'
},
map: { // for backward compatibility
"*": {
"jqueryui": "jquery-ui",
}
},
shim: {
typeahead: {
deps: ["jquery"],
exports: "typeahead"
},
underscore: {
exports: '_'
},
backbone: {
deps: ["underscore", "jquery"],
exports: "Backbone"
},
bootstrap: {
deps: ["jquery"],
exports: "bootstrap"
},
bootstraptour: {
deps: ["bootstrap"],
exports: "Tour"
},
"jquery-ui": {
deps: ["jquery"],
exports: "$"
}
},
waitSeconds: 30,
});
require.config({
map: {
'*':{
'contents': '{{ contents_js_source }}',
}
}
});
</script>
{% block meta %}
{% endblock %}
{% if mathjax_url %}
<script type="text/javascript" src="{{mathjax_url}}?config={{mathjax_config}}&amp;delayStartupUntil=configured" charset="utf-8"></script>
{% endif %}
</head>
<body class="{% block bodyclasses %}{% endblock %}" {% block params %}{% endblock %}>
{% block script %}
<script id='jupyter-config-data' type="application/json">{
"baseUrl": "{{base_url | urlencode}}",
"wsUrl": "{{ws_url| urlencode}}",
"notebookPath": "{{notebook_path | urlencode}}"
}</script>
<script src="lab/bundle.js" type="text/javascript" charset="utf-8"></script>
{% endblock %}
</body>
</html>

@ -129,9 +129,6 @@ def find_package_data():
pjoin('static', 'services', 'built', '*contents.js'),
pjoin('static', 'services', 'built', '*contents.js.map'),
])
# Add the Lab page contents
static_data.append(pjoin('lab', 'build', '*'))
components = pjoin("static", "components")
# select the components we actually need to install
@ -217,9 +214,7 @@ def check_package_data(package_data):
pkg_root = pjoin(*pkg.split('.'))
for d in data:
path = pjoin(pkg_root, d)
if 'lab/build' in path: # Do not verify lab install yet
continue
elif '*' in path:
if '*' in path:
assert len(glob(path)) > 0, "No files match pattern %s" % path
else:
assert os.path.exists(path), "Missing package data: %s" % path
@ -365,7 +360,6 @@ class JavascriptDependencies(Command):
bower_dir = pjoin(static, 'components')
node_modules = pjoin(repo_root, 'node_modules')
lab_dir = pjoin(repo_root, 'notebook', 'lab')
def run(self):
npm_install(repo_root)
@ -377,12 +371,6 @@ class JavascriptDependencies(Command):
print("You can install js dependencies with `npm install`", file=sys.stderr)
raise
try:
npm_install(self.lab_dir)
run(['npm', 'run', 'build'], cwd=self.lab_dir)
except Exception as e:
print("Failed to install JupyterLab`: %s" % e, file=sys.stderr)
# update package data in case this created new files
update_package_data(self.distribution)

Loading…
Cancel
Save