open ipython notebooks (*.ipynb) in read-only view (like a html file)

我们两清 提交于 2019-12-20 08:49:15

问题


Nowadays with more and more ipython notebook files (*.ipynb) around, it is very disturbing every time when I want to peek at some notebook I have to open a server for it, and cannot do it in read-only mode (due to auto-save I can accidentally change the file when reading it if not in read-only mode).

I hope something like this: ipython notebook mynb.ipynb --read-only would work, but sadly it doesn't (although still it creates a server which I don't really want in read-only view). What I really want is to open ipynb file like html file for reading, currently it seems a missing view of ipynb file, and now the notebook is more like a black-box or near-binary file alone.

(PS, I am using Linux/Ubuntu.)


回答1:


When you change the notebook files' permissions, jupyter's auto-save doesn't touch them:

chmod a-w *.ipynb

Then jupyter goes into read-only mode:




回答2:


Try this ipynb Viewer. This renders ipython notebook as a static web-page. Also ypu can convert ipyhton notebook to other formats using

ipython nbconvert --to FORMAT notebook.ipynb.

Refer Convert Ipython notebook to other formats. Using this you can convert ipython notebook to HTML.




回答3:


You may also want to try nteract app (https://nteract.io)

nteract is a desktop application that allows you to develop rich documents that contain prose, executable code (in almost any language!), and images.

Here you can find more detailed review of the app.

It is completely free and very convenient tool by itself and I use it quite often to see other ipynb files if needed and for quick development.




回答4:


Intellij IDEA (which is also available as free open-source community edition) can render ipynb files as well. In fact it also allows to author notebooks, so it's not just a viewer.

It can be used via file type associations or via the command line launcher (e.g. idea foo.pynb).




回答5:


I use Github Gist for that. You'll need a Github account.

If you specify *.ipynb file extension there for your content copy/paste, it'll detect it and format as html view. You'll be able even sharing it with someone using link if that's interesting. No tools required other than having a browser.

I've found some glitches in formatting though, mostly with output plots, but it's reasonably rare.

Random example here: https://gist.github.com/Clockware/aa7e01722579841d5888ca83385a5f1d




回答6:


For a simple viewer, written in Python, of ipynb-files, please see my answer to this question: A simple way to view ipython notebook .



来源:https://stackoverflow.com/questions/37145454/open-ipython-notebooks-ipynb-in-read-only-view-like-a-html-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!