Skip to content

Commit a648781

Browse files
authored
Merge pull request #42 from bids-apps/lint
[ENH] reformat, refactor and implement some bids app 2.0 features
2 parents 37b2e3d + 32d679c commit a648781

File tree

11 files changed

+269
-99
lines changed

11 files changed

+269
-99
lines changed

.circleci/config.yml

+8-16
Original file line numberDiff line numberDiff line change
@@ -50,42 +50,34 @@ jobs:
5050

5151
- run: mkdir -p ${HOME}/outputs<< parameters.dataset >>
5252

53+
- run: sudo apt-get install tree
54+
5355
- run:
5456
name: print version
5557
command: |
5658
docker run -ti --rm --read-only \
5759
-v /tmp/workspace/data/ds114_test1:/bids_dataset \
5860
bids/${CIRCLE_PROJECT_REPONAME,,} --version
5961
60-
# participant level tests for single session dataset
61-
- run:
62-
command: |
63-
docker run -ti --rm --read-only \
64-
-v /tmp/workspace/data/ds114_test<< parameters.dataset >>:/bids_dataset \
65-
-v ${HOME}/outputs<< parameters.dataset >>:/outputs \
66-
bids/${CIRCLE_PROJECT_REPONAME,,} /bids_dataset /outputs participant --participant_label 01
67-
no_output_timeout: 6h
6862
- run:
63+
name: participant level test
6964
command: |
7065
docker run -ti --rm --read-only \
7166
-v /tmp/workspace/data/ds114_test<< parameters.dataset >>:/bids_dataset \
7267
-v ${HOME}/outputs<< parameters.dataset >>:/outputs \
73-
bids/${CIRCLE_PROJECT_REPONAME,,} /bids_dataset /outputs participant --participant_label 02
74-
no_output_timeout: 6h
68+
bids/${CIRCLE_PROJECT_REPONAME,,} /bids_dataset /outputs participant
69+
tree ${HOME}/outputs<< parameters.dataset >>
7570
7671
- run:
72+
name: group level test
7773
command: |
7874
docker run -ti --rm --read-only \
7975
-v /tmp/workspace/data/ds114_test<< parameters.dataset >>:/bids_dataset \
80-
-v ${HOME}/outputs1:/outputs \
76+
-v ${HOME}/outputs<< parameters.dataset >>:/outputs \
8177
bids/${CIRCLE_PROJECT_REPONAME,,} /bids_dataset /outputs group
82-
no_output_timeout: 6h
83-
84-
- store_artifacts:
85-
path: ~/output<< parameters.dataset >>
78+
tree ${HOME}/outputs<< parameters.dataset >>
8679
8780
deploy:
88-
8981
machine:
9082
image: ubuntu-2204:2022.10.2
9183

.github/workflows/validate.yml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
name: validate boutiques descriptor
3+
4+
concurrency:
5+
group: ${{ github.workflow }}-${{ github.ref }}
6+
cancel-in-progress: true
7+
8+
on:
9+
push:
10+
branches: [master]
11+
pull_request:
12+
branches: ['*']
13+
14+
jobs:
15+
validate:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
- name: Set up Python
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: 3.12
25+
- name: Install
26+
run: pip install boutiques
27+
- name: Validate
28+
run: bosh validate boutiques/descriptor.json

.pre-commit-config.yaml

+21-2
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,12 @@ repos:
1414
- id: check-case-conflict
1515
- id: check-merge-conflict
1616

17-
1817
- repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt
1918
rev: 0.2.3
2019
hooks:
2120
- id: yamlfmt
2221
args: [--mapping, '2', --sequence, '2', --offset, '0']
2322

24-
2523
- repo: https://github.com/hadolint/hadolint
2624
rev: v2.13.0-beta
2725
hooks:
@@ -32,5 +30,26 @@ repos:
3230
types: [dockerfile]
3331
entry: ghcr.io/hadolint/hadolint hadolint
3432

33+
- repo: https://github.com/pycqa/isort
34+
rev: 5.13.2
35+
hooks:
36+
- id: isort
37+
38+
# Aplly black formatting to python code
39+
# https://github.com/psf/black
40+
- repo: https://github.com/psf/black-pre-commit-mirror
41+
rev: 24.4.2
42+
hooks:
43+
- id: black
44+
args: [--config, pyproject.toml]
45+
46+
# Checks for spelling errors
47+
- repo: https://github.com/codespell-project/codespell
48+
rev: v2.2.6
49+
hooks:
50+
- id: codespell
51+
args: [--toml, pyproject.toml]
52+
additional_dependencies: [tomli]
53+
3554
ci:
3655
skip: [hadolint-docker]

Dockerfile

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
FROM bids/base_fsl:6.0.1
1+
FROM bids/base_fsl:6.0.1@sha256:b92b9b4a0642dfbe011c3827384f781ba7d377686e82edaf14f406d3eb906783
22

33
ARG DEBIAN_FRONTEND="noninteractive"
44

5+
COPY requirements.txt /requirements.txt
56

67
RUN apt-get update -qq && \
78
apt-get install -q -y --no-install-recommends \
89
python3 \
910
python3-pip && \
10-
pip3 install nibabel==5.1.0 && \
11+
pip3 install -r /requirements.txt && \
1112
apt-get remove -y python3-pip && \
1213
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
1314

Singularity

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ Bootstrap: docker
22
From: bids/example
33

44
%help
5-
You are in the BIDS-example container. To see help run
6-
singularity run BIDS-example.simg -h
5+
You are in the BIDS-example container.
6+
To see help run singularity run: BIDS-example.simg -h
77

88
%runscript
99
exec /run.py "$@"

boutiques/bids-app-example.json renamed to boutiques/descriptor.json

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
{
22
"author": "chrisfilo and others",
3+
"custom": {
4+
"BIDSApplicationVersion": "2.0"
5+
},
36
"command-line": "mkdir -p OUTPUT_DIR; /run.py BIDS_DIR OUTPUT_DIR ANALYSIS_LEVEL PARTICIPANT_LABEL SESSION_LABEL",
47
"container-image": {
58
"image": "bids/example",
69
"type": "docker"
710
},
811
"description": "See https://github.com/BIDS-Apps/example",
9-
"descriptor-url": "https://github.com/BIDS-Apps/example/blob/master/boutiques/bids-app-example.json",
12+
"descriptor-url": "https://github.com/BIDS-Apps/example/blob/master/boutiques/descriptor.json",
1013
"groups": [
1114
{
12-
"description": "For a participants analysis, an output directory name must be specified. For a group analysis, a directory containing the output of participant-level analyses must be selected. ",
15+
"description": "For a participants analysis, an output directory name must be specified. For a group analysis, a directory containing the output of participant-level analyses must be selected.",
1316
"id": "output_directory",
1417
"members": [
1518
"output_dir_name",
@@ -54,7 +57,8 @@
5457
"participant",
5558
"group"
5659
],
57-
"value-key": "ANALYSIS_LEVEL"
60+
"value-key": "ANALYSIS_LEVEL",
61+
"optional": false
5862
},
5963
{
6064
"command-line-flag": "--participant_label",

pyproject.toml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[tool.black]
2+
line-length = 79
3+
4+
[tool.codespell]
5+
6+
[tool.isort]
7+
combine_as_imports = true
8+
line_length = 79
9+
profile = "black"
10+
skip_gitignore = true

requirements.in

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nibabel

requirements.txt

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#
2+
# This file is autogenerated by pip-compile with Python 3.11
3+
# by the following command:
4+
#
5+
# pip-compile --strip-extras requirements.in
6+
#
7+
nibabel==5.2.1
8+
# via -r requirements.in
9+
numpy==1.26.4
10+
# via nibabel
11+
packaging==24.0
12+
# via nibabel

0 commit comments

Comments
 (0)