Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Jupyter Book: Interactive books running in the ...

Jupyter Book: Interactive books running in the cloud

I talk about the Jupyter Project, an open community that builds public tools for solving data analytics problems. I also discuss a new project, Jupyter Book, that lets you weave multiple Jupyter Notebooks together into a single book-like document.

Chris Holdgraf

March 27, 2019
Tweet

More Decks by Chris Holdgraf

Other Decks in Technology

Transcript

  1. You San Jose Coffee! One option: walk there by myself

    Another option: pay somebody to drive me My favorite option: use public infrastructure
  2. One option: build it from scratch Another option: pay somebody

    for a product My favorite option: build on open, modular tools You Your Awesome report
  3. • Teach students the concepts of statistical thinking • Provide

    them an early experience in coding and interactive computing • Teach an open stack of languages and tools • Facilitate the learning experience with shared infrastructure • Work in partnership with open communities like Jupyter, contribute our improvements upstream.
  4. • A way to display notebook content in a more

    familiar, beautiful, and accessible form. • A way to add more bells and whistles that are geared towards reading. • An ability to connect this content with interactive computation. • A way to deploy all of this quickly and easily.
  5. 1. A collection of Jupyter Notebooks + markdown files 2.

    A Table of Contents yaml file (toc.yaml) 3. Some optional configuration (config.yaml) jupyter-book create mybook --content-folder path/to/content \ --config myconfig.yaml \ --toc mytoc.yaml
  6. mybook/ ├── assets ├── _config.yml ├── content ├── _data ├──

    Gemfile ├── Guardfile ├── _includes ├── _layouts ├── Makefile ├── requirements.txt ├── _sass ├── scripts └── _site
  7. • Build a static website out of a single set

    of text files • Use a templating engine to interpolate content into a site structure. • Lots and lots (and lots) of options to choose from.
  8. • Build a static website out of a single set

    of text files • Use a templating engine to interpolate content into a site structure. • Lots and lots (and lots) of options to choose from. ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨
  9. • Make sure we retain important metadata about cells •

    Need to keep structure for cells, inputs, outputs • Want rich content! jupyter-book build mybook
  10. mybook/ ├── assets └──_build ├── features │ ├── features.md │

    ├── interact.md │ ├── markdown.md │ ├── notebooks.md │ └── search.md ├── guide │ ├── 01_overview.md │ ├── 02_create.md └── intro.md jupyter-book build mybook
  11. • You can either upload to GitHub and build it

    with GitHub Pages • Or, install Ruby locally and build the HTML yourself! cd mybook make serve
  12. {"metadata" : { "kernel_info": { "name" : "my awesome kernel"

    }, "language_info": { "name" : "python3", "version": "0.1"} }, "nbformat": 4, "nbformat_minor": 0, "cells" : [ <list-of-cell-dictionaries> ]} Notebook metadata [ {'cell_type': 'markdown', 'metadata': {}, 'source': '# Hi there'}, {'cell_type': 'code', 'execution_count': 10, 'metadata': {}, 'outputs': [{'name': 'stdout', 'output_type': 'stream', 'text': '[-0.61023336 -0.35754269 -0.18629438 0.84355958 -0.14921895]\n'}], 'source': 'import numpy as np\ndata = np.random.randn(5)\nprint(data)'}, {'cell_type': 'markdown', 'metadata': {}, 'source': 'Look at those numbers!'} ] Cell Data
  13. • A page built from a notebook gets an interact

    button • Use JupyterHub/Binder to spawn a Jupyter server • `git pull` the underlying notebook for the page • Initialize an interactive environment
  14. Chris Is Trying A Live Demo Hopefully he doesn’t embarrass

    himself too badly. https://www.inferentialthinking.com/chapters/13/3/Confidence_Intervals.html
  15. • JupyterHub and Binder both run Jupyter kernels in the

    cloud • We can connect to these kernels on the backend turn “static” webpages into dynamic pages.
  16. thebelab ◦ Converts code blocks into editable cells that connect

    to a Binder / JupyterHub kernel ◦ http://thebelab.readthedocs.org nbinteract ◦ Display widgets in a static webpage, backed by a Binder kernel ◦ https://www.nbinteract.com/ ✨experimental✨
  17. Chris Is Trying A Live Demo Hopefully he doesn’t embarrass

    himself too badly. https://jupyter.org/jupyter-book/features/interactive_cells.html
  18. • Better story around citations, multiple output types, etc. pandoc

    mynotebook.ipynb -o mypage.html --filter pandoc-citeproc --bibliography=mybib.bibtex