Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Jupyter support 'read-only' notebooks?

My team is currently developing a fairly quick clustering job using Pandas for business analysts. We're planning on hosting a local server where the end user can input a few parameters to be used during the routine execution, which will access an internal database and then return a CSV file.

A Jupyter server would be ideal for us, but the problem is that we can't have the user being able to edit the underlying code - all he needs to do is supply the parameters and start job execution. Converting it to HMTL, I think, turns everything static and means we can't delived updated data on demand.

Plan B is just making a small django app but I'm wondering if there's a way to accomplish what I need with Jupyter itself, or else if there's any better alternative for similar use cases? We don't even plan to display any widgets, just provide the user with the raw data output.

thanks in advance

like image 737
pedrogfp Avatar asked Oct 30 '17 18:10

pedrogfp


People also ask

Why you should not use Jupyter Notebook?

It is almost impossible to enable good code versioning Due to the fact that jupyter notebooks are stored as big JSON files merging two notebooks is virtually impossible. This is bad because we cannot apply tools for software teams like a good git workflow will pull requests and reviews.

What are the cons of Jupyter Notebook?

Disadvantages of Jupyter Notebook It is very hard to test long asynchronous tasks. Less Security. It runs cell out of order. In Jupyter notebook, there is no IDE integration, no linting, and no code-style correction.


2 Answers

The notebook file can have its write permissions unset:

$ chmod -w notebook.ipynb

The notebook is still interactive, but the notebook file will not change.

Save symbol disabled with title "This notebook is read-only"

like image 179
Razzi Abuissa Avatar answered Oct 24 '22 12:10

Razzi Abuissa


There is also an notebook extension, Freeze which allows to lock (allow execution but not edit cell contents) or freeze (disables editing and execution) individual code cells or markdown blocks. This is important as order of execution for code cells matters while running notebook. This presentation at JupyterCon has more details on it.

like image 6
Samir Avatar answered Oct 24 '22 13:10

Samir