main.py 1.3 KB

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