FMRIPREP Development Environment: Lowering the barrier for new contributors?

Hi all,

I heard on a recent talkpythontome about a new extension on VS Code for “remote development”, that can be used to attach VS Code to running containers. Since FMRIPREP has a lot of dependencies that can only be reasonably installed in a container, being able to interactively debug the code in a graphical editor has remained a pipe dream, UNTIL TODAY.

I have a quick writeup and video (may want to play on double speed, I talk slow) for setting up your environment.

A similar setup could be used for whatever programming project you are working on with a container. I think this could make contributing to fmriprep and other open source projects easier, but I do not know all the barriers, so feedback is welcome.

I’m going to fiddle with this configuration periodically to improve it, but VS Code has now given me the best development experience so far with this new remote-development extension.

Also if you have other ways of testing/debugging your code locally, please let me know!

-James

5 Likes

This is amazing @jdkent great work! Just ran through the blog post and was able to get it working without too much trouble. The inevitable march of visual studio continues…

I wonder how hard it would be to take this to another level and installing browser version of vscode (https://github.com/cdr/code-server) inside the FMRIPREP container.

1 Like

Thanks @ChrisGorgolewski!

Could give this a spin:

Dockerfile

FROM poldracklab/fmriprep:latest


RUN pip uninstall -y fmriprep &&\
    cd /src/fmriprep &&\
    python setup.py develop

RUN curl -o /tmp/code-server.tar.gz -SL https://github.com/cdr/code-server/releases/download/1.1156-vsc1.33.1/code-server1.1156-vsc1.33.1-linux-x64.tar.gz

RUN mkdir /src/codeserver &&\
    tar -xvf /tmp/code-server.tar.gz -C /src/codeserver --strip-components=1

RUN /src/codeserver/code-server --install-extension eamodio.gitlens &&\
    /src/codeserver/code-server --install-extension ms-python.python
    

ENTRYPOINT ["/src/codeserver/code-server", "/src/fmriprep"]

Command

docker run -p 127.0.0.1:8443:8443 -v ${PWD}:/src/fmriprep fmriprep:code-server

If you have the test data downloaded in the guide you could mount that as well as specified in the guide.

This is awesome, appeared to work for me, just had trouble exiting the editor.

2 Likes

@rwblair @ChrisGorgolewski, I got around to making a more capable code-server prototype for fmriprep if you want to check it out here.

1 Like