# Binder template repositories

**URL:** <https://discourse.jupyter.org/t/binder-template-repositories/1522>\
**Category:** discuss\
**Tags:** tip, how-to\
**Created:** [June 30, 2019, 8:56am UTC](https://discourse.jupyter.org/t/binder-template-repositories/1522 "2019-06-30T08:56:53Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![betatim](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/betatim/32/10_2.png) [@betatim](https://discourse.jupyter.org/u/betatim)\
**Post date:** [June 30, 2019, 8:56am UTC](https://discourse.jupyter.org/t/binder-template-repositories/1522/1 "2019-06-30T08:56:53Z")

</div>

A few weeks ago GitHub announced that you can mark repositories as “template repositories”: [https://github.blog/2019-06-06-generate-new-repositories-with-repository-templates/](https://github.blog/2019-06-06-generate-new-repositories-with-repository-templates/)

This makes it easier for people to use a repository as a starting point for a new repo. I think in the past a lot of people cloned a repo and then edited it when they wanted a template.

Related to [An interactive Binder config file builder GUI](https://discourse.jupyter.org/t/an-interactive-binder-config-file-builder-gui/1510/) I was thinking we could/should create some template repositories for use with repo2docker and BinderHubs.

Should we convert the example repos under [github.com/binder-examples](http://github.com/binder-examples) or create dedicated ones?

I was thinking of creating three templates:

- Python with pip: uses `requirements.txt`, gives advice on how to pin (or not) dependencies, has a empty `postBuild` containing a comment about what you can do here, `runtime.txt` to select Python version, badges to launch Jupyter notebook and Jupyter lab
- Python with conda: uses `environment.yml`, mention how to select Python version, gives advice on how to pin (or not) dependencies, empty `postBuild` with comment, badges to launch Jupyter notebook and Jupyter lab
- R with `install.R`: explain `install.R`, explain MRAN date and `runtime.txt`, empty `postBuild` with comment, badge that launches R Studio

These seem like the most frequent use cases for beginners/people discovering repo2docker.

Thoughts?

---

<div class="post-metadata">

**Author:** ![psychemedia](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/psychemedia/32/24_2.png) [@psychemedia](https://discourse.jupyter.org/u/psychemedia)\
**Post date:** [June 30, 2019, 1:55pm UTC](https://discourse.jupyter.org/t/binder-template-repositories/1522/2 "2019-06-30T13:55:29Z")

</div>

This could provide an easy way of defining customisable “Binder base boxes” - create a template repo that has packages typically required for a particular application area, and it can be used both as a Binder base box that supports content top-ups from other repos using nbgitpuller, but that can also serve as a basis for cloning and customisation / extension of the Binder config files?

One of the things I’m quite interested in is workflows around Jupytext, and the template repos could simplify that? eg here’s my first minimal attempt: [https://github.com/ouseful-template-repos/jupytext-md](https://github.com/ouseful-template-repos/jupytext-md)

---

<div class="post-metadata">

**Author:** ![choldgraf](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/choldgraf/32/1264_2.png) [@choldgraf](https://discourse.jupyter.org/u/choldgraf)\
**Post date:** [June 30, 2019, 10:15pm UTC](https://discourse.jupyter.org/t/binder-template-repositories/1522/3 "2019-06-30T22:15:12Z")

</div>

I think this is a great idea - what do you think about two different layers of repositories.

One that would be for “base workflows” as Tim described above. It’d define basic environments, configuration files, etc…similar to what we’ve already got in `binder-examples`.

The second would be something more like “more opinionated” or “more specific” workflows, that would be for a particular challenge like “authoring” (that could include Jupytext and include a demonstration of the workflow that uses it) or “reproducibility” (that could include a nicely-version-tagged configuration file, show off how to mint a DOI, etc. This group would be more aspirational in nature and would evolve as more tools became available etc. Both groups of repositories would be meant to be demo’ed in Binder and templatized with GitHub for others to try.

---

<div class="post-metadata">

**Author:** ![betatim](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/betatim/32/10_2.png) [@betatim](https://discourse.jupyter.org/u/betatim)\
**Post date:** [July 1, 2019, 6:18am UTC](https://discourse.jupyter.org/t/binder-template-repositories/1522/4 "2019-07-01T06:18:46Z")

</div>

Let’s do it. I think this is an opportunity for people to help out. Anyone can create one of the template repositories (pip, conda, R) I mentioned, a base binder (like Tony mentioned, [kaggle binder](https://github.com/betatim/kaggle-binder/), [ouseful binder base](https://github.com/betatim/kaggle-binder/)) or a concrete, task specific one that Chris mentioned.

We can then host them on [github.com/binder-examples](http://github.com/binder-examples) or link to them. Depending on what people prefer. Or even from the landing page on [mybinder.org](http://mybinder.org). (Direct links to working examples/how to get started was a frequent ask in the binder user survey!)

---

<div class="post-metadata">

**Author:** ![psychemedia](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/psychemedia/32/24_2.png) [@psychemedia](https://discourse.jupyter.org/u/psychemedia)\
**Post date:** [July 1, 2019, 11:53am UTC](https://discourse.jupyter.org/t/binder-template-repositories/1522/5 "2019-07-01T11:53:40Z")

</div>

Agreed - there are (at least) those two classes of box, maybe even three (or more?):

- how to drive BinderHub through different sorts of config files;
- opinionated boxes that set up a particular environment or workflow (eg authoring Jupyter Book w/ jupytext, setting up different nbgrader environments, setting up stencila)
- opinionated boxes that can be used to quickstart a particular project in a given topic area (eg a scipystack build, an astronomy build, a text processing (nltk/spacy) build etc);

---

<div class="post-metadata">

**Author:** ![psychemedia](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/psychemedia/32/24_2.png) [@psychemedia](https://discourse.jupyter.org/u/psychemedia)\
**Post date:** [July 1, 2019, 3:26pm UTC](https://discourse.jupyter.org/t/binder-template-repositories/1522/6 "2019-07-01T15:26:20Z")

</div>

By the by, I think some templated recipes for how to run from repo2docker on the command line, showing how to mount various volumes etc, might also be useful for folk who want to run things locally using repo2docker but don’t really understand Docker/command line voodoo?

Also in the hinterland of templates, building blocks, and deployments:

- Littlest BinderHub]([Would a "The Littlest Binder" be useful?](https://discourse.jupyter.org/t/would-a-the-littlest-binder-be-useful/1041)) imaginings;
- [using nbgitpuller to pull content into a Binder environment](https://discourse.jupyter.org/t/tip-embed-custom-github-content-in-a-binder-link-with-nbgitpuller/922)

I’m not sure if these pieces are part of the same jigsaw or different ones. Or [maybe it doesn’t matter](https://mymodernmet.com/montage-puzzle-art-tim-klein/)?

---

<div class="post-metadata">

**Author:** ![minrk](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/minrk/32/13_2.png) [@minrk](https://discourse.jupyter.org/u/minrk)\
**Post date:** [July 11, 2019, 1:12pm UTC](https://discourse.jupyter.org/t/binder-template-repositories/1522/7 "2019-07-11T13:12:57Z")

</div>

I think the nbgitpuller pattern to separate image requirements from content (massively reduces rebuild requirements) is a great idea to start with.

---

<div class="post-metadata">

**Author:** ![sgibson91](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/sgibson91/32/487_2.png) [@sgibson91](https://discourse.jupyter.org/u/sgibson91)\
**Post date:** [September 27, 2019, 6:14am UTC](https://discourse.jupyter.org/t/binder-template-repositories/1522/8 "2019-09-27T06:14:34Z")

</div>

I love the idea of marking the binder-example repos as templates! Where are we with this?

---

<div class="post-metadata">

**Author:** ![choldgraf](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/choldgraf/32/1264_2.png) [@choldgraf](https://discourse.jupyter.org/u/choldgraf)\
**Post date:** [September 28, 2019, 12:49am UTC](https://discourse.jupyter.org/t/binder-template-repositories/1522/9 "2019-09-28T00:49:55Z")

</div>

I made all of the binder examples repos a “template” repo a few days ago!
