main.py 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. # Copyright (c) Jupyter Development Team.
  2. # Distributed under the terms of the Modified BSD License.
  3. import os
  4. import json
  5. from glob import glob
  6. from jupyterlab_server import LabServerApp
  7. HERE = os.path.abspath(os.path.dirname(__file__))
  8. # Turn off the Jupyter configuration system so configuration files on disk do
  9. # not affect this app. This helps this app to truly be standalone.
  10. os.environ["JUPYTER_NO_CONFIG"]="1"
  11. with open(os.path.join(HERE, 'package.json')) as fid:
  12. version = json.load(fid)['version']
  13. def _jupyter_server_extension_points():
  14. return [
  15. {
  16. 'module': __name__,
  17. 'app': ExampleApp
  18. }
  19. ]
  20. class ExampleApp(LabServerApp):
  21. name = 'lab'
  22. load_other_extensions = False
  23. app_name = 'JupyterLab Example App with Prebuilt Extensions'
  24. app_settings_dir = os.path.join(HERE, 'data', 'application_settings')
  25. app_version = version
  26. schemas_dir = os.path.join(HERE, 'data', 'schemas')
  27. static_dir = os.path.join(HERE, 'core_package', 'static')
  28. templates_dir = os.path.join(HERE, 'templates')
  29. themes_dir = os.path.join(HERE, 'data', 'themes')
  30. user_settings_dir = os.path.join(HERE, 'data', 'user_settings')
  31. workspaces_dir = os.path.join(HERE, 'data', 'workspaces')
  32. # Set the location for prebuilt extensions, overriding the default
  33. # of looking in each of the Jupyter data paths.
  34. labextensions_path = [os.path.join(HERE, "labextensions")]
  35. if __name__ == '__main__':
  36. ExampleApp.launch_instance()