main.py 1.3 KB

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