To run code, you need (at least) the following things:
python
, r
)pandas
, matplotlib
)Binder is a service that provides your code, the hardware, and the software.
You can create a link to a live, interactive version of your code.
Here's an example of a Binder link:
Clicking it will create a live version of the Data Exploration notebook from the earlier lesson, which is maintained in this GitHub repository:
https://github.com/Reproducible-Science-Curriculum/data-exploration-RR-Jupyter
Note: The Binder link has a very similar structure to the github repository link!
To build a Binder go to mybinder.org
and paste in the URL of your repository, like so:
Now that you've got a Binder, you can share a link that will let others interact with it.
This link is listed in the Binder GUI and should update itself as you fill in the forms. Copy the link and share it with your friends!
If you are using other packages, you need tell Binder what to do!
We need to create a file to specify which software we need.
In python, that file is called requirements.txt
.
We also need to include any additional resources (e.g., any data files we need like gapminder.csv
).
Using the GitHub GUI, click the "create new file" button. This will open a text editor where you can create a new file in your GitHub repository.
In the "new file" GUI, we'll write down the software needed to run this code.
In our case, this means matplotlib
and pandas
.
We'll call this file requirements.txt
, as these are the requirements for running the code.
To build a Binder go to mybinder.org
& click launch
to build your Binder
Binder will find your requirements.txt
and provides the software for running your code.
This may take a while!
When it's ready, Binder will link you to a live Jupyter Notebook session running in the cloud!
In this section we started with a static GitHub repository with Jupyter Notebooks inside. We then...
requirements.txt
that specified which software was needed to run our code.mybinder.org
interface to build a Binder from this repository.There are many more workflows that you can enable with Binder, and we recommend checking out a list of example Binder repositories at: