Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Read Only Python Notebook in Jupyter Lab

How can we edit an existing .ipynb in Jupyter Lab to be read-only? More specifically, how can we make specific cells within an existing .ipynb become read-only?

Basically, other users would be able to edit cells that I allow them to (i.e. a cell that specifies an input data file) but all code in other analysis cells can be run but not edited.

If I can't edit an existing .ipynb file to do this, I don't mind saving a notebook with a different name via "Save as" if that makes things easier.

like image 577
YogiOnBioinformatics Avatar asked Nov 14 '25 20:11

YogiOnBioinformatics


1 Answers

I received an answer (below the underline) from the issue I opened on the JupyterLab GitHub

Thanks to Alex for the answer.

Original GitHub Issue post is here.


You just need to add

{
    "editable": false
}

in your cell Metadata.

If you are using Jupyterlab, you can install the Celltags extension for ease of metadata editing.

like image 101
YogiOnBioinformatics Avatar answered Nov 17 '25 10:11

YogiOnBioinformatics



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!