forked from jupyterlab/jupyterlab
/
labapp.py
54 lines (39 loc) · 1.75 KB
/
labapp.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# coding: utf-8
"""A tornado based Jupyter lab server."""
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
from notebook.notebookapp import NotebookApp
from traitlets import Unicode
from ._version import __version__
from .extension import load_jupyter_server_extension
class LabApp(NotebookApp):
version = __version__
description = """
JupyterLab - An extensible computational environment for Jupyter.
This launches a Tornado based HTML Server that serves up an
HTML5/Javascript JupyterLab client.
"""
examples = """
jupyter lab # start JupyterLab
jupyter lab --certfile=mycert.pem # use SSL/TLS certificate
"""
subcommands = dict()
default_url = Unicode('/lab', config=True,
help="The default URL to redirect to from `/`")
def init_server_extensions(self):
"""Load any extensions specified by config.
Import the module, then call the load_jupyter_server_extension function,
if one exists.
If the JupyterLab server extension is not enabled, it will
be manually loaded with a warning.
The extension API is experimental, and may change in future releases.
"""
super(LabApp, self).init_server_extensions()
msg = 'JupyterLab server extension not enabled, manually loading...'
if not self.nbserver_extensions.get('jupyterlab', False):
self.log.warn(msg)
load_jupyter_server_extension(self)
#-----------------------------------------------------------------------------
# Main entry point
#-----------------------------------------------------------------------------
main = launch_new_instance = LabApp.launch_instance