Skip to content

Commit f9cb1d5

Browse files
committed
pin dependencies and check output
1 parent 00e339d commit f9cb1d5

8 files changed

Lines changed: 68 additions & 23 deletions

File tree

.circleci/config.yml

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,35 +57,30 @@ jobs:
5757
-v /tmp/workspace/data/ds114_test1:/bids_dataset \
5858
bids/${CIRCLE_PROJECT_REPONAME,,} --version
5959
60-
# participant level tests for single session dataset
6160
- run:
61+
name: participant level test
6262
command: |
6363
docker run -ti --rm --read-only \
6464
-v /tmp/workspace/data/ds114_test<< parameters.dataset >>:/bids_dataset \
6565
-v ${HOME}/outputs<< parameters.dataset >>:/outputs \
66-
bids/${CIRCLE_PROJECT_REPONAME,,} /bids_dataset /outputs participant --participant_label 01
67-
no_output_timeout: 6h
68-
- run:
69-
command: |
70-
docker run -ti --rm --read-only \
71-
-v /tmp/workspace/data/ds114_test<< parameters.dataset >>:/bids_dataset \
72-
-v ${HOME}/outputs<< parameters.dataset >>:/outputs \
73-
bids/${CIRCLE_PROJECT_REPONAME,,} /bids_dataset /outputs participant --participant_label 02
66+
bids/${CIRCLE_PROJECT_REPONAME,,} /bids_dataset /outputs participant
67+
tree ${HOME}/outputs<< parameters.dataset >>
7468
no_output_timeout: 6h
7569

7670
- run:
71+
name: group level test
7772
command: |
7873
docker run -ti --rm --read-only \
7974
-v /tmp/workspace/data/ds114_test<< parameters.dataset >>:/bids_dataset \
80-
-v ${HOME}/outputs1:/outputs \
75+
-v ${HOME}/outputs<< parameters.dataset >>:/outputs \
8176
bids/${CIRCLE_PROJECT_REPONAME,,} /bids_dataset /outputs group
77+
tree ${HOME}/outputs<< parameters.dataset >>
8278
no_output_timeout: 6h
8379

8480
- store_artifacts:
8581
path: ~/output<< parameters.dataset >>
8682

8783
deploy:
88-
8984
machine:
9085
image: ubuntu-2204:2022.10.2
9186

.pre-commit-config.yaml

Lines changed: 5 additions & 2 deletions
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,6 +30,11 @@ 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+
3538
# Aplly black formatting to python code
3639
# https://github.com/psf/black
3740
- repo: https://github.com/psf/black-pre-commit-mirror

Dockerfile

Lines changed: 3 additions & 2 deletions
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

pyproject.toml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
[tool.black]
2-
# 'extend-exclude' excludes files or directories in addition to the defaults
32
line-length = 79
43

5-
# [tool.codespell]
6-
# ignore-words = ".github/codespell_ignore_words.txt"
7-
# skip = ""
4+
[tool.codespell]
85

96
[tool.isort]
107
combine_as_imports = true

requirements.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nibabel

requirements.txt

Lines changed: 12 additions & 0 deletions
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

run.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
import argparse
33
import os
44
import subprocess
5-
import nibabel
6-
import numpy
75
import sys
86
from glob import glob
97
from pathlib import Path
108

9+
import nibabel
10+
import numpy
11+
1112
__version__ = open(Path(__file__).parent / "version").read()
1213

1314

@@ -145,8 +146,10 @@ def main(argv=sys.argv):
145146
os.path.join(args.output_dir, "avg_brain_size.txt"), "w"
146147
) as fp:
147148
fp.write(
148-
"Average brain size is %g voxels"
149-
% numpy.array(brain_sizes).mean()
149+
f"Average brain size is {numpy.array(brain_sizes).mean()} voxels"
150+
)
151+
print(
152+
f"Results were saved in {Path(args.output_dir) / 'avg_brain_size.txt'}"
150153
)
151154

152155
exit(0)

tox.ini

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
; See https://tox.wiki/en
2+
[tox]
3+
requires =
4+
tox>=4
5+
; run lint by default when just calling "tox"
6+
env_list = lint
7+
8+
; ENVIRONMENTS
9+
; ------------
10+
[style]
11+
description = common environment for style checkers (rely on pre-commit hooks)
12+
skip_install = true
13+
deps =
14+
pre-commit
15+
16+
; COMMANDS
17+
; --------
18+
[testenv:lint]
19+
description = install pre-commit hooks and run all linters and formatters
20+
skip_install = true
21+
deps =
22+
{[style]deps}
23+
commands =
24+
pre-commit install
25+
pre-commit run --all-files --show-diff-on-failure {posargs:}
26+
27+
[testenv:update_dependencies]
28+
description = update requirements.txt
29+
skip_install = true
30+
deps =
31+
pip-tools
32+
commands =
33+
pip-compile --strip-extras requirements.in {posargs:}

0 commit comments

Comments
 (0)