Pineapple includes the "read-only" notebook extension built-in. This extension allows you to mark cells as read-only. When a cell is marked read-only it cannot be changed until the read-only is turned off.
Marking cells as read-only doesn't actually make them permanent or unchangeable. The point is to mark which parts of a notebook are intended to be edited and which parts are intended to be left alone. For example, a notebook could be used to represent an assignment in a class. Introduction cells could be marked read-only. Examples that are intended to be changed for experimentation could not be marked read-only. Description of the problem to be solved could be marked read-only.
Cells that are marked read-only cannot be edited. Markdown cells that are rendered cannot be changed to edit mode by double-clicking. Code cells cannot be edited but can be executed. Cells that are read-only cannot be deleted or moved.
To toggle a cell read-only and not read-only, choose the menu item Cell - Toggle read-only.
Cells that are read-only will usually have a distinct visual element. The precise appearance depends on the theme chosen. The "None" theme has no markings for read-only cells. "Light", "Dark", and "Borlandia" use a stripe pattern to mark code cells that are read-only. In "Light" and "Dark", rendered Markdown cells show the stripe pattern to indicate read-only when the cell is selected. The "Borlandia" theme uses different colored selection boxes to indicate when rendered Markdown cells are read-only.
Try changing the theme of this notebook to see the effects.
In [2]:
## This a normal code cell
def f(x):
return x
f(3)
Out[2]:
In [1]:
## This a read-only code cell
def f(x):
return x
f(10)
Out[1]: