Fork me on GitHub

Jupyter and JupyterLab: Sharing notebooks

Overview

Teaching: 10 min
Exercises: 0 min
Questions
  • How can I share notebooks with colleagues and the community?
Objectives
  • See what platforms and services exist to share Jupyter notebooks
  • Have a final discussion on notebooks in research.

Sharing notebooks

  • You can enter a URL, GitHub repo or username, or GIST ID in nbviewer and view a rendered Jupyter notebook
  • Read the Docs can render Jupyter Notebooks via the nbsphinx package
  • Binder creates live notebooks based on a GitHub repository
  • CoCalc (formerly SageMathCloud) allows collaborative editing of notebooks in the cloud
  • Google’s colaboratory lets you work on notebooks in the cloud, and you can read and write to notebook files on Drive
  • Microsoft Azure Notebooks also offers free notebooks in the cloud
  • JupyterLab supports sharing and collaborative editing of notebooks via Google Drive
  • Notedown, Jupinx and DocOnce can take Markdown or Sphinx files and generate Jupyter Notebooks
  • The jupyter nbconvert tool can convert a (.ipynb) notebook file to:
    • python code (.py file)
    • an HTML file
    • a LaTeX file
    • a PDF file
    • a slide-show in the browser

Note: the Google, Microsoft and CoCalc platforms are free but have paid subscriptions for faster access to cloud resources

Final discussion

  • If you are already using Jupyter, what tasks do you use it for?
  • If you are new to Jupyter, do you see any possible use cases?
  • Do you think Jupyter Notebooks can help tackle the problem of irreproducible results?

But Notebooks have some pitfalls

  • They don’t promote modularity, and once you get started in a notebook it can be hard to migrate to modules.
  • They are difficult to test. There are things to run notebooks as unit tests like nbval, but it’s not perfect.
  • Notebooks can be version controlled (nbdime helps with that), but there are still limitations.
  • You can change code after you run it and run code out of order. This can make debugging hard and results irreproducible if you aren’t careful.
  • Notebooks aren’t named by default and tend to acquire a bunch of unrelated stuff. Be careful with organization!
  • Once lots of code is in notebooks, it can be hard to change to proper programs that can be scripted.