Creating an interactive version of your code (mybinder.org)
mybinder.org1 is an awesome way of sharing your Python code and Jupyter notebooks in a GitHub repository by creating an interactive environment, where other people can run (but not change) your code without having Python installed.
The most simple setup
- Go to mybinder.org
- Paste the link to your GitHub repository
Path to a notebook filechange from
- Press launch - wait and a JupyterLab session will launch
- Save the resulting mybinder.org link
- Share the mybinder.org link with others
To include depencies (e.g. numpy and matplotlib) you repository need to have a folder called
/binder in its root directory. This folder must contain a
environment.yml file with lists of the dependencies. Your
projects-2019-YOURGROUPNAME repository automatically includes this, and most likely you do not need to change it. For an example of a
environment.yml file see here.
Advanced: To activate extensions for JupyterLab you additionally need a
postBuild file. For an example see here.
Installing dependencies on-the-fly
In a Jupyter Notebook, a package can always be installed on-the-fly by
!conda install [package1 ...] (if it is availible on conda) or otherwise by
!pip install [package1 ...].