Contributing to FMRIPREP¶
This document explains how to prepare a new development environment and update an existing environment, as necessary.
Development in Docker is encouraged, for the sake of consistency and portability. By default, work should be built off of poldracklab/fmriprep:latest (see the installation guide for the basic procedure for running).
Patching working repositories¶
In order to test new code without rebuilding the Docker image, it is
possible to mount working repositories as source directories within the
In the docker container, the all Python packages are installed in
To patch in working repositories of FMRIPREP or its dependencies, for instance
$HOME/projects/, add the following arguments to your docker
-v $HOME/projects/fmriprep/fmriprep:/usr/local/miniconda/lib/python3.6/site-packages/fmriprep:ro -v $HOME/projects/niworkflows/niworkflows:/usr/local/miniconda/lib/python3.6/site-packages/niworkflows:ro -v $HOME/projects/nipype/nipype:/usr/local/miniconda/lib/python3.6/site-packages/nipype:ro
$ docker run --rm -v $HOME/fullds005:/data:ro -v $HOME/dockerout:/out \ -v $HOME/projects/fmriprep/fmriprep:/usr/local/miniconda/lib/python3.6/site-packages/fmriprep:ro \ poldracklab/fmriprep:latest /data /out/out participant \ -w /out/work/
In order to work directly in the container, use
omit the fmriprep arguments:
$ docker run --rm -v $HOME/fullds005:/data:ro -v $HOME/dockerout:/out \ -v $HOME/projects/fmriprep/fmriprep:/usr/local/miniconda/lib/python3.6/site-packages/fmriprep:ro --entrypoint=bash \ poldracklab/fmriprep:latest
Patching containers can be achieved in Singularity by using the PYTHONPATH variable:
$ PYTHONPATH="$HOME/projects/fmriprep" singularity run fmriprep.img \ /scratch/dataset /scratch/out participant -w /out/work/
New dependencies to be inserted into the Docker image will either be Python or non-Python dependencies. Python dependencies may be added in three places, depending on whether the package is large or non-release versions are required. The image must be rebuilt after any dependency changes.
Finally, if a specific version of a repository needs to be pinned, edit
See the current
file for examples.
Non-Python dependencies must also be installed in the Dockerfile, via a
For example, installing an
apt package may be done as follows:
RUN apt-get update && \ apt-get install -y <PACKAGE>
Rebuilding Docker image¶
If it is necessary to rebuild the Docker image, a local image named
fmriprep may be built from within the working fmriprep
repository, located in
~/projects/fmriprep$ docker build -t fmriprep .
To work in this image, replace
fmriprep in any of the above commands.