jupyterlab-contrib/rise

Cell edits are ignored upon executing or rendering

Closed this issue · 1 comments

Description

When editing a cell in slides mode, the edits appear in edit mode but are ignored upon
rendering (for a markdown cell) or execution (for a code cell)

Reproduce

  1. Open a notebook
  2. Enter in a code cell 41+1 (or any other value that wasn't already there)
  3. Hit Control-Enter to execute
  4. 41.1 appears in the cell.
    Expected: 42 appears as output
    Obtained: the previous output is displayed
  5. Enter Foo in a markdown cell (or any other text that wasn't already there)
  6. Hit Control-Enter to render
    Expected: Foo appears in the rendered cell
    Obtained: the previous content of the cell is rendered

Context

  • Python package version:
pip show jupyterlab_rise
Name: jupyterlab_rise
Version: 0.40.0
Summary: RISE: "Live" Reveal.js JupyterLab Slideshow extension.
  • Extension version:
jupyter labextension list
JupyterLab v4.0.5
/opt/mambaforge/envs/jupyterhub-paris-saclay-test/share/jupyter/labextensions
        jupyterlab_pygments v0.2.2 enabled  X (python, jupyterlab_pygments)
        jupyterlab-rise v0.40.0 enabled OK (python, jupyterlab_rise)


   The following extensions are outdated:
        jupyterlab_pygments
        
   Consider checking if an update is available for these packages.

(jupyterhub-paris-saclay-test) ➜  image git:(master) ✗ jupyter server extension list
Config dir: /home/nthiery/.jupyter

Config dir: /opt/mambaforge/envs/jupyterhub-paris-saclay-test/etc/jupyter
    jupyter_lsp enabled
    - Validating jupyter_lsp...
Package jupyter_lsp took 0.0090s to import
A `_jupyter_server_extension_points` function was not found in jupyter_lsp. Instead, a `_jupyter_server_extension_paths` function was found and will be used for now. This function name will be deprecated in future releases of Jupyter Server.
      jupyter_lsp 2.2.0 OK
    jupyter_server_terminals enabled
    - Validating jupyter_server_terminals...
Package jupyter_server_terminals took 0.0041s to import
      jupyter_server_terminals 0.4.4 OK
    jupyterlab enabled
    - Validating jupyterlab...
Package jupyterlab took 0.0741s to import
      jupyterlab 4.0.5 OK
    jupyterlab_rise enabled
    - Validating jupyterlab_rise...
Package jupyterlab_rise took 0.0015s to import
      jupyterlab_rise 0.40.0 OK
    notebook_shim enabled
    - Validating notebook_shim...
Package notebook_shim took 0.0000s to import
A `_jupyter_server_extension_points` function was not found in notebook_shim. Instead, a `_jupyter_server_extension_paths` function was found and will be used for now. This function name will be deprecated in future releases of Jupyter Server.
      notebook_shim  OK

Config dir: /usr/local/etc/jupyter

<details><summary>Command Line Output</summary>
<pre>
jupyter lab test.ipynb         
[I 2023-09-01 08:22:38.556 ServerApp] Package jupyterlab took 0.0000s to import
[I 2023-09-01 08:22:38.565 ServerApp] Package jupyter_lsp took 0.0091s to import
[W 2023-09-01 08:22:38.565 ServerApp] A `_jupyter_server_extension_points` function was not found in jupyter_lsp. Instead, a `_jupyter_server_extension_paths` function was found and will be used for now. This function name will be deprecated in future releases of Jupyter Server.
[I 2023-09-01 08:22:38.569 ServerApp] Package jupyter_server_terminals took 0.0038s to import
[I 2023-09-01 08:22:38.571 ServerApp] Package jupyterlab_rise took 0.0016s to import
[I 2023-09-01 08:22:38.572 ServerApp] Package notebook_shim took 0.0000s to import
[W 2023-09-01 08:22:38.572 ServerApp] A `_jupyter_server_extension_points` function was not found in notebook_shim. Instead, a `_jupyter_server_extension_paths` function was found and will be used for now. This function name will be deprecated in future releases of Jupyter Server.
[I 2023-09-01 08:22:38.572 ServerApp] jupyter_lsp | extension was successfully linked.
[I 2023-09-01 08:22:38.576 ServerApp] jupyter_server_terminals | extension was successfully linked.
[I 2023-09-01 08:22:38.581 ServerApp] jupyterlab | extension was successfully linked.
[I 2023-09-01 08:22:38.585 ServerApp] jupyterlab_rise | extension was successfully linked.
[I 2023-09-01 08:22:38.765 ServerApp] notebook_shim | extension was successfully linked.
[I 2023-09-01 08:22:38.780 ServerApp] notebook_shim | extension was successfully loaded.
[I 2023-09-01 08:22:38.782 ServerApp] jupyter_lsp | extension was successfully loaded.
[I 2023-09-01 08:22:38.783 ServerApp] jupyter_server_terminals | extension was successfully loaded.
[I 2023-09-01 08:22:38.784 LabApp] JupyterLab extension loaded from /opt/mambaforge/envs/jupyterhub-paris-saclay-test/lib/python3.11/site-packages/jupyterlab
[I 2023-09-01 08:22:38.784 LabApp] JupyterLab application directory is /opt/mambaforge/envs/jupyterhub-paris-saclay-test/share/jupyter/lab
[I 2023-09-01 08:22:38.785 LabApp] Extension Manager is 'pypi'.
[I 2023-09-01 08:22:38.787 ServerApp] jupyterlab | extension was successfully loaded.
[I 2023-09-01 08:22:38.789 ServerApp] jupyterlab_rise | extension was successfully loaded.
[I 2023-09-01 08:22:38.789 ServerApp] Serving notebooks from local directory: /opt/jupyterhub-paris-saclay/image
[I 2023-09-01 08:22:38.789 ServerApp] Jupyter Server 2.7.3 is running at:
[I 2023-09-01 08:22:38.789 ServerApp] http://localhost:8888/lab?token=99e90429e3d6c2ad3e80086d1f9f8ead7f45dcc1788ba33d
[I 2023-09-01 08:22:38.789 ServerApp]     http://127.0.0.1:8888/lab?token=99e90429e3d6c2ad3e80086d1f9f8ead7f45dcc1788ba33d
[I 2023-09-01 08:22:38.789 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 2023-09-01 08:22:38.805 ServerApp] 
    
    To access the server, open this file in a browser:
        file:///home/nthiery/.local/share/jupyter/runtime/jpserver-316566-open.html
    Or copy and paste one of these URLs:
        http://localhost:8888/lab?token=99e90429e3d6c2ad3e80086d1f9f8ead7f45dcc1788ba33d
        http://127.0.0.1:8888/lab?token=99e90429e3d6c2ad3e80086d1f9f8ead7f45dcc1788ba33d
[I 2023-09-01 08:22:38.821 ServerApp] Skipped non-installed server(s): bash-language-server, dockerfile-language-server-nodejs, javascript-typescript-langserver, jedi-language-server, julia-language-server, pyright, python-language-server, python-lsp-server, r-languageserver, sql-language-server, texlab, typescript-language-server, unified-language-server, vscode-css-languageserver-bin, vscode-html-languageserver-bin, vscode-json-languageserver-bin, yaml-language-server
0.00s - Debugger warning: It seems that frozen modules are being used, which may
0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off
0.00s - to python to disable frozen modules.
0.00s - Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation.
[W 2023-09-01 08:22:42.675 LabApp] Could not determine jupyterlab build status without nodejs
[I 2023-09-01 08:22:45.763 ServerApp] Saving file at /test.ipynb
[W 2023-09-01 08:22:49.034 ServerApp] 403 GET /files//rise.css (127.0.0.1): /rise.css is not in root static directory
[W 2023-09-01 08:22:49.048 ServerApp] 403 GET /files//rise.css (e432f6a9903a4ecda74b292401eadd49@127.0.0.1) 14.90ms referer=http://localhost:8888/rise/test.ipynb
[W 2023-09-01 08:22:49.049 ServerApp] 403 GET /files//test.css (127.0.0.1): /test.css is not in root static directory
[W 2023-09-01 08:22:49.050 ServerApp] 403 GET /files//test.css (e432f6a9903a4ecda74b292401eadd49@127.0.0.1) 1.55ms referer=http://localhost:8888/rise/test.ipynb
[I 2023-09-01 08:22:49.095 ServerApp] Kernel started: 463e0ee3-1b2a-4d80-bac3-b3b49d62e38e
[W 2023-09-01 08:22:49.231 ServerApp] 404 GET /static/rise/img/sponge.png (e432f6a9903a4ecda74b292401eadd49@127.0.0.1) 3.58ms referer=http://localhost:8888/rise/test.ipynb
[W 2023-09-01 08:22:49.236 ServerApp] 404 GET /static/rise/img/boardmarker-black.png (e432f6a9903a4ecda74b292401eadd49@127.0.0.1) 2.03ms referer=http://localhost:8888/rise/test.ipynb?activeCellIndex=0
[W 2023-09-01 08:22:49.240 ServerApp] 404 GET /static/rise/img/chalk-white.png (e432f6a9903a4ecda74b292401eadd49@127.0.0.1) 2.31ms referer=http://localhost:8888/rise/test.ipynb?activeCellIndex=0
[W 2023-09-01 08:22:49.242 ServerApp] 404 GET /static/rise/img/blackboard.png (e432f6a9903a4ecda74b292401eadd49@127.0.0.1) 3.76ms referer=http://localhost:8888/rise/test.ipynb?activeCellIndex=0
0.00s - Debugger warning: It seems that frozen modules are being used, which may
0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off
0.00s - to python to disable frozen modules.
0.00s - Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation.
[I 2023-09-01 08:22:49.908 ServerApp] Connecting to kernel 463e0ee3-1b2a-4d80-bac3-b3b49d62e38e.
[I 2023-09-01 08:22:53.955 ServerApp] Connecting to kernel 463e0ee3-1b2a-4d80-bac3-b3b49d62e38e.
</pre>
</details>

No specific message in the web console.

I've been looking into this issue and am hoping to get pointed in the right direction.

As a disclaimer, I'm new to JupyterLab extensions so my terminology could be very off.

Environment:

jupyter_client                7.4.9
jupyter_core                  5.3.1
jupyter-events                0.7.0
jupyter-lsp                   2.2.0
jupyter_server                2.10.0
jupyter_server_fileid         0.9.0
jupyter-server-mathjax        0.2.6
jupyter_server_terminals      0.4.4
jupyter_server_ydoc           0.8.0
jupyter-telemetry             0.1.0
jupyter-ydoc                  0.2.5
jupyterhub                    4.0.2
jupyterlab                    4.0.8
jupyterlab_git                0.42.0
jupyterlab-pygments           0.2.2
jupyterlab_rise               0.41.0    
jupyterlab_server             2.25.0
jupyterlab-widgets            3.0.9

Here is what I found so far:

For example if I create a notebook with a single empty cell, open it in RISE, change the cell's contents to print("test"), and then save with Cmd+s, the JupyterLab API PUT request shows the cell source as empty (shown below). Running the cell outputs nothing and the cell edit is not shown in the original notebook.

Contents of PUT request to http://127.0.0.1:8888/api/contents/examples/issue-43.ipynb?1699395590087:

{"name": "issue-43.ipynb", "path": "examples/issue-43.ipynb", "last_modified": "2023-11-07T22:19:50.127128Z", "created": "2023-11-07T22:19:50.127128Z", "content": {"cells": [{"cell_type": "code", "execution_count": null, "id": "86e79d67-836a-4d98-8ac5-441c84ef1a3d", "metadata": {"trusted": true}, "outputs": [], "source": ""}], "metadata": {"kernelspec": {"display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3"}, "language_info": {"codemirror_mode": {"name": "ipython", "version": 3}, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.5"}}, "nbformat": 4, "nbformat_minor": 5}, "format": "json", "mimetype": null, "size": 617, "writable": true, "type": "notebook"}

Which seems to indicate the notebook the slides are generated from is not listening to changes in cell content or the cells themselves do not recognize when their content changes, which may be the case as the jp-mod-dirty CSS class is also not added by a cell when edited.

However if I add a new cell, delete, or split a cell, and then save, the original notebook will show that change.

I tried commenting out all of the code that turns a NotebookPanel into a Reveal slideshow in packages/application/src/plugins/rise.ts so that RISE essentially just opens a regular notebook (i.e. just docmanager.open and then app.shell.add), but the same issue occurs so likely none of the Reveal related code is the cause.

I thought maybe the RISE server extension, but it seems there weren't any major differences between the 0.3.x branch (which appears to not have this issue with JupyterLab 3.6.6) and the main branch in terms of the server extension.

I did notice this error in the console which may or may not be relevant:

index.js:225 Error: Shared module codemirror doesn't exist in shared scope default
    at l (remoteEntry.265228b546125022c5c6.js:1:6646)
    at remoteEntry.265228b546125022c5c6.js:1:7688
    at remoteEntry.265228b546125022c5c6.js:1:7596
    at 8681 (remoteEntry.265228b546125022c5c6.js:1:10005)
    at remoteEntry.265228b546125022c5c6.js:1:10786
    at Array.forEach (<anonymous>)
    at x.f.consumes (remoteEntry.265228b546125022c5c6.js:1:10616)
    at remoteEntry.265228b546125022c5c6.js:1:1174
    at Array.reduce (<anonymous>)
    at x.e (remoteEntry.265228b546125022c5c6.js:1:1152)

Thanks!