Skip to content

Commit

Permalink
Merge pull request #360 from mgxd/rf/fit-apply
Browse files Browse the repository at this point in the history
RF: Move to fit/apply workflow
  • Loading branch information
mgxd authored Aug 1, 2024
2 parents f93aba7 + 3881973 commit 5a138f5
Show file tree
Hide file tree
Showing 96 changed files with 13,485 additions and 9,911 deletions.
6 changes: 6 additions & 0 deletions .codespellrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[codespell]
skip = .git,*.pdf,*.svg,*.html,dataset_description.json,*.bib
# te - TE
# Weill - name
# reson - Reson. abbreviation in citation
ignore-words-list = te,weill,reson
39 changes: 18 additions & 21 deletions .github/workflows/style.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Style check
name: Style + spelling check

on:
push:
Expand All @@ -11,30 +11,27 @@ defaults:
run:
shell: bash

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
build:
if: "!contains(github.event.head_commit.message, '[skip ci]')"
style:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: pipx run ruff check .
- run: pipx run ruff format --diff .

codespell:
name: Check for spelling errors
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.11']

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1 # Only fetch the latest commit
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install black isort
- name: black code formatting check
run: |
black --check nibabies/
- name: isort formatting check
run: isort nibabies/ --check-only
- name: Checkout
uses: actions/checkout@v4
- name: Codespell
uses: codespell-project/actions-codespell@v2
5 changes: 5 additions & 0 deletions .maint/contributors.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
[
{
"affiliation": "Department of Pediatrics, University of Minnesota, MN, USA",
"name": "Madison, Thomas",
"orcid": "0000-0003-3030-6580"
},
{
"affiliation": "Montreal Neurological Institute, McGill University",
"name": "Huberty, Scott",
Expand Down
30 changes: 15 additions & 15 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
exclude: ".*/data/.*"
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.4.0
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/psf/black
rev: 22.3.0
- id: trailing-whitespace
exclude: '.*\.svg'
- id: end-of-file-fixer
exclude: '.*\.svg'
- id: check-yaml
- id: check-json
- id: check-toml
- id: check-added-large-files
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.2.0
hooks:
- id: black
files: ^nibabies/
- repo: https://github.com/pycqa/isort
rev: 5.10.1
hooks:
- id: isort
files: ^nibabies/
- id: ruff
- id: ruff-format
4 changes: 3 additions & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 2
build:
os: ubuntu-22.04
tools:
python: "3.10"
python: "3.11"
jobs:
post_checkout:
- git fetch --unshallow
Expand All @@ -15,3 +15,5 @@ python:
path: .
extra_requirements:
- doc
- method: pip
path: wrapper/
4 changes: 2 additions & 2 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ Previous, *NiBabies* expected input from the `--derivatives` flag to be in T1w s
* DKR: Add M-CRIB-S to Docker container (#283)
* DKR: Update dependencies, split into multi-stage build
* ENH: Add option to exclude projecting high variance voxels to surface (#278)
* ENH: Resample morphometrics to fsLR CIFTI-2 files when outputing CIFTIs (#279)
* ENH: Resample morphometrics to fsLR CIFTI-2 files when outputting CIFTIs (#279)
* ENH: Add MCRIBReconAll as alternative surface reconstruction method (#283)
* ENH: Reorder anatomical processsing, run ANTs DenoiseImage on anatomicals (#286)
* ENH: Reorder anatomical processing, run ANTs DenoiseImage on anatomicals (#286)
* ENH: Extract participant ages from BIDS sources, deprecate `--age-months` (#287)
* ENH: Dilate BOLD mask by 2 voxels to prevent over-aggressive masking degrading T2star map estimation (#296)
* ENH: Allow precomputed derivatives in T1w or T2w space (#305)
Expand Down
27 changes: 17 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@
# SOFTWARE.

# Ubuntu 22.04 LTS - Jammy
ARG BASE_IMAGE=ubuntu:jammy-20230605
ARG BASE_IMAGE=ubuntu:jammy-20240405

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

# Older Python to support legacy MCRIBS
FROM python:3.6.15-slim as pyenv
Expand Down Expand Up @@ -90,19 +90,26 @@ 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.06.29"
RUN curl -Ls https://micro.mamba.pm/api/micromamba/linux-64/latest | tar -xvj bin/micromamba
RUN echo "2024.04.25" && 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/nibabies/bin:$PATH"
RUN /opt/conda/envs/nibabies/bin/npm install -g svgo@^2.8 bids-validator@1.11.0 && \
RUN npm install -g svgo@^3.2.0 bids-validator@^1.14.0 && \
rm -r ~/.npm
COPY requirements.txt /tmp/requirements.txt
RUN /opt/conda/envs/nibabies/bin/pip install --no-cache-dir -r /tmp/requirements.txt

# Main container
FROM ${BASE_IMAGE} as nibabies
Expand Down Expand Up @@ -207,7 +214,7 @@ ENV PERL5LIB="$MINC_LIB_DIR/perl5/5.8.5" \
PATH="$FREESURFER_HOME/bin:$FREESURFER_HOME/tktools:$MINC_BIN_DIR:$PATH"

# MCRIBS (required legacy python)
COPY --from=nipreps/mcribs@sha256:6c7a8dedd61d0ead8c7c4a57ab158928c1c1d787d87dae33ab7ee43226fb1e0f /opt/MCRIBS/ /opt/MCRIBS
COPY --from=nipreps/mcribs@sha256:d5ea7616402cbc0b80f32634832dce540a32bb1d5e1e61dfdd2cc795dba8944a /opt/MCRIBS/ /opt/MCRIBS
COPY --from=pyenv /usr/local/lib/ /usr/local/lib/
ENV PATH="/opt/MCRIBS/bin:/opt/MCRIBS/MIRTK/MIRTK-install/bin:/opt/MCRIBS/MIRTK/MIRTK-install/lib/tools:${PATH}" \
LD_LIBRARY_PATH="/opt/MCRIBS/lib:/opt/MCRIBS/ITK/ITK-install/lib:/opt/MCRIBS/VTK/VTK-install/lib:/opt/MCRIBS/MIRTK/MIRTK-install/lib:/usr/local/lib:${LD_LIBRARY_PATH}" \
Expand Down Expand Up @@ -257,7 +264,7 @@ RUN ${CONDA_PYTHON} -m pip install --no-cache-dir --upgrade templateflow && \
find $HOME/.cache/templateflow -type f -exec chmod go=u {} +

# Install pre-built wheel
COPY --from=src /src/nibabies/dist/*.whl .
COPY --from=src /src/dist/*.whl .
RUN ${CONDA_PYTHON} -m pip install --no-cache-dir $( ls *.whl )[telemetry,test]

# Facilitate Apptainer use
Expand Down
2 changes: 1 addition & 1 deletion docs/community.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## NiPreps Community

Check out the [official NiPreps community page](https://www.nipreps.org/community/), where topics such as contributing, code of coduct, and licensing are outlined.
Check out the [official NiPreps community page](https://www.nipreps.org/community/), where topics such as contributing, code of conduct, and licensing are outlined.


## NiBabies Coding Style
Expand Down
Loading

0 comments on commit 5a138f5

Please sign in to comment.