Update: Binder now fully supports Julia v1 and its Project.toml
and Manifest.toml
, which make creating reproducible environments even more easy and reliable. See here for the announcement.
Today I’ve been introduced to Binder. I found a few references to this tool on Discourse but not a topic on its own devoted to Binder, so I thought that it could be useful for some people to explain what it is and how to use Julia with it.
Introduction
Binder is a website where you can run an interactive environment (basically a Jupyter server) created out of a repository. Under the hood, it creates for you a Docker image of your repository that you can use remotely. This is meant to be as a tool to deliver reproducible research.
HOWTO
Binder workflow
You only need to create a repository (e.g., on GitHub, but probably any other public source hosting website should work) with your code. The REQUIRE
lets Binder know that you want to use Julia. I’m not sure what exactly is the syntax expected by Binder, for example it doesn’t seem to need a julia
line (I tried to use it but it failed to create the environment, not sure this was the problem but didn’t try again because it’d have taken too long).
Once you create a repository with your code, go to https://mybinder.org/, insert the information about your repository and click on the “launch” button. And wait. That’s all.
Very simple example
I’ve created an almost useless example here: GitHub - giordano/my-first-binder at julia. The Binder is at Binder A Jupyter server will be opened. From there, you can either open a terminal where to run the code (well, the hello.jl
does very little) or create a new notebook.
Personal comments
First of all, following the current documentation (2019-03-12) I was able to run only Julia v0.6.4 with Binder. I see that support for Julia v1+ is coming, hopefully quite soon. This should include also support for the new Project.toml
and Manifest.toml
files. Probably there is already something in place but the documentation needs to be updated?
One of the main goals of Binder is to create a fixed environment where to run your code in a reproducible way. This is achieved by enforcing the use of REQUIRE
file for Julia or the requirements.txt
file for Python. Julia v1 already does a great job at creating fixed environments with the use of the TOML files which are truly part of code loading, contrary to, e.g., requirements.txt
for Python. However, the nice feature of Binder is to provide an interactive environment where to run the code remotely.
Note that this service comes free of charge, so do expect occasionally long waiting times, especially when creating for the first time an image for a given revision of you repository, this operation can take several minutes (more than 10). Open the log when loading a Binder environment, at least you can see what’s happening.
Despite some annoying issues with slow creation of the image, Binder looks like a great option for sharing your code with other people and let them play with it, even without having to install Julia themselves. With full Julia v1 support this can be a great resource for doing reproducible research.
Further reading
You can find Binder documentation at Binder Documentation — Binder 0.1b documentation. Several examples of Binder repository are at Binder Examples · GitHub