Skip to content

Commit

Permalink
pin dependencies and check output
Browse files Browse the repository at this point in the history
  • Loading branch information
Remi-Gau committed May 9, 2024
1 parent 00e339d commit f9cb1d5
Show file tree
Hide file tree
Showing 8 changed files with 68 additions and 23 deletions.
17 changes: 6 additions & 11 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,35 +57,30 @@ jobs:
-v /tmp/workspace/data/ds114_test1:/bids_dataset \
bids/${CIRCLE_PROJECT_REPONAME,,} --version
# participant level tests for single session dataset
- run:
name: participant level test
command: |
docker run -ti --rm --read-only \
-v /tmp/workspace/data/ds114_test<< parameters.dataset >>:/bids_dataset \
-v ${HOME}/outputs<< parameters.dataset >>:/outputs \
bids/${CIRCLE_PROJECT_REPONAME,,} /bids_dataset /outputs participant --participant_label 01
no_output_timeout: 6h
- run:
command: |
docker run -ti --rm --read-only \
-v /tmp/workspace/data/ds114_test<< parameters.dataset >>:/bids_dataset \
-v ${HOME}/outputs<< parameters.dataset >>:/outputs \
bids/${CIRCLE_PROJECT_REPONAME,,} /bids_dataset /outputs participant --participant_label 02
bids/${CIRCLE_PROJECT_REPONAME,,} /bids_dataset /outputs participant
tree ${HOME}/outputs<< parameters.dataset >>
no_output_timeout: 6h

- run:
name: group level test
command: |
docker run -ti --rm --read-only \
-v /tmp/workspace/data/ds114_test<< parameters.dataset >>:/bids_dataset \
-v ${HOME}/outputs1:/outputs \
-v ${HOME}/outputs<< parameters.dataset >>:/outputs \
bids/${CIRCLE_PROJECT_REPONAME,,} /bids_dataset /outputs group
tree ${HOME}/outputs<< parameters.dataset >>
no_output_timeout: 6h

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

deploy:

machine:
image: ubuntu-2204:2022.10.2

Expand Down
7 changes: 5 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,12 @@ repos:
- id: check-case-conflict
- id: check-merge-conflict


- repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt
rev: 0.2.3
hooks:
- id: yamlfmt
args: [--mapping, '2', --sequence, '2', --offset, '0']


- repo: https://github.com/hadolint/hadolint
rev: v2.13.0-beta
hooks:
Expand All @@ -32,6 +30,11 @@ repos:
types: [dockerfile]
entry: ghcr.io/hadolint/hadolint hadolint

- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort

# Aplly black formatting to python code
# https://github.com/psf/black
- repo: https://github.com/psf/black-pre-commit-mirror
Expand Down
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
FROM bids/base_fsl:6.0.1
FROM bids/base_fsl:6.0.1@sha256:b92b9b4a0642dfbe011c3827384f781ba7d377686e82edaf14f406d3eb906783

ARG DEBIAN_FRONTEND="noninteractive"

COPY requirements.txt /requirements.txt

RUN apt-get update -qq && \
apt-get install -q -y --no-install-recommends \
python3 \
python3-pip && \
pip3 install nibabel==5.1.0 && \
pip3 install -r /requirements.txt && \
apt-get remove -y python3-pip && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

Expand Down
5 changes: 1 addition & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
[tool.black]
# 'extend-exclude' excludes files or directories in addition to the defaults
line-length = 79

# [tool.codespell]
# ignore-words = ".github/codespell_ignore_words.txt"
# skip = ""
[tool.codespell]

[tool.isort]
combine_as_imports = true
Expand Down
1 change: 1 addition & 0 deletions requirements.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nibabel
12 changes: 12 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# pip-compile --strip-extras requirements.in
#
nibabel==5.2.1
# via -r requirements.in
numpy==1.26.4
# via nibabel
packaging==24.0
# via nibabel
11 changes: 7 additions & 4 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
import argparse
import os
import subprocess
import nibabel
import numpy
import sys
from glob import glob
from pathlib import Path

import nibabel
import numpy

__version__ = open(Path(__file__).parent / "version").read()


Expand Down Expand Up @@ -145,8 +146,10 @@ def main(argv=sys.argv):
os.path.join(args.output_dir, "avg_brain_size.txt"), "w"
) as fp:
fp.write(
"Average brain size is %g voxels"
% numpy.array(brain_sizes).mean()
f"Average brain size is {numpy.array(brain_sizes).mean()} voxels"
)
print(
f"Results were saved in {Path(args.output_dir) / 'avg_brain_size.txt'}"
)

exit(0)
Expand Down
33 changes: 33 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
; See https://tox.wiki/en
[tox]
requires =
tox>=4
; run lint by default when just calling "tox"
env_list = lint

; ENVIRONMENTS
; ------------
[style]
description = common environment for style checkers (rely on pre-commit hooks)
skip_install = true
deps =
pre-commit

; COMMANDS
; --------
[testenv:lint]
description = install pre-commit hooks and run all linters and formatters
skip_install = true
deps =
{[style]deps}
commands =
pre-commit install
pre-commit run --all-files --show-diff-on-failure {posargs:}

[testenv:update_dependencies]
description = update requirements.txt
skip_install = true
deps =
pip-tools
commands =
pip-compile --strip-extras requirements.in {posargs:}

0 comments on commit f9cb1d5

Please sign in to comment.