Side by Side - Jupyter Notebook Slideshows on RStudio Connect
TLDR; Turn a Jupyter Notebook into a reveal.js slideshow, then publish that HTML document to RStudio Connect.
If you use RStudio Connect at your organization, hopefully you already know how to publish different types of content built with the R programming language and package ecosystem. Recently, RStudio Connect has started supporting python-based content as well, including assets you’ve built in R that leverage reticulate, as well as static and source-code backed Jupyter Notebooks. Learn more here.
Now that RStudio Server Pro 1.2.5 has support for launching and managing RStudio and Jupyter sessions side-by-side, I wanted to create a series of posts where I explore some mini-projects that showcase data science communication workflows within an integrated toolchain. This is the first post in my RStudio + Jupyter - Side by Side series.
If you’re familiar with Jupyter Notebooks, you’ve likely seen or encountered the slideshow cell toolbar extension before:
This tool turns notebook cells into slideshow components. Each cell will have a drop-down selector for building the slideshow layout.
After saving the notebook, utilize nbconvert to generate the slideshow document:
jupyter nbconvert --to slides pyplot.ipynb --reveal-prefix "https://firstname.lastname@example.org"
Note: I added this reveal-prefix flag to overwrite the default value which wasn’t working properly at the time of this writing. Source: GH Issue
rsconnect-jupyter extension provides push-button publishing for Jupyter Notebooks, but not for additional static content generated from Jupyter Notebooks. Luckily, the
rsconnect R package, does support publication of general static content to Connect.
Since RStudio sessions and Jupyter Notebook sessions share a home directory, it’s easy to switch editors and publish this slideshow document from the RStudio IDE.
rsconnect package is available in RStudio because I’ve connected the IDE to my RStudio Connect publishing account already. To publish this static document to Connect, replace the
appPrimaryDoc name with the name of your own file:
rsconnect::deployApp(appPrimaryDoc = "pyplot.slides.html")
When the document is successfully deployed, it will open in RStudio Connect where you should be able to interact with the presentation controls:
From here you can adjust the access settings so that other people on your team or in your organization can discover and view the slideshow.
That’s all there is to it! Have fun sharing Jupyter Notebook slideshows!
See this Jupyter Notebook slideshow here: RStudio Connect Demo Server
Anticipated question: It looks all you’ve done here is use
rsconnectto deploy some static content. Do I need RStudio Server Pro 1.2.5 with the Jupyter Notebooks integration to do that?
Answer: Not at all. This post simply shows a workflow in which you do have this toolchain, and how nifty it is to develop with both Jupyter and RStudio in the same space.