This repo contains problem set templates for R and python and the binder settings to respectively run them in RStudio and Jupyter Lab (although you could run both R and python in either IDE). Once ready for student usage, make sure to cleanup unused files and adjust the binder settings as described below.

Cleanup

Generally, it is good to clean up the repo once ready for student usage by deleting unused files in the main and subdirectories. This also prevents your binder environment from installing more than is necessary. Key files to keep for R/python, respectively (keep both if you want to run both) in addition to your problem set notebook files:

R

  • binder/runtime.txt
  • binder/install.R
  • scripts/functions.R (if any functions)

Python

  • binder/environment.yml
  • binder/postBuild
  • scripts/functions.py (if any functions)
  • scripts/__init__.py (if any functions)

Binder Setup

Once ready for student use, make sure to modify the files in the binder sub-directory depending on which language the students should use for this problem set (R or Python or both). Binder will dockerize your repository the first time it is run with a new configuration but will re-use the docker image on subsequent launches. This means that the first time you launch binder for the latest version of your repo, it may take some time to launch but will be fast for everyone else aftewards. This means that you should always test-run your repository on binder before giving out the link to students. Switching between RStudio vs. Jupyter Lab as the IDE is done easily by changing the binder link as described below.

Important: binder will only work for public repositories. If your repository is private, you will have to make it public in the repository settings before you can launch it in binder. If you need to, you can turn a repository public just before students use it (leave enough time to start the binder environment for the first time), and then private again after use.

R

  • modify the binder/runtime.txt file to specify which R date snapshot should be used (the MRAN network keeps a daily snapshot)
  • modify the binder/install.R file to make sure all dependencies are specified. Dependencies can be from CRAN, bioconductor or GitHub. Since GitHub hosted libraries are not part of the MRAN snapshot, it is best to specify a commit or release tag to ensure that a compatible version of the package is installed in the binder.

Python

  • modify the binder/environment.yml file to specify the dependencies. The file is a standard conda environment config file and thus supports conda packages, version definitions, multiple source channels as well as pip installations.
  • modify the binder/postBuild file for any JupyterLab extensions or other direct install commands