<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/note-on-my-emerging-workflow-for-working-with-binderhub/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://blog.ouseful.info/2017/12/01/my-emerging-workflow-for-working-with-binderhub/"> Rstats – OUseful.Info, the blog…</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>Yesterday saw the public reboot of Binder / MyBinder (which I first wrote about a couple of years ago <a rel="nofollow" href="https://blog.ouseful.info/2015/10/31/running-github-hosted-jupyter-previously-ipython-notebooks-as-online-applications/" target="_blank">here</a>), as reported in The Jupyter project blog post <a rel="nofollow" href="https://blog.jupyter.org/binder-2-0-a-tech-guide-2017-fd40515a3a84" target="_blank">Binder 2.0, a Tech Guide</a> and this practical guide: <a rel="nofollow" href="https://elifesciences.org/labs/8653a61d/introducing-binder-2-0-share-your-interactive-research-environment" target="_blank">Introducing Binder 2.0 — share your interactive research environment</a>.</p>
<p>For anyone not familiar with Binder / MyBinder, it’s a service that will launch a fully running Jupyter notebook server and computing environment based the contents of a Github repository (config files as well as notebooks).  What this means is that if you put your Jupyter notebooks into a Github repository, along with one or two simple files that least any Linux or Python packages you need to install in order to run the code in the notebooks (or R packages and perhaps Rmd files if you also <a rel="nofollow" href="https://github.com/binder-examples/dockerfile-rstudio" target="_blank">install an R kernel/RStudio</a>), you can get a browser access to that <em>running</em> environment at just the click of a link. And the generosity of whoever is paying for the servers the notebook server runs on.</p>
<p>The system has been rebuilt to use Jupyterhub, with a renaming as far as the codebase goes to <em>Binderhub</em>. There are also several utility tools associated with the project, including the really handy <a rel="nofollow" href="https://blog.ouseful.info/2017/11/10/some-recent-noticings-from-the-jupyter-ecosystem/" target="_blank">repo2docker</a> that builds a Docker image from the contents of a local folder or Github repository.</p>
<p>One of the things that particularly interested me in the announcement blog posts was the following aspirational remark:</p>
<blockquote>
<p>We would love to see others deploy their own BinderHub servers, either for their own communities, or as part of a federated public service of BinderHubs.</p>
</blockquote>
<p>I’d love to see the OU get behind this, either directly or under the banner of OpenLearn, as part of an effort to help make Jupyter powered interactive open educational materials available without the need to install any software.</p>
<p>(I tried to pitch it to FutureLearn to help support the OU/FutureLearn <em>Learn to Code for Data Analysis</em> MOOC when we were writing that course, but they weren’t interested…)</p>
<p>One disadvantage is Binderhub is a <em>stateless</em> service, which means you need to download any notebooks you’re working on and them upload them again yourself if you stop an interactive session: the environment you were working in is personal to you, but it’s also destroyed whenever you close the session (or after a particular amount of time? So other solutions are required for persisting state (i.e. having a personal file storage area). Jupyterhub is one way to do that (and one of the things we’re starting to explore in the OU at the moment).</p>
<p>Through playing with Binderhub over the last couple of weeks as part of an attempt to put together some demos for how to use Jupyter notebooks to support the creation of educational content that contains rich content (images, interactives) from specifications contained within the notebook document (think: <a rel="nofollow" href="https://blog.ouseful.info/2017/10/02/writing-diagrams-incl-mathematical-diagrams-and-maths-formulae/" target="_blank">writing diagrams</a>) I’ve come to the following workflow:</p>
<ul>
<li>create a Github repository to host different builds (<a rel="nofollow" href="https://github.com/psychemedia/showntell" target="_blank">example</a>). In my case, these are for different topic areas; but they could be different research projects, courses, data journalism investigations, etc.</li>
<li>put each build in a branch (<a rel="nofollow" href="https://github.com/psychemedia/showntell/tree/computing" target="_blank">example</a>);</li>
<li>work up the build instructions for the environment either using Github/Binder or locally; I was having to use Github/Binder because I was working on a slow network connection that made building my evolving image difficult. But it meant that every time I made a change to the build, it used up Binder resources to do so.</li>
<li>if the build is a big one, it can take time to complete. I think that Binder will rebuild the Docker image each time you update the repo, so even if you only update notebook files, then *I think* that that package installation steps are also run even if those files *haven’t* changed? To simplify this process, we can instead create a Docker image from out build files and push that to Dockerhub (<a rel="nofollow" href="https://github.com/psychemedia/showntell/tree/maps_build_image" target="_blank">example</a>).</li>
<li>We can then then create a new build process for our working repository that pulls the pre-built image (containing all the required packages) and adds in the working notebooks (<a rel="nofollow" href="https://github.com/psychemedia/showntell/tree/maps" target="_blank">example</a>).</li>
<li>We can also share a minimum viable repository that can be forked to allow other people to use the same environment (<a rel="nofollow" href="https://github.com/psychemedia/showntell/tree/maps_docker" target="_blank">example</a>).</li>
</ul>
<p>One advantage of this route is that it separates “sys admin” concerns – building and installing the required packages – from “working” concerns relating to developing the contents of the notebooks. (I think the working repository that uses the Dockerfile build can also draw on the <code>postbuild</code> file to add in any additional or missing packages, which can then be added to the container build as part of a maintenance step.)</p>
<p>PS picking up on a recent related Downes presentation – <a rel="nofollow" href="http://www.downes.ca/presentation/481" target="_blank">Applications, Algorithms and Data: Open Educational Resources and the Next Generation of Virtual Learning</a> – and a response from @jimgroom that I really need to comment back on – <a rel="nofollow" href="http://bavatuesdays.com/containing-the-future-of-oer/" target="_blank">Containing the Future of OER</a> – this phrase comes to mind: “syndicated runtime” eg if you syndicate the HTML version of a notebook via an RSS feed with a link back to the Binder runnable version of it…</p>
<p> <a rel="nofollow" href="https://feeds.wordpress.com/1.0/gocomments/ouseful.wordpress.com/17208/" target="_blank"><img border="0" alt="" src="https://feeds.wordpress.com/1.0/comments/ouseful.wordpress.com/17208/"></a> <img border="0" alt="" src="https://i1.wp.com/pixel.wp.com/b.gif?resize=1%2C1&ssl=1" data-recalc-dims="1"></p>
	<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="https://blog.ouseful.info/2017/12/01/my-emerging-workflow-for-working-with-binderhub/"> Rstats – OUseful.Info, the blog…</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a rel="nofollow" href="https://www.r-project.org/" title="The R Project for Statistical Computing">R</a> news and <a rel="nofollow" href="https://www.r-bloggers.com/search/tutorial" title="R tutorials">tutorials</a> on topics such as: <a rel="nofollow" href="https://www.r-bloggers.com/search/data%20science" title="Data science">Data science</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data" title="Big Data">Big Data, <a rel="nofollow" href="https://www.r-users.com/" title="R jobs">R jobs</a>, visualization (<a rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2" title="ggplot and ggplot2 tutorials">ggplot2</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/boxplot" title="Boxplots using lattice and ggplot2 tutorials">Boxplots</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/map" title="Maps and gis">maps</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/animation" title="Animation in R">animation</a>), programming (<a rel="nofollow" href="https://www.r-bloggers.com/search/RStudio" title="RStudio IDE for R">RStudio</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/sweave" title="Sweave and literate programming">Sweave</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX" title="LaTeX in R">LaTeX</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/SQL" title="SQL and databases">SQL</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/eclipse" title="Eclipse IDE for R">Eclipse</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/git" title="git and github, Version Control System">git</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/hadoop" title="Large data in R using Hadoop">hadoop</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping" title="Web Scraping of google, facebook, yahoo, twitter and more using R">Web Scraping</a>) statistics (<a rel="nofollow" href="https://www.r-bloggers.com/search/regression" title="Regressions and ANOVA analysis tutorials">regression</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/PCA" title="principal component analysis tutorial">PCA</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/time+series" title="Time series">time series</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/trading" title="finance trading">trading</a>) and more...
<img width="1" alt="" src="http://feeds.feedburner.com/~r/RBloggers/~4/z-q6rbTf6vE" height="1"></a></div>