Skip to content

Commit

Permalink
blackening
Browse files Browse the repository at this point in the history
  • Loading branch information
mattprintz committed Jul 26, 2023
1 parent 5881bf9 commit 9558db8
Show file tree
Hide file tree
Showing 7 changed files with 377 additions and 186 deletions.
19 changes: 9 additions & 10 deletions dev.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
import os

from jupyter_server.base.handlers import JupyterHandler
from jupyter_server.extension.handler import ExtensionHandlerJinjaMixin, ExtensionHandlerMixin
from jupyter_server.extension.handler import (
ExtensionHandlerJinjaMixin,
ExtensionHandlerMixin,
)
from jupyter_server.utils import url_path_join as ujoin
from jupyterlab_server import LabServerApp



HERE = os.path.join(os.path.dirname(__file__), "dev_ui")


version = "0.0.1"


def _jupyter_server_extension_points():
return [{"module": __name__, "app": DevAskemJupyterApp}]

Expand All @@ -26,7 +29,8 @@ def get(self):
# Options set here can be read with PageConfig.getOption
mathjax_config = self.settings.get("mathjax_config", "TeX-AMS_HTML-full,Safe")
mathjax_url = self.settings.get(
"mathjax_url", "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js"
"mathjax_url",
"https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js",
)

config_data = {
Expand All @@ -50,7 +54,6 @@ def get(self):
)



class DevAskemJupyterApp(LabServerApp):
name = __name__
# load_other_extensions = False
Expand All @@ -69,19 +72,15 @@ class DevAskemJupyterApp(LabServerApp):
user_settings_dir = os.path.join(HERE, "build", "user_settings")
workspaces_dir = os.path.join(HERE, "build", "workspaces")


def initialize_handlers(self):
"""Bypass initializing the default handler since we don't need to use the webserver, just the websockets."""
self.handlers.append(("/dev_ui", DevHandler))


def initialize_settings(self):
# Override to allow cross domain websockets
self.settings['allow_origin'] = '*'
self.settings['disable_check_xsrf'] = True
self.settings["allow_origin"] = "*"
self.settings["disable_check_xsrf"] = True


if __name__ == "__main__":
DevAskemJupyterApp.launch_instance()


4 changes: 2 additions & 2 deletions dev_ui/orig_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ def get(self):
# Options set here can be read with PageConfig.getOption
mathjax_config = self.settings.get("mathjax_config", "TeX-AMS_HTML-full,Safe")
mathjax_url = self.settings.get(
"mathjax_url", "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js"
"mathjax_url",
"https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js",
)

config_data = {
Expand All @@ -67,7 +68,6 @@ def get(self):


class ExampleApp(LabServerApp):

extension_url = "/example"
default_url = "/example"
app_url = "/example"
Expand Down
Loading

0 comments on commit 9558db8

Please sign in to comment.