What is #Binder?

I’m confused about what actually happens when I am looking at a GitHub repository and there is an “Open in Binder” button. I click that button and… then what? What is going on there? Can / Should I be taking advantage of this?

Rob, as always thanks for your interesting question. Binder is a cool technology but it takes a moment to get the hang of how it works.

In short there is some infrastructure out there that makes a fully executable copy of your repo, up to and including running Jupyter notebook cells, both code and markdown. For this to work you have to make sure the repo is ‘self-contained’ or ‘hermetic’; and you will want to test this out to be sure your binder badge is behaving as intended.

Suppose you click on a ‘launch in binder’ emblem; Away we go! Binder builds a Docker image from the source repo using repo2docker, then launches a container instance from that image.

Libraries are installed using a package manager like pip. The libraries are listed in either a requirements.txt` or `environment.ymlfile resident in the repo.

With that stage done the Container fires up a Jupyter notebook connected to a new tab in your browser and lo and behold, there you see notebooks and the code therein runs. You can even modify the code if you have ideas on things you would like to try.

In the idyllic open source world you would be able to use the notebooks to recreate figures from a paper associated with the repo.

Once you wander away from this binder executable environment: Eventually it will age out and evaporate; but you can go back and fire it up again if you like. Images are stored in binder’s own container registry; so future restarts will work from that image and be much faster to start.

The compute engine behind all this is modest; so binder is not suited to massive number crunching or GPU tasks.

Also to reiterate: When a binder instance evaporates: Nothing is written back to the source GitHub repo; that remains unchanged.

So binder is a kind of sandbox technology, for those who wish there was an easy way to work with a GitHub repo, particularly IPython notebooks, without having to do a lot of customization after an initial git clone to their own localhost.