main.py 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. # Copyright (c) Jupyter Development Team.
  2. # Distributed under the terms of the Modified BSD License.
  3. import json
  4. import os
  5. from jupyterlab_server import LabServerApp
  6. HERE = os.path.abspath(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 [{"module": __name__, "app": ExampleApp}]
  14. class ExampleApp(LabServerApp):
  15. name = "lab"
  16. load_other_extensions = False
  17. app_name = "JupyterLab Example App with Prebuilt Extensions"
  18. app_settings_dir = os.path.join(HERE, "data", "application_settings")
  19. app_version = version
  20. schemas_dir = os.path.join(HERE, "data", "schemas")
  21. static_dir = os.path.join(HERE, "core_package", "static")
  22. templates_dir = os.path.join(HERE, "templates")
  23. themes_dir = os.path.join(HERE, "data", "themes")
  24. user_settings_dir = os.path.join(HERE, "data", "user_settings")
  25. workspaces_dir = os.path.join(HERE, "data", "workspaces")
  26. # Set the location for prebuilt extensions, overriding the default
  27. # of looking in each of the Jupyter data paths.
  28. labextensions_path = [os.path.join(HERE, "labextensions")]
  29. if __name__ == "__main__":
  30. ExampleApp.launch_instance()