├── .travis.yml ├── Makefile ├── README.md ├── meta ├── make_page.py └── process.py ├── paper.tex ├── requirements.txt └── run.py /.travis.yml: -------------------------------------------------------------------------------- 1 | language: python 2 | sudo: false 3 | branches: 4 | only: 5 | - master 6 | python: 7 | - '3.5' 8 | install: 9 | - pip install -r requirements.txt 10 | - pip install ghp-import 11 | script: 12 | - '[ "${TRAVIS_PULL_REQUEST}" = "false" ] && make publish' 13 | notifications: 14 | email: false 15 | env: 16 | global: 17 | secure: Lgoz3bRQA2V9lWWasGrqzZJLXJJZEpI10RIGE67oeYI7/3ubgG95fEh9q7+eHrap/Rdf34xuZ6fZaBBuMl8TxotQpil592ONtVU6FibOeJiCGH2UEyGccL6f7ScLmFFIeDFP/O55KeNKJPwe6j1JhiHw/uSBQUpMw4y+5faUiBI1Ztz6VeOeOVHdnRJMAHCMVN2fYI/UBVWn38HqHbboQnTxGhgpmK+dhjr3Lev2tMbvtXEVG/Yq7ilUI9bzVMTzK2LnOAk64C/bKix/wRDhN1dMP705XkzIiNzlFUwa/bAWOaAdhcGGUtFsY8PZZP75GbBL4j3ftrkZ5goK5CY23IjUN10cgWvvp+GFeY2be8+qfU589sOdPweisyUXqfbpF4ti64i2bNRZQEj5Bez3Kpmbq7sWV3qh2UkVaRV1rwEwIYCuTYj3RxVUWnbGy6Venb0TeYWv3OyrSGQ4/3zz5mgp7aI9PgTOf+4cX94rM9xSg7anmS59N269XLfY491ys4JUfdVwU0HIlXzb4Rw/gcepw0MZz/OJiGvtQdx19X16FuwGoK+an4m/M0zYHFcNj15APpKqFiZD68lK5c/NfShabkGLyoKRwtODZbHVwSz4kANcfYC4xJ8H16aZa1Gvy9IQqVpZvH4BbkV9Eg9v3+fTcvH+NryUjV4K4eLwwW4= 18 | addons: 19 | apt: 20 | packages: 21 | - texlive-latex-recommended 22 | - texlive-latex-extra 23 | - texlive-extra-utils 24 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | 2 | target=$(shell git rev-parse HEAD) 3 | branch=$(shell git rev-parse --abbrev-ref HEAD) 4 | message=$(shell git log -n 1 --pretty=format:%s) 5 | docker_run=docker run -ti --rm -v $${PWD}:/root 6 | 7 | paper.pdf: paper.tmp.tex 8 | ${docker_run} leodido/texlive bash -c "cd /root; lualatex --jobname=paper paper.tmp.tex" 9 | 10 | paper.tmp.tex: paper.tex 11 | ${docker_run} python bash -c "cd /root; pip install --user -r requirements.txt; python meta/process.py run.py paper.tex" 12 | 13 | clean: 14 | ${docker_run} busybox bash -c "cd /root; rm *.pdf *.aux *.log paper.tmp.tex" 15 | 16 | publish: paper.pdf 17 | @git clone -b gh-pages https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git _deploy 18 | cp paper.pdf _deploy/data/${target}.pdf 19 | cp .meta/make_page.py _deploy 20 | git config --global user.email "" 21 | git config --global user.name "Automatic travis commit" 22 | cd _deploy; echo ${target},${message},data/${target}.pdf >> entries.csv 23 | cd _deploy; python make_page.py 24 | cd _deploy; git add entries.csv index.html ./data/${target}.pdf 25 | cd _deploy; git commit -m "Add automatically to gh-pages" || true 26 | @cd _deploy; git push -fq https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git gh-pages 27 | 28 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # Fully reproducible research paper example 3 | 4 | This is an example of a fully reproducible research paper using Github, Python, jinja2 and travis. 5 | On each `git push`, travis checks out this repository and executes the `run.py` script. 6 | 7 | The variables defined in that script are then made available to the jinja2 template `paper.tex` (which contains the LaTeX code for a research paper, with template fields for values that should be filled in from the script). 8 | Travis fills in the template and compiles `paper.tex` into a PDF file, which it then uploads to the `gh-pages` branch of this repository. (See https://ibab.github.io/fully-reproducible for the rendered web page) 9 | This means that each stage of the analysis is represented as a git commit with a corresponding PDF file. 10 | 11 | Once all researchers agree on a commit that should represent the final version of their paper, they can use `git tag` to mark it as the official final version. 12 | When the paper is in review, corrections can in turn be marked with `git tag`. 13 | 14 | All of this makes it very easy for researchers to collaborate. 15 | For example, they can make use of Github's pull request feature to enable other researchers in their group to have a look at what has been changed and what the result in the paper is before they accept the change. 16 | This not only makes it more likely that mistakes are spotted early on, but also increases the effectiveness of the group ("Why don't you make use of X?"). 17 | 18 | It also makes it possible for outsiders (machine learning experts, software engineers, laymen, …) to easily discover and contribute to research projects. 19 | Ideally, a fully reproducible research paper should be public from day 1! 20 | 21 | The idea outlined here is a very basic approach that can already be realized if the computational effort needed for the analysis is not too large (can run on a single travis node). 22 | With some work, it should be possible to automatically launch a cluster of nodes on a cloud provides like AWS instead. 23 | This should allow for arbitrarily difficult computations and should also make it easier for outsiders to verify the analysis by launching their own nodes. 24 | 25 | -------------------------------------------------------------------------------- /meta/make_page.py: -------------------------------------------------------------------------------- 1 | 2 | import csv 3 | import os 4 | 5 | template = """ 6 | 7 |
8 |message | 17 |
---|