Add a jupyter lab page

wip add lab page

Add missing source files

Remove unused typings

Clean up tsconfig

No typings are required

Add typescript to dev dependencies

Switch to a JS-only build

Remove unused config file

Remove unused test and cleanup handlers

Update the setup file to build the lab

Use new application plugin from js-plugins

Remove whitespace changes

Bump plugins version

Update to latest plugins

Update to latest plugins

Update to latest jupyter-js-plugins and add files to manifest

Work around bug in css-loader

Update plugins and fix webpack warning

Update lab version

Fix static directory path

Bump plugins version

Add the try jupyter link

Bump dependencies

Back out whitespace changes

Update plugins version

Update dependencies

Update the bootstrap file

Use a standalone template for the lab page
Steven Silvester 10 years ago
parent 9e1ce0e3dc
commit e663bc3156

2
.gitignore vendored

@ -11,6 +11,8 @@ notebook/static/style/*.min.css*
notebook/static/*/js/built/
notebook/static/*/built/
notebook/static/built/
notebook/static/*/js/main.min.js*
notebook/static/lab/*bundle.js
node_modules
*.py[co]
__pycache__

@ -0,0 +1,59 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"CONTRIBUTING.md \u001b[34m__pycache__\u001b[39;49m\u001b[0m \u001b[34mnode_modules\u001b[39;49m\u001b[0m \u001b[34mscripts\u001b[39;49m\u001b[0m\n",
"COPYING.md bower.json \u001b[34mnotebook\u001b[39;49m\u001b[0m setup.cfg\n",
"Dockerfile \u001b[34mbuild\u001b[39;49m\u001b[0m \u001b[34mnotebook.egg-info\u001b[39;49m\u001b[0m \u001b[31msetup.py\u001b[39;49m\u001b[0m\n",
"MANIFEST.in circle.yml package.json setupbase.py\n",
"README.md \u001b[34mdocs\u001b[39;49m\u001b[0m readthedocs.yml \u001b[34mtools\u001b[39;49m\u001b[0m\n",
"Untitled.ipynb \u001b[34mgit-hooks\u001b[39;49m\u001b[0m \u001b[34mruntime_dir\u001b[39;49m\u001b[0m\n"
]
}
],
"source": [
"ls"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Calysto Bash",
"language": "bash",
"name": "calysto_bash"
},
"language_info": {
"codemirror_mode": "shell",
"file_extension": ".sh",
"help_links": [
{
"text": "MetaKernel Magics",
"url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md"
}
],
"mimetype": "text/x-bash",
"name": "bash",
"version": "0.1.0"
}
},
"nbformat": 4,
"nbformat_minor": 0
}

@ -0,0 +1,28 @@
"""Tornado handlers for the tree view."""
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
from tornado import web
from ..base.handlers import IPythonHandler
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']))
#-----------------------------------------------------------------------------
# URL to handler mappings
#-----------------------------------------------------------------------------
default_handlers = [
(r"/lab", LabHandler),
]

@ -270,6 +270,7 @@ class NotebookWebApplication(web.Application):
handlers.extend(load_handlers('services.nbconvert.handlers'))
handlers.extend(load_handlers('services.kernelspecs.handlers'))
handlers.extend(load_handlers('services.security.handlers'))
handlers.extend(load_handlers('lab.handlers'))
# BEGIN HARDCODED WIDGETS HACK
widgets = None
@ -1228,4 +1229,3 @@ def list_running_servers(runtime_dir=None):
#-----------------------------------------------------------------------------
main = launch_new_instance = NotebookApp.launch_instance

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

@ -0,0 +1,28 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
'use strict';
require('jupyter-js-plugins/lib/default-theme/index.css');
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
],
providers: [
require('jupyter-js-plugins/lib/documentmanager/plugin').documentManagerProvider,
require('jupyter-js-plugins/lib/services/plugin').servicesProvider
]
});
window.onload = function() {
app.run();
}

@ -0,0 +1,32 @@
{
"private": true,
"name": "jupyter-js-lab",
"version": "0.1.0",
"description": "JupyterLab",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
"dependencies": {
"jupyter-js-plugins": "^0.8.0",
"phosphide": "^0.9.0",
"phosphor-di": "^0.9.0"
},
"devDependencies": {
"css-loader": "^0.23.1",
"es6-promise": "^3.0.2",
"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": "webpack --config webpack.conf.js",
"postinstall": "npm dedupe",
"test": "echo 'no tests specified'"
},
"author": "Project Jupyter",
"license": "BSD-3-Clause"
}

@ -0,0 +1,43 @@
// Support for Node 0.10
// See https://github.com/webpack/css-loader/issues/144
require('es6-promise').polyfill();
var ContextReplacementPlugin = require("webpack/lib/ContextReplacementPlugin");
module.exports = {
entry: './index.js',
output: {
path: './build',
filename: 'bundle.js'
},
node: {
fs: "empty"
},
debug: true,
bail: true,
module: {
loaders: [
{ test: /\.css$/, loader: 'style-loader!css-loader' },
{ test: /\.json$/, loader: 'json-loader' },
// 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"
},
plugins: [
new ContextReplacementPlugin(
/codemirror\/mode.*$/,
/codemirror\/mode.*\.js$/
)
]
}

@ -0,0 +1,99 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>{{page_title}}</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<link rel="stylesheet" type="text/css" href="{{static_url("components/font-awesome/css/font-awesome.css")}}"></link>
<script src="{{static_url("components/es6-promise/promise.min.js")}}" type="text/javascript" charset="utf-8"></script>
<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',
widgets : '{{ base_url }}deprecatedwidgets',
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 %}
</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="{{ static_url("lab/build/bundle.js") }}" type="text/javascript" charset="utf-8"></script>
{% endblock %}
</body>
</html>

@ -15,6 +15,7 @@ data-terminals-available="{{terminals_available}}"
{% block site %}
<div id="ipython-main-app" class="container">
<div id="lab_link" class="pull-right" style="padding: 4px"><a href="{{ base_url }}lab" title='Try JupyterLab'><img src='{{static_url("base/images/jupyter_lab.png") }}' alt='Try JupyterLab' height="40px" width="200px"/></a></div>
<div id="tab_content" class="tabbable">
<ul id="tabs" class="nav nav-tabs">
<li class="active"><a href="#notebooks" data-toggle="tab">Files</a></li>
@ -173,7 +174,7 @@ data-terminals-available="{{terminals_available}}"
See <a href="https://github.com/ipython/ipyparallel">IPython parallel</a> for installation details.
</div>
</div><!-- class:tab-content -->
</div><!-- id:tab_content -->
</div><!-- id:tab_content -->
</div><!-- ipython-main-app -->
{% endblock %}

@ -101,6 +101,7 @@ def find_package_data():
excludes = [
pjoin('static', 'components'),
pjoin('static', '*', 'less'),
pjoin('static', '*', 'node_modules')
]
# walk notebook resources:
@ -129,6 +130,9 @@ def find_package_data():
pjoin('static', 'services', 'built', '*contents.js.map'),
])
# Add the Lab page contents
static_data.append(pjoin('static', 'lab', 'build', '*'))
components = pjoin("static", "components")
# select the components we actually need to install
# (there are lots of resources we bundle for sdist-reasons that we don't actually use)
@ -337,6 +341,7 @@ class JavascriptDependencies(Command):
bower_dir = pjoin(static, 'components')
node_modules = pjoin(repo_root, 'node_modules')
lab_dir = pjoin(repo_root, 'notebook', 'static', 'lab')
def run(self):
try:
@ -353,6 +358,14 @@ class JavascriptDependencies(Command):
print("You can install js dependencies with `npm install`", file=sys.stderr)
raise
try:
run(['npm', 'install', '--progress=false'], cwd=self.lab_dir)
run(['npm', 'run', 'build'], cwd=self.lab_dir)
except Exception as e:
print("Failed to run `npm install`: %s" % e, file=sys.stderr)
print("You can install js dependencies with `npm install`", file=sys.stderr)
raise
# update package data in case this created new files
update_package_data(self.distribution)
@ -489,7 +502,7 @@ class JavascriptVersion(Command):
f.write(line)
def css_js_prerelease(command, strict=False):
def prerelease(command, strict=False):
"""decorator for building minified js/css prior to another command"""
class DecoratedCommand(command):
def run(self):
@ -497,11 +510,14 @@ def css_js_prerelease(command, strict=False):
jsdeps = self.distribution.get_command_obj('jsdeps')
js = self.distribution.get_command_obj('js')
css = self.distribution.get_command_obj('css')
lab = self.distribution.get_command_obj('lab')
js.force = strict
targets = [ jsdeps.bower_dir ]
targets.extend(js.targets)
targets.extend(css.targets)
targets.extend(lab.targets)
missing = [ t for t in targets if not os.path.exists(t) ]
if not is_repo and not missing:
@ -513,6 +529,7 @@ def css_js_prerelease(command, strict=False):
try:
self.distribution.run_command('css')
self.distribution.run_command('js')
self.distribution.run_command('lab')
except Exception as e:
# refresh missing
missing = [ t for t in targets if not os.path.exists(t) ]

Loading…
Cancel
Save