Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read-only cells are not enforced if jupyterlab-execute-time is installed #107

Closed
ianalis opened this issue Dec 10, 2023 · 3 comments
Closed
Labels
bug Something isn't working

Comments

@ianalis
Copy link

ianalis commented Dec 10, 2023

Cells can be made read-only by adding "editable": false to the cell metadata. The contents of the read-only cell can still be selected and the cursor can still be placed in it but the content cannot be modified or added:

image

However, if jupyterlab-execute-time is installed, the content of the read-only cell becomes editable:

image

The test system I used to generate the screenshots has the following (selected) installed packages:

    jupyter_client            8.6.0              pyhd8ed1ab_0    conda-forge
    jupyter_core              5.5.0           py310hbe9552e_0    conda-forge
    jupyter_server            2.12.1             pyhd8ed1ab_0    conda-forge
    jupyterlab                4.0.6              pyhd8ed1ab_0    conda-forge
    jupyterlab_execute_time   3.1.0              pyhd8ed1ab_0    conda-forge
    jupyterlab_server         2.25.2             pyhd8ed1ab_0    conda-forge
    python                    3.10.13         h2469fbe_0_cpython    conda-forge

The production system where I discovered the problem has the following (older) versions:

    jupyter_client            8.3.1              pyhd8ed1ab_0    conda-forge
    jupyter_core              5.3.2           py310hff52083_0    conda-forge
    jupyter_server            2.7.3              pyhd8ed1ab_1    conda-forge
    jupyterlab                3.6.6              pyhd8ed1ab_0    conda-forge
    jupyterlab_execute_time   2.3.1              pyhd8ed1ab_0    conda-forge
    jupyterlab_server         2.25.0             pyhd8ed1ab_0    conda-forge
    python                    3.10.12         hd12c33a_0_cpython    conda-forge
@krassowski
Copy link
Collaborator

I can reproduce. Changing editable status works well, but upon re-opening the notebook the cell is in fact editable.

reproducible-upon-reopening

@krassowski
Copy link
Collaborator

This is an interesting case. There is no obvious fault on jupyterlab-execute-time side. This can be traced to switching the recordTiming setting in line 61 here:

this._settingRegistry
.load('@jupyterlab/notebook-extension:tracker')
.then(
(nbSettings: ISettingRegistry.ISettings) =>
nbSettings.set('recordTiming', true),

However, changing this setting manually does not lead to this side-effect.

Briefly, programatically changing a notebook tracker setting triggers refresh of editorConfig, which removes the readOnly flag because it has "special" handling (the read-only status come from the model rather than from the user settings).

I found a way to reproduce this in core JupyterLab (which also changes settings programatically in some code paths) and opened an issue over there: jupyterlab/jupyterlab#15514

@mlucool
Copy link
Member

mlucool commented Jan 30, 2024

Closing in favor of jupyterlab/jupyterlab#15514.

@mlucool mlucool closed this as completed Jan 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants