Best practices on editing/testing locally before publishing to Binder?

Hi there,
I would like to make some teaching material using Jupyter notebook. I’ve spent the last few days playing with Binder, JupyterLab, Jupyter classic, RISE, and repo2docker, and really like what I’m finding.

At this stage however, I’m struggling a little making myself a working setup.
The governing principles I’d like to have would be as follows:

  • Being able to create my base repo locally (on my mac), test it with repo2docker, and edit my notebooks within it (in such a way that my local files are edited)
  • When I’m happy with the stage of my image / material, I can then commit this to the git repo and push it to GitHub
  • I can then generate a Binder from it, and distribute the URL to the students.
  • However, it might be that I have to make last minute changes, and don’t want to have to re-generate a new image with binder.

I’d really like to hear what people’s best practices would be.

I’ve played with the following:

  • Having one repo for my jupyter environment, with the appropriate requirements.txt, postBuild and .jupyter config directory. This one would rarely change and therefore the Binder container would remain relatively stable
  • Having the teaching material itself (notebooks) in another repo, and using a start script to pull it at the beginning of the student session, so that they get the latest material
  • I try to use repo2docker --editable with the local folder, to make sure that any file modified in the container are changed locally

However, when I test with this, I find that my container is actually different than if I was removing the --editable option, and (obviously) if I don’t use that option, my local files are not modified…

I’d love to hear what other people do

1 Like

One approach is to use a “slow” binder repo with your requirements in it, and a “fast” repo containing your teaching materials. If you install nbgitpuller into the “slow” repo, it can then be launched on MyBinder and used to pull in content from the “fast” repo.

Here’s a related discourse thread: Tip: embed custom github content in a Binder link with nbgitpuller

Here are some notes I made for myself on this.