/jupyterhub-binder-template

Primary LanguageJupyter NotebookOtherNOASSERTION

jupyterhub-binder-template

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.

Quick Instructions

Either use this repository as template or create a complete new repository following the rules below.

  1. Create/upload your Jupyter Notebooks and a requirements.txt file containing the dependencies of your Jupyter Notebooks.
  2. Visit https://mybinder.org/ and type in your repository information.
  3. The Binder URL leading to the Jupyter Notebook in Binder is generated and can then be copied.
  4. (Optional) For embedding a binder badge in the README.md, linking a certain Jupyter Notebook or using custom public data, see below.

Binder Badge

Binder (Binder badge for test.ipnyb Jupyter notebook)

How to add a binder badge to your README.md

  1. Type in the URL of your Git repository on the Binder webpage.
  2. 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:).
  3. 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

Direct Link to Jupyter Notebook

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 data to your Binder

Small size data (up to 10 MB)

  • Add directly to your repository

Middle size data (between 10 MB and 100 MB)

  • 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 the postBuild 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

Large size data

  • 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.

Example Binder repositories:

To find more examples and other Binder repositories with various cool user interfaces, check this link.


Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.