The following information was extracted from "From Zero to Binder in Python!" by Sarah Gibson (The Alan Turing Institute) (21.01.2022) which belongs to The Turing Way Community. This repo uses content of former mentioned repository and should provide a brief summary of required steps to run a Jupyter Notebook in a Git repository using Binder.
Either use this repository as template or create a complete new repository following the rules below.
- Create/upload your Jupyter Notebooks and a
requirements.txt
file containing the dependencies of your Jupyter Notebooks. - Visit https://mybinder.org/ and type in your repository information.
- The Binder URL leading to the Jupyter Notebook in Binder is generated and can then be copied.
- (Optional) For embedding a binder badge in the
README.md
, linking a certain Jupyter Notebook or using custom public data, see below.
(Binder badge for test.ipnyb
Jupyter notebook)
- Type in the URL of your Git repository on the Binder webpage.
- Expend the the last toggle element in the gray box (Expand to see the text below, paste it into your README to show a binder badge:).
- Copy the Markdown or ReStructeured text snippet into your
README.md
.
It should have the following format (Replace <SOME VARIABLE>
with your data):
- Markdown
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/<GIT USER>/<REPOSITORY>/HEAD)
- ReStructured Text
.. image:: https://mybinder.org/badge_logo.svg
:target: https://mybinder.org/v2/gh/<GIT USER>/<REPOSITORY>/HEAD
In order to link a certain Jupyter Notebook adjust the above link to the following format:
https://mybinder.org/v2/gh/<GIT USER>/<REPOSITORY>/HEAD?labpath=<JUPYTER NOTEBOOK NAME>
Example: https://mybinder.org/v2/gh/SupraCoNeX/jupyterhub-binder-template/HEAD?labpath=test.ipynb
- Add directly to your repository
- Add a
postBuild
script/file to your repo postBuild
script can include middle size data into your image- See Binder's
postBuild
example for more uses of thepostBuild
script.
Example postBuild
for downloading data from the internet and add them to your repo image created by Binder:
wget -q -O gapminder.csv http://bit.ly/2uh4s3g
- Use a library specific to the data format to stream the data as you're using it or to download it on demand as part of your code
- For security reasons, the outgoing traffic of your Binder is restricted to HTTP or GitHub connections only. You will not be able to use FTP sites to fetch data on mybinder.org
Note: Only public data can be shared here. In order to share private data, the local deployment of BinderHub is required. This is not part of this manual.
To find more examples and other Binder repositories with various cool user interfaces, check this link.
This work is licensed under a Creative Commons Attribution 4.0 International License.