Skip to content

Commit

Permalink
Merge branch 'master' into interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
vidartf committed May 22, 2019
2 parents 9a70889 + 3732d02 commit 8e030e0
Show file tree
Hide file tree
Showing 75 changed files with 755 additions and 328 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ dev_mode/workspaces
examples/app/build
examples/app/themes
examples/app/schemas
examples/chrome-example-test.js
tests/**/coverage
docs/_build
docs/api
5 changes: 4 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,10 @@ a package by importing from it in the TypeScript file, and then running:
`jlpm run integrity` from the repo root.

We also have scripts for creating and removing packages in `packages/`,
`jlpm run create:package` and `jlpm run remove:package`.
`jlpm run create:package` and `jlpm run remove:package`. When creating a package,
if it is meant to be included in the core bundle, add the `jupyterlab: { coreDependency: true }`
metadata to the `package.json`. Packages with `extension` or `mimeExtension` metadata
are considered to be a core dependency unless they are explicitly marked otherwise.

## Testing Changes to External Packages

Expand Down
4 changes: 2 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ jobs:
Python:
group: 'python'
testResultsFiles: 'junit.xml'
CLI:
group: 'cli'
Usage:
group: 'usage'
python.version: '3.5'
Docs:
group: 'docs'
Expand Down
18 changes: 17 additions & 1 deletion buildutils/src/ensure-repo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,23 @@ function ensureJupyterlab(): string[] {
} catch (e) {
return;
}
if (data.private === true || data.name === '@jupyterlab/metapackage') {
// Determine whether to include the package.
if (!data.jupyterlab) {
return;
}
// Skip if explicitly marked as not a core dep.
if (
'coreDependency' in data.jupyterlab &&
!data.jupyterlab.coreDependency
) {
return;
}
// Skip if it is not marked as an extension or a core dep.
if (
!data.jupyterlab.coreDependency &&
!data.jupyterlab.extension &&
!data.jupyterlab.mimeExtension
) {
return;
}

Expand Down
69 changes: 3 additions & 66 deletions dev_mode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,14 @@
"@jupyterlab/application-extension": "^1.0.0-alpha.6",
"@jupyterlab/apputils": "^1.0.0-alpha.6",
"@jupyterlab/apputils-extension": "^1.0.0-alpha.6",
"@jupyterlab/attachments": "^1.0.0-alpha.6",
"@jupyterlab/cells": "^1.0.0-alpha.7",
"@jupyterlab/codeeditor": "^1.0.0-alpha.6",
"@jupyterlab/codemirror": "^1.0.0-alpha.6",
"@jupyterlab/codemirror-extension": "^1.0.0-alpha.6",
"@jupyterlab/completer": "^1.0.0-alpha.6",
"@jupyterlab/completer-extension": "^1.0.0-alpha.6",
"@jupyterlab/console": "^1.0.0-alpha.6",
"@jupyterlab/console-extension": "^1.0.0-alpha.6",
"@jupyterlab/coreutils": "^3.0.0-alpha.6",
"@jupyterlab/csvviewer": "^1.0.0-alpha.6",
"@jupyterlab/csvviewer-extension": "^1.0.0-alpha.7",
"@jupyterlab/docmanager": "^1.0.0-alpha.6",
"@jupyterlab/docmanager-extension": "^1.0.0-alpha.6",
"@jupyterlab/docregistry": "^1.0.0-alpha.6",
"@jupyterlab/documentsearch": "^1.0.0-alpha.7",
"@jupyterlab/documentsearch-extension": "^1.0.0-alpha.8",
"@jupyterlab/extensionmanager": "^1.0.0-alpha.6",
"@jupyterlab/extensionmanager-extension": "^1.0.0-alpha.6",
Expand All @@ -41,38 +33,27 @@
"@jupyterlab/fileeditor": "^1.0.0-alpha.6",
"@jupyterlab/fileeditor-extension": "^1.0.0-alpha.6",
"@jupyterlab/help-extension": "^1.0.0-alpha.6",
"@jupyterlab/htmlviewer": "^1.0.0-alpha.7",
"@jupyterlab/htmlviewer-extension": "^1.0.0-alpha.7",
"@jupyterlab/imageviewer": "^1.0.0-alpha.6",
"@jupyterlab/imageviewer-extension": "^1.0.0-alpha.6",
"@jupyterlab/inspector": "^1.0.0-alpha.6",
"@jupyterlab/inspector-extension": "^1.0.0-alpha.6",
"@jupyterlab/javascript-extension": "^1.0.0-alpha.6",
"@jupyterlab/json-extension": "^1.0.0-alpha.6",
"@jupyterlab/launcher": "^1.0.0-alpha.6",
"@jupyterlab/launcher-extension": "^1.0.0-alpha.6",
"@jupyterlab/mainmenu": "^1.0.0-alpha.6",
"@jupyterlab/mainmenu-extension": "^1.0.0-alpha.6",
"@jupyterlab/markdownviewer": "^1.0.0-alpha.6",
"@jupyterlab/markdownviewer-extension": "^1.0.0-alpha.6",
"@jupyterlab/mathjax2": "^1.0.0-alpha.6",
"@jupyterlab/mathjax2-extension": "^1.0.0-alpha.6",
"@jupyterlab/nbconvert-css": "^0.1.0",
"@jupyterlab/notebook": "^1.0.0-alpha.7",
"@jupyterlab/notebook-extension": "^1.0.0-alpha.6",
"@jupyterlab/observables": "^2.2.0-alpha.6",
"@jupyterlab/outputarea": "^1.0.0-alpha.6",
"@jupyterlab/pdf-extension": "^1.0.0-alpha.6",
"@jupyterlab/rendermime": "^1.0.0-alpha.6",
"@jupyterlab/rendermime-extension": "^1.0.0-alpha.6",
"@jupyterlab/rendermime-interfaces": "^1.3.0-alpha.6",
"@jupyterlab/running": "^1.0.0-alpha.6",
"@jupyterlab/running-extension": "^1.0.0-alpha.6",
"@jupyterlab/services": "^4.0.0-alpha.6",
"@jupyterlab/settingeditor": "^1.0.0-alpha.6",
"@jupyterlab/settingeditor-extension": "^1.0.0-alpha.6",
"@jupyterlab/shortcuts-extension": "^1.0.0-alpha.6",
"@jupyterlab/statusbar": "^1.0.0-alpha.6",
"@jupyterlab/statusbar-extension": "^1.0.0-alpha.6",
"@jupyterlab/tabmanager-extension": "^1.0.0-alpha.6",
"@jupyterlab/terminal": "^1.0.0-alpha.6",
Expand All @@ -81,8 +62,6 @@
"@jupyterlab/theme-light-extension": "^1.0.0-alpha.7",
"@jupyterlab/tooltip": "^1.0.0-alpha.6",
"@jupyterlab/tooltip-extension": "^1.0.0-alpha.6",
"@jupyterlab/ui-components": "^1.0.0-alpha.6",
"@jupyterlab/vdom": "^1.0.0-alpha.6",
"@jupyterlab/vdom-extension": "^1.0.0-alpha.6",
"@jupyterlab/vega5-extension": "^1.0.0-alpha.6",
"@phosphor/algorithm": "^1.1.2",
Expand All @@ -91,27 +70,20 @@
"@phosphor/coreutils": "^1.3.0",
"@phosphor/datagrid": "^0.1.6",
"@phosphor/disposable": "^1.1.2",
"@phosphor/domutils": "^1.1.2",
"@phosphor/dragdrop": "^1.3.0",
"@phosphor/messaging": "^1.2.2",
"@phosphor/properties": "^1.1.2",
"@phosphor/signaling": "^1.2.2",
"@phosphor/virtualdom": "^1.1.2",
"@phosphor/widgets": "^1.6.0",
"ajv": "^6.5.5",
"codemirror": "~5.46.0",
"comment-json": "^1.1.3",
"es6-promise": "~4.1.1",
"json5": "^2.1.0",
"marked": "0.5.1",
"moment": "~2.21.0",
"path-posix": "~1.0.0",
"react": "~16.8.4",
"react-dom": "~16.8.4",
"react-paginate": "^5.2.3",
"sanitize-html": "~1.18.2",
"semver": "^5.5.0",
"url-parse": "~1.4.3",
"xterm": "~3.10.1"
"url-parse": "~1.4.3"
},
"devDependencies": {
"@jupyterlab/buildutils": "^1.0.0-alpha.6",
Expand Down Expand Up @@ -223,7 +195,7 @@
"@phosphor/widgets",
"ajv",
"codemirror",
"comment-json",
"json5",
"es6-promise",
"marked",
"moment",
Expand All @@ -240,75 +212,40 @@
"linkedPackages": {
"@jupyterlab/application": "../packages/application",
"@jupyterlab/application-extension": "../packages/application-extension",
"@jupyterlab/apputils": "../packages/apputils",
"@jupyterlab/apputils-extension": "../packages/apputils-extension",
"@jupyterlab/attachments": "../packages/attachments",
"@jupyterlab/cells": "../packages/cells",
"@jupyterlab/codeeditor": "../packages/codeeditor",
"@jupyterlab/codemirror": "../packages/codemirror",
"@jupyterlab/codemirror-extension": "../packages/codemirror-extension",
"@jupyterlab/completer": "../packages/completer",
"@jupyterlab/completer-extension": "../packages/completer-extension",
"@jupyterlab/console": "../packages/console",
"@jupyterlab/console-extension": "../packages/console-extension",
"@jupyterlab/coreutils": "../packages/coreutils",
"@jupyterlab/csvviewer": "../packages/csvviewer",
"@jupyterlab/csvviewer-extension": "../packages/csvviewer-extension",
"@jupyterlab/docmanager": "../packages/docmanager",
"@jupyterlab/docmanager-extension": "../packages/docmanager-extension",
"@jupyterlab/docregistry": "../packages/docregistry",
"@jupyterlab/documentsearch": "../packages/documentsearch",
"@jupyterlab/documentsearch-extension": "../packages/documentsearch-extension",
"@jupyterlab/extensionmanager": "../packages/extensionmanager",
"@jupyterlab/extensionmanager-extension": "../packages/extensionmanager-extension",
"@jupyterlab/faq-extension": "../packages/faq-extension",
"@jupyterlab/filebrowser": "../packages/filebrowser",
"@jupyterlab/filebrowser-extension": "../packages/filebrowser-extension",
"@jupyterlab/fileeditor": "../packages/fileeditor",
"@jupyterlab/fileeditor-extension": "../packages/fileeditor-extension",
"@jupyterlab/help-extension": "../packages/help-extension",
"@jupyterlab/htmlviewer": "../packages/htmlviewer",
"@jupyterlab/htmlviewer-extension": "../packages/htmlviewer-extension",
"@jupyterlab/imageviewer": "../packages/imageviewer",
"@jupyterlab/imageviewer-extension": "../packages/imageviewer-extension",
"@jupyterlab/inspector": "../packages/inspector",
"@jupyterlab/inspector-extension": "../packages/inspector-extension",
"@jupyterlab/javascript-extension": "../packages/javascript-extension",
"@jupyterlab/json-extension": "../packages/json-extension",
"@jupyterlab/launcher": "../packages/launcher",
"@jupyterlab/launcher-extension": "../packages/launcher-extension",
"@jupyterlab/mainmenu": "../packages/mainmenu",
"@jupyterlab/mainmenu-extension": "../packages/mainmenu-extension",
"@jupyterlab/markdownviewer": "../packages/markdownviewer",
"@jupyterlab/markdownviewer-extension": "../packages/markdownviewer-extension",
"@jupyterlab/mathjax2": "../packages/mathjax2",
"@jupyterlab/mathjax2-extension": "../packages/mathjax2-extension",
"@jupyterlab/nbconvert-css": "../packages/nbconvert-css",
"@jupyterlab/notebook": "../packages/notebook",
"@jupyterlab/notebook-extension": "../packages/notebook-extension",
"@jupyterlab/observables": "../packages/observables",
"@jupyterlab/outputarea": "../packages/outputarea",
"@jupyterlab/pdf-extension": "../packages/pdf-extension",
"@jupyterlab/rendermime": "../packages/rendermime",
"@jupyterlab/rendermime-extension": "../packages/rendermime-extension",
"@jupyterlab/rendermime-interfaces": "../packages/rendermime-interfaces",
"@jupyterlab/running": "../packages/running",
"@jupyterlab/running-extension": "../packages/running-extension",
"@jupyterlab/services": "../packages/services",
"@jupyterlab/settingeditor": "../packages/settingeditor",
"@jupyterlab/settingeditor-extension": "../packages/settingeditor-extension",
"@jupyterlab/shortcuts-extension": "../packages/shortcuts-extension",
"@jupyterlab/statusbar": "../packages/statusbar",
"@jupyterlab/statusbar-extension": "../packages/statusbar-extension",
"@jupyterlab/tabmanager-extension": "../packages/tabmanager-extension",
"@jupyterlab/terminal": "../packages/terminal",
"@jupyterlab/terminal-extension": "../packages/terminal-extension",
"@jupyterlab/theme-dark-extension": "../packages/theme-dark-extension",
"@jupyterlab/theme-light-extension": "../packages/theme-light-extension",
"@jupyterlab/tooltip": "../packages/tooltip",
"@jupyterlab/tooltip-extension": "../packages/tooltip-extension",
"@jupyterlab/ui-components": "../packages/ui-components",
"@jupyterlab/vdom": "../packages/vdom",
"@jupyterlab/vdom-extension": "../packages/vdom-extension",
"@jupyterlab/vega5-extension": "../packages/vega5-extension"
}
Expand Down
3 changes: 3 additions & 0 deletions docs/source/user/extensions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,9 @@ environment variable. If not specified, it will default to
``<sys-prefix>/share/jupyter/lab``, where ``<sys-prefix>`` is the
site-specific directory prefix of the current Python environment. You
can query the current application path by running ``jupyter lab path``.
Note that the application directory is expected to contain the JupyterLab
static assets (e.g. `static/index.html`). If JupyterLab is launched
and the static assets are not present, it will display an error in the console and in the browser.

JupyterLab Build Process
^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
13 changes: 10 additions & 3 deletions examples/app/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.

// ES6 Promise polyfill
require('es6-promise/auto');
import { PageConfig, URLExt } from '@jupyterlab/coreutils';
// eslint-disable-next-line
__webpack_public_path__ = URLExt.join(
PageConfig.getBaseUrl(),
'example/static/'
);

window.addEventListener('load', function() {
require('font-awesome/css/font-awesome.min.css');
Expand Down Expand Up @@ -42,5 +46,8 @@ window.addEventListener('load', function() {
version: require('./package.json').version
});
lab.registerPluginModules(mods);
lab.start();
lab.start().then(() => {
// eslint-disable-next-line
console.log('Example started!');
});
});
5 changes: 3 additions & 2 deletions examples/app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Distributed under the terms of the Modified BSD License.

from jupyterlab_server import LabServerApp, LabConfig
from notebook.utils import url_path_join as ujoin
import os
from traitlets import Unicode

Expand All @@ -13,13 +14,13 @@

class ExampleApp(LabServerApp):

default_url = Unicode('/exampleapp',
default_url = Unicode('/example',
help='The default URL to redirect to from `/`')

lab_config = LabConfig(
app_name = 'JupyterLab Example App',
app_settings_dir = os.path.join(HERE, 'build', 'application_settings'),
page_url = '/exampleapp',
page_url = 'example',
schemas_dir = os.path.join(HERE, 'build', 'schemas'),
settings_dir = os.path.join(HERE, 'build', 'settings'),
static_dir = os.path.join(HERE, 'build'),
Expand Down
2 changes: 1 addition & 1 deletion examples/app/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"baseUrl": "{{base_url}}",
"wsUrl": "{{ws_url}}"
}</script>
<script src="{{page_config['publicUrl']}}bundle.js" main="index"></script>
<script src="{{base_url}}{{page_config['publicUrl']}}bundle.js" main="index"></script>

<script type="text/javascript">
/* Remove token from URL. */
Expand Down
4 changes: 2 additions & 2 deletions examples/cell/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"baseUrl": "{{base_url}}",
"token": "{{token}}"
}</script>
<script src="example/bundle.js"></script>
<script src="{{base_url}}example/bundle.js"></script>

<script type="text/javascript">
/* Remove token from URL. */
Expand All @@ -21,6 +21,6 @@
}
})();
</script>

</body>
</html>
9 changes: 5 additions & 4 deletions examples/cell/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from jinja2 import FileSystemLoader
from notebook.base.handlers import IPythonHandler, FileFindHandler
from notebook.notebookapp import NotebookApp
from notebook.utils import url_path_join as ujoin
from traitlets import Unicode

HERE = os.path.dirname(__file__)
Expand All @@ -41,11 +42,11 @@ class ExampleApp(NotebookApp):
def init_webapp(self):
"""initialize tornado webapp and httpserver.
"""
super(ExampleApp, self).init_webapp()
super().init_webapp()
default_handlers = [
(r'/example/?', ExampleHandler),
(r"/example/(.*)", FileFindHandler,
{'path': os.path.join(HERE, 'build')}) ]
(ujoin(self.base_url, r'/example/?'), ExampleHandler),
(ujoin(self.base_url, r"/example/(.*)"), FileFindHandler,
{'path': os.path.join(HERE, 'build')}) ]
self.web_app.add_handlers('.*$', default_handlers)


Expand Down
14 changes: 11 additions & 3 deletions examples/cell/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.

import 'es6-promise/auto'; // polyfill Promise on IE
import { PageConfig, URLExt } from '@jupyterlab/coreutils';
// @ts-ignore
__webpack_public_path__ = URLExt.join(PageConfig.getBaseUrl(), 'example/');

import '@jupyterlab/application/style/index.css';
import '@jupyterlab/cells/style/index.css';
import '@jupyterlab/theme-light-extension/style/index.css';
import '../index.css';

Expand Down Expand Up @@ -65,9 +69,8 @@ function main(): void {
});
});

// Start the default kernel.
// Use the default kernel.
session.kernelPreference = { autoStartDefault: true };
void session.initialize();

// Set up a completer.
const editor = cellWidget.editor;
Expand Down Expand Up @@ -130,6 +133,11 @@ function main(): void {
keys: ['Shift Enter'],
command: 'run:cell'
});

// Start up the kernel.
void session.initialize().then(() => {
console.log('Example started!');
});
}

window.addEventListener('load', main);
3 changes: 1 addition & 2 deletions examples/cell/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ module.exports = {
entry: ['whatwg-fetch', './build/index.js'],
output: {
path: __dirname + '/build',
filename: 'bundle.js',
publicPath: './example/'
filename: 'bundle.js'
},
bail: true,
devtool: 'cheap-source-map',
Expand Down

0 comments on commit 8e030e0

Please sign in to comment.