diff --git a/jupyverse_api/jupyverse_api/jupyterlab/__init__.py b/jupyverse_api/jupyverse_api/jupyterlab/__init__.py index 36f18b56..c9bdf98c 100644 --- a/jupyverse_api/jupyverse_api/jupyterlab/__init__.py +++ b/jupyverse_api/jupyverse_api/jupyterlab/__init__.py @@ -89,3 +89,4 @@ async def get_workspace( class JupyterLabConfig(Config): dev_mode: bool = False + server_side_execution: bool = False diff --git a/plugins/jupyterlab/fps_jupyterlab/routes.py b/plugins/jupyterlab/fps_jupyterlab/routes.py index 50e8b802..6f600d22 100644 --- a/plugins/jupyterlab/fps_jupyterlab/routes.py +++ b/plugins/jupyterlab/fps_jupyterlab/routes.py @@ -58,6 +58,7 @@ async def get_lab( self.get_index( "default", self.frontend_config.collaborative, + self.jupyterlab_config.server_side_execution, self.jupyterlab_config.dev_mode, self.frontend_config.base_url, ) @@ -71,6 +72,7 @@ async def load_workspace( self.get_index( "default", self.frontend_config.collaborative, + self.jupyterlab_config.server_side_execution, self.jupyterlab_config.dev_mode, self.frontend_config.base_url, ) @@ -99,11 +101,12 @@ async def get_workspace( return self.get_index( name, self.frontend_config.collaborative, + self.jupyterlab_config.server_side_execution, self.jupyterlab_config.dev_mode, self.frontend_config.base_url, ) - def get_index(self, workspace, collaborative, dev_mode, base_url="/"): + def get_index(self, workspace, collaborative, server_side_execution, dev_mode, base_url="/"): for path in (self.static_lab_dir).glob("main.*.js"): main_id = path.name.split(".")[1] break @@ -121,6 +124,7 @@ def get_index(self, workspace, collaborative, dev_mode, base_url="/"): "baseUrl": base_url, "cacheFiles": False, "collaborative": collaborative, + "serverSideExecution": server_side_execution, "devMode": dev_mode, "disabledExtensions": self.disabled_extension, "exposeAppInBrowser": False, diff --git a/plugins/kernels/fps_kernels/kernel_driver/driver.py b/plugins/kernels/fps_kernels/kernel_driver/driver.py index 5471f2fd..cc65dcc3 100644 --- a/plugins/kernels/fps_kernels/kernel_driver/driver.py +++ b/plugins/kernels/fps_kernels/kernel_driver/driver.py @@ -222,18 +222,27 @@ async def _handle_outputs(self, outputs: Array, msg: Dict[str, Any]): content = msg["content"] if msg_type == "stream": with outputs.doc.transaction(): + # TODO: uncomment when changes are made in jupyter-ydoc if (not outputs) or (outputs[-1]["name"] != content["name"]): # type: ignore outputs.append( - Map( - { - "name": content["name"], - "output_type": msg_type, - "text": Array([content["text"]]), - } - ) + #Map( + # { + # "name": content["name"], + # "output_type": msg_type, + # "text": Array([content["text"]]), + # } + #) + { + "name": content["name"], + "output_type": msg_type, + "text": [content["text"]], + } ) else: - outputs[-1]["text"].append(content["text"]) # type: ignore + #outputs[-1]["text"].append(content["text"]) # type: ignore + last_output = outputs[-1] + last_output["text"].append(content["text"]) # type: ignore + outputs[-1] = last_output elif msg_type in ("display_data", "execute_result"): if "application/vnd.jupyter.ywidget-view+json" in content["data"]: # this is a collaborative widget diff --git a/plugins/yjs/pyproject.toml b/plugins/yjs/pyproject.toml index e176bd85..a53d3bdc 100644 --- a/plugins/yjs/pyproject.toml +++ b/plugins/yjs/pyproject.toml @@ -8,7 +8,7 @@ description = "An FPS plugin for the Yjs API" keywords = [ "jupyter", "server", "fastapi", "plugins" ] requires-python = ">=3.8" dependencies = [ - "pycrdt >=0.4.2,<0.5.0", + "pycrdt >=0.5.0,<0.6.0", "jupyverse-api >=0.1.2,<1", ] dynamic = [ "version",] diff --git a/pyproject.toml b/pyproject.toml index 0c84f4c3..94f758e7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -54,8 +54,8 @@ test = [ "requests", "websockets", "ipykernel", - "ypywidgets >=0.6.1,<0.7.0", - "ypywidgets-textual >=0.2.1,<0.3.0", + "ypywidgets >=0.6.3,<0.7.0", + "ypywidgets-textual >=0.2.2,<0.3.0", ] docs = [ "mkdocs", "mkdocs-material" ]