Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into enh/fs_long
Browse files Browse the repository at this point in the history
  • Loading branch information
bpinsard committed Mar 14, 2024
2 parents c5a853d + 45c2e2f commit e56f260
Show file tree
Hide file tree
Showing 25 changed files with 372 additions and 162 deletions.
32 changes: 15 additions & 17 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ _machine_defaults: &machine_defaults
TZ: "/usr/share/zoneinfo/America/Los_Angeles"
SCRATCH: "/scratch"
machine:
image: ubuntu-2204:2023.04.2
image: default
docker_layer_caching: true
working_directory: /tmp/src/smriprep
resource_class: large

_python_defaults: &python_defaults
docker:
- image: cimg/python:3.10.9
- image: cimg/python:3.12.2
auth:
username: $DOCKER_USER
password: $DOCKER_PAT
Expand Down Expand Up @@ -115,8 +115,7 @@ jobs:
name: Build Docker image
no_output_timeout: 60m
command: |
export PY3=$( pyenv versions | awk '/^\* 3/ { print $2 }' )
pyenv local $PY3
pyenv local 3
pip install hatch
# Get version, update files.
THISVERSION=$( hatch version )
Expand All @@ -139,8 +138,7 @@ jobs:
- run:
name: Check Docker image
command: |
export PY3=$( pyenv versions | awk '/^\* 3/ { print $2 }' )
pyenv local $PY3
pyenv local 3
# Get version, update files.
THISVERSION=$( hatch version )
BUILT_VERSION=$( docker run --rm nipreps/smriprep:latest --version )
Expand Down Expand Up @@ -309,8 +307,7 @@ jobs:
- run:
name: Test smriprep-wrapper (Python 2)
command: |
export PY2=$( pyenv versions | awk '/^\* 2/ { print $2 }' )
pyenv local $PY2
pyenv local 2.7
echo -n "Python version: "
python --version
pip install --upgrade "pip<21"
Expand All @@ -322,8 +319,7 @@ jobs:
- run:
name: Test smriprep-wrapper (Python 3)
command: |
export PY3=$( pyenv versions | awk '/^\* 3/ { print $2 }' )
pyenv local $PY3
pyenv local 3
echo -n "Python version: "
python --version
pip install --upgrade pip setuptools
Expand Down Expand Up @@ -440,10 +436,10 @@ jobs:
- run: *pull_from_registry
- restore_cache:
keys:
- ds005-anat-v0-{{ .Branch }}-{{ epoch }}
- ds005-anat-v0-{{ .Branch }}
- ds005-anat-v0-master
- ds005-anat-v0-next
- ds005-anat-v1-{{ .Branch }}-{{ epoch }}
- ds005-anat-v1-{{ .Branch }}
- ds005-anat-v1-master
- ds005-anat-v1-next
- restore_cache:
keys:
- testdata-v2-{{ .Branch }}-{{ epoch }}
Expand Down Expand Up @@ -500,7 +496,7 @@ jobs:
rm -rf /tmp/ds005/work/reportlets
rm -rf /tmp/ds005/work/smriprep_wf/fsdir_run_*/
- save_cache:
key: ds005-anat-v0-{{ .Branch }}-{{ epoch }}
key: ds005-anat-v1-{{ .Branch }}-{{ epoch }}
paths:
- /tmp/ds005/work

Expand All @@ -509,7 +505,8 @@ jobs:
command: |
mkdir -p /tmp/ds005/test
find /tmp/ds005/derivatives -name "*" ! -path "*/figures*" -print | sed s+/tmp/ds005/derivatives/++ | sort > /tmp/ds005/test/outputs.out
diff /tmp/src/smriprep/.circleci/ds005_outputs.txt /tmp/ds005/test/outputs.out
sort /tmp/src/smriprep/.circleci/ds005_outputs.txt > /tmp/ds005/test/expected.out
diff /tmp/ds005/test/{expected,outputs}.out
exit $?
- store_artifacts:
path: /tmp/ds005/derivatives
Expand Down Expand Up @@ -658,7 +655,8 @@ jobs:
command: |
mkdir -p /tmp/ds054/test
find /tmp/ds054/derivatives -path */figures -prune -o -name "*" -print | sed s+/tmp/ds054/derivatives/++ | sort > /tmp/ds054/test/outputs.out
diff /tmp/src/smriprep/.circleci/ds054_outputs.txt /tmp/ds054/test/outputs.out
sort /tmp/src/smriprep/.circleci/ds054_outputs.txt > /tmp/ds054/test/expected.out
diff /tmp/ds054/test/{expected,outputs}.out
exit $?
- run:
name: Clean working directory
Expand Down
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# 2024-03-07 - mathiasg@stanford.edu - STY: ruff format smriprep [git-blame-ignore-rev]
83a50d465145c6e8176c3f13d4673ed4e0bdb26f
# 2023-11-21 - effigies@gmail.com - STY: ruff --fix smriprep [git-blame-ignore-rev]
3a586cf46cb1bb963b93d9546f20273194d15de5
# 2023-11-20 - effigies@gmail.com - STY: ruff --fix smriprep [git-blame-ignore-rev]
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,15 @@ jobs:
run: python -m pip install "smriprep[tests]"
- name: Run tests
run: pytest -sv --doctest-modules --cov smriprep --pyargs smriprep
- uses: codecov/codecov-action@v3
- uses: codecov/codecov-action@v4
name: Submit to CodeCov
with:
token: ${{ secrets.CODECOV_TOKEN }}

style:
if: "!contains(github.event.head_commit.message, '[skip ci]')"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: pipx run ruff smriprep
- run: pipx run ruff check smriprep
- run: pipx run ruff format --diff smriprep
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ repos:
- id: check-toml
- id: check-json
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.6
rev: v0.3.1
hooks:
- id: ruff
- id: ruff-format
15 changes: 15 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
0.14.0 (March 11, 2024)
=======================
New feature release in the 0.14.x series.

This release restores correct handling of cohort identifiers in templates.
A feature release is warranted due to changes in the workflow structure.

* FIX: Fetch templates during workflow construction (#418)
* FIX: Re-add cohort identifier to template name (#416)
* FIX: Repair FreeSurfer Dependency in Dockerfile (tcsh) (#404)
* FIX: Invert result of skull-strip check in auto mode (#402)
* STY: Adopt ruff for linting and formatting (#397)
* CHORE: Update ruff, ignore certain rules (#419)


0.13.2 (December 08, 2023)
==========================
Bug fix release in the 0.13.x series.
Expand Down
31 changes: 22 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# MIT License
#
# Copyright (c) 2023 The NiPreps Developers
# Copyright (c) The NiPreps Developers
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand All @@ -23,24 +23,26 @@
# SOFTWARE.

# Ubuntu 22.04 LTS - Jammy
ARG BASE_IMAGE=ubuntu:jammy-20230308
ARG BASE_IMAGE=ubuntu:jammy-20240125

#
# sMRIPrep wheel
# Build wheel
#
FROM python:slim AS src
RUN pip install build
RUN apt-get update && \
apt-get install -y --no-install-recommends git
COPY . /src/smriprep
RUN python -m build /src/smriprep
COPY . /src
RUN python -m build /src

#
# Download stages
#

# Utilities for downloading packages
FROM ${BASE_IMAGE} as downloader
# Bump the date to current to refresh curl/certificates/etc
RUN echo "2023.07.20"
RUN apt-get update && \
apt-get install -y --no-install-recommends \
binutils \
Expand All @@ -67,19 +69,30 @@ RUN mkdir /opt/workbench && \

# Micromamba
FROM downloader as micromamba

# Install a C compiler to build extensions when needed.
# traits<6.4 wheels are not available for Python 3.11+, but build easily.
RUN apt-get update && \
apt-get install -y --no-install-recommends build-essential && \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

WORKDIR /
# Bump the date to current to force update micromamba
RUN echo "2023.04.05"
RUN echo "2024.03.08"
RUN curl -Ls https://micro.mamba.pm/api/micromamba/linux-64/latest | tar -xvj bin/micromamba

ENV MAMBA_ROOT_PREFIX="/opt/conda"
COPY env.yml /tmp/env.yml
COPY requirements.txt /tmp/requirements.txt
WORKDIR /tmp
RUN micromamba create -y -f /tmp/env.yml && \
micromamba clean -y -a

ENV PATH="/opt/conda/envs/smriprep/bin:$PATH"
RUN /opt/conda/envs/smriprep/bin/npm install -g svgo@^3.0 bids-validator@^1.13 && \
# UV_USE_IO_URING for apparent race-condition (https://github.com/nodejs/node/issues/48444)
# Check if this is still necessary when updating the base image.
ENV PATH="/opt/conda/envs/smriprep/bin:$PATH" \
UV_USE_IO_URING=0
RUN npm install -g svgo@^3.2.0 bids-validator@^1.14.0 && \
rm -r ~/.npm

#
Expand Down Expand Up @@ -179,7 +192,7 @@ ENV MKL_NUM_THREADS=1 \
OMP_NUM_THREADS=1

# Installing SMRIPREP
COPY --from=src /src/smriprep/dist/*.whl .
COPY --from=src /src/dist/*.whl .
RUN pip install --no-cache-dir $( ls *.whl )[telemetry,test]

RUN find $HOME -type d -exec chmod go=u {} + && \
Expand Down
18 changes: 9 additions & 9 deletions env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,29 @@ name: smriprep
channels:
- https://fsl.fmrib.ox.ac.uk/fsldownloads/fslconda/public/
- conda-forge
# Update this ~yearly; last updated April 2023
# Update this ~yearly; last updated March 2024
dependencies:
- python=3.10
- python=3.11
# Needed for svgo and bids-validator; consider moving to deno
- nodejs=18
- nodejs=20
# Intel Math Kernel Library for numpy
- mkl=2022.1
- mkl=2023.2
- mkl-service=2.4
# Base scientific python stack; required by FSL, so pinned here
- numpy=1.26
- scipy=1.11
- matplotlib=3.8
- pandas=2.1
- pandas=2.2
- h5py=3.10
# Dependencies compiled against numpy, best to stick with conda
- scikit-image=0.22
- scikit-learn=1.3
- scikit-learn=1.4
# Utilities
- graphviz=6.0
- graphviz=9.0
- pandoc=3.1
# Workflow dependencies: ANTs
- ants=2.5.0
# Workflow dependencies: FSL (versions pinned in 6.0.6.2)
- ants=2.5
# Workflow dependencies: FSL (versions pinned in 6.0.7.7)
- fsl-bet2=2111.4
- fsl-flirt=2111.2
- fsl-fast4=2111.3
Expand Down
13 changes: 10 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ dependencies = [
"matplotlib >= 2.2.0",
"nibabel >= 4.0.1",
"nipype >= 1.7.0",
"niworkflows >= 1.8.0",
"niworkflows >= 1.10.1",
"numpy",
"packaging",
"pybids >= 0.11.1",
Expand Down Expand Up @@ -138,6 +138,8 @@ source = [

[tool.ruff]
line-length = 99

[tool.ruff.lint]
extend-select = [
"F",
"E",
Expand All @@ -161,11 +163,16 @@ extend-select = [
"PT",
"Q",
]
extend-ignore = [
"S311", # We are not using random for cryptographic purposes
"ISC001",
"S603",
]

[tool.ruff.flake8-quotes]
[tool.ruff.lint.flake8-quotes]
inline-quotes = "single"

[tool.ruff.extend-per-file-ignores]
[tool.ruff.lint.extend-per-file-ignores]
"*/test_*.py" = ["S101"]

[tool.ruff.format]
Expand Down
Loading

0 comments on commit e56f260

Please sign in to comment.