Skip to content

All.publish notebook.how to guide

Publishing a notebook#

What it is about#

  • publish_notebook.py is a little tool that allows to:
    1. Opening a notebook in your browser (useful for read-only mode)
    2. E.g., without having to use Jupyter notebook (which modifies the file in your client) or github preview (which is slow or fails when the notebook is too large)
    3. Sharing a notebook with others in a simple way
    4. Pointing to detailed documentation in your analysis Google docs
    5. Reviewing someone's notebook
    6. Comparing multiple notebooks against each other in different browser windows
    7. Taking a snapshot / checkpoint of a notebook as a backup or before making changes
    8. This is a lightweight alternative to "unit testing" to capture the desired behavior of a notebook
    9. One can take a snapshot and visually compare multiple notebooks side-by-side for changes

You can get details by running: dev_scripts/notebooks/publish_notebook.py -h

Opening a notebook#

  • Inside the dev container
    docker> FILE=datapull/common/universe/notebooks/Master_universe_analysis.ipynb; publish_notebook.py --file $FILE --action convert
    
  • This converts the ipynb file into a HTML
  • Then you can open it from outside your container
    > open Master_universe_analysis.20231214-081257.html
    
    or pointing the browser to it

What has changed#

We've deployed the new service for storing notebooks in HTML format

  • From now on publish_notebook.py will work from the Docker container. The new version of publish_notebook.py works using HTTP protocol and does not require ssh key authorization as it was before
  • We've synchronized all documents. So all old docs already available on the new service