Skip to content

Latest commit

 

History

History
129 lines (93 loc) · 4.97 KB

DEVOPS.md

File metadata and controls

129 lines (93 loc) · 4.97 KB

Developing within nf-neuro

Development container

A complete development container that setups you in a matter of minutes is available here.

Manual installation

Dependencies

  • Python ≥ 3.8, < 3.13
  • Docker ≥ 24 (we recommend using Docker Desktop)
  • Java Runtime ≥ 11, ≤ 17
    • On Ubuntu, install openjdk-jre-<version> packages
  • Nextflow ≥ 23.04.0
  • nf-test ≥ 0.9.0
  • Node ≥ 14, Prettier and editorconfig (see below)

Important

Nextflow might not detect the right Java virtual machine by default, more so if multiple versions of the runtime are installed. If so, you need to set the environment variable JAVA_HOME to target the right one.

  • Linux : look in /usr/lib/jvm for a folder named java-<version>-openjdk-<platform> and use it as JAVA_HOME.
  • MacOS : if the Java jvm is the preferential one, use JAVA_HOME=$(/usr/libexec/java_home). Else, look into /Library/Java/JavaVirtualMachines for the folder with the correct runtime version (named jdk<inner version>_1<runtime version>.jdk) and use the following : /Library/Java/JavaVirtualMachines/jdk<inner version>_1<runtime version>.jdk/Contents/Home.

Python environment

The project uses poetry to manage python dependencies. To install it using pipx, run the following commands :

pip install pipx
pipx ensurepath
pipx install poetry==1.8.*

Note

If the second command above fails, pipx cannot be found in the path. Prepend the second command with $(which python) -m and rerun the whole block.

Warning

Poetry doesn't like when other python environments are activated around it. Make sure to deactivate any before calling poetry commands.

Once done, install the project with :

poetry install --no-root

Loading the project's environment

Important

Make sure no python environment is activated before running commands !

The project scripts and dependencies can be accessed using :

poetry shell

which will activate the project's python environment in the current shell.

Note

You will know the poetry environment is activated by looking at your shell. The input line should be prefixed by : (nf-neuro-tools-py<version>), with <version> being the actual Python version used in the environment.

To exit the environment, simply enter the exit command in the shell.

Important

Do not use traditional deactivation (calling deactivate), since it does not relinquish the environment gracefully, making it so you won't be able to reactivate it without exiting the shell.

Global environment

Set the following environment variables in your .bashrc (or whatever is the equivalent for your shell) :

export NFCORE_MODULES_GIT_REMOTE=https://github.com/scilus/nf-neuro.git
export NFCORE_MODULES_GIT_BRANCH=main
export NFCORE_SUBWORKFLOWS_GIT_REMOTE=https://github.com/scilus/nf-neuro.git
export NFCORE_SUBWORKFLOWS_GIT_BRANCH=main

This will make it so the nf-core commands target the right repository by default. Else, you'll need to add --git-remote and --branch options to pretty much all commands relating to modules and subworkflows.

Working with VS Code

The nf-neuro project curates a bundle of useful extensions for Visual Studio Code, the nf-neuro-extensions package. You can find it easily on the extension marketplace.

Installing Prettier and editorconfig

To install Prettier and editorconfig for the project, you need to have node and npm installed on your system to at least version 14. On Ubuntu, you can do it using snap :

sudo snap install node --classic

However, if you cannot install snap, or have another OS, refer to the official documentation for the installation procedure.

Under the current configuration for the Development Container, for this project, we use the following procedure, considering ${NODE_MAJOR} is at least 14 for Prettier :

curl -fsSL https://deb.nodesource.com/setup_${NODE_MAJOR}.x | bash - &&\
apt-get install -y nodejs

npm install --save-dev --save-exact prettier
npm install --save-dev --save-exact editorconfig-checker

echo "function prettier() { npm exec prettier $@; }" >> ~/.bashrc
echo "function editorconfig-checker() { npm exec editorconfig-checker $@; }" >> ~/.bashrc