Open IPython notebooks (*.ipynb) in read-only view (like a HTML file)

前端 未结 7 1360
旧巷少年郎
旧巷少年郎 2021-01-31 17:13

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 ca

相关标签:
7条回答
  • 2021-01-31 17:42

    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).

    0 讨论(0)
  • 2021-01-31 17:44

    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:

    0 讨论(0)
  • 2021-01-31 17:45

    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.

    0 讨论(0)
  • 2021-01-31 17:57

    I was able to read .ipynb files as html in visual code. You would need a python plugin for it which visual code auto detects. Fairly straight forward after that.

    0 讨论(0)
  • 2021-01-31 18:00

    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.

    0 讨论(0)
  • 2021-01-31 18:03

    The best I can suggest - unfortunately still a bit verbose - is using nbconvert to create a HTML version of the file, then opening it with your browser. Below are commands to do this (assuming that your browser is set up as the default program to handle .html files). Just replace yournotebook.ipynb with your real Notebook name.

    Linux
    jupyter nbconvert --to html yournotebook.ipynb --output /tmp/notebook.html &&
    xdg-open /tmp/notebook.html
    
    macOS
    jupyter nbconvert --to html yournotebook.ipynb --output /tmp/notebook.html &&
    open /tmp/notebook.html
    

    Windows
    jupyter nbconvert --to html yournotebook.ipynb --output "%TEMP%\notebook.html" && start "" "%TEMP%\notebook.html"
    

    (Note that if you want to do this in bulk, perhaps in a loop in a script, you'll probably want to modify the commands above to not always use the same filename for the HTML file, to avoid the race condition where the HTML file has been overwritten by the time the browser actually gets round to starting to read it.)

    0 讨论(0)
提交回复
热议问题