Skip to content

Commit e15bf73

Browse files
authored
Merge branch 'master' into ruff
2 parents 8a10343 + 2e22bdc commit e15bf73

File tree

8 files changed

+49
-24
lines changed

8 files changed

+49
-24
lines changed

.maint/CONTRIBUTORS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Before every release, unlisted contributors will be invited again to add their n
1313
| Bellec | Pierre | | 0000-0002-9111-0699 | SIMEXP Lab, CRIUGM, University of Montréal, Montréal, Canada |
1414
| Benson | Noah C. | | 0000-0002-2365-8265 | Department of Psychology, New York University |
1515
| Bhagwat | Nikhil | | 0000-0001-6073-7141 | Montreal Neurological Institute, McGill University |
16+
| Camacho | Milton | | 0000-0002-5379-5076 | Department of Pediadrics, University of Calgary |
1617
| Callenberg | Keith | | 0000-0001-7786-9300 | Department of Psychiatry, University of Pittsburgh |
1718
| Cieslak | Matthew | | 0000-0002-1931-4734 | Perelman School of Medicine, University of Pennsylvania, PA, USA |
1819
| de la Vega | Alejandro | | 0000-0001-9062-3778 | University of Texas at Austin |

.pre-commit-config.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,8 @@ repos:
1212
- id: check-toml
1313
- id: check-added-large-files
1414
- repo: https://github.com/astral-sh/ruff-pre-commit
15-
rev: v0.9.1
15+
rev: v0.12.2
1616
hooks:
17-
- id: ruff
17+
- id: ruff-check
1818
args: [ --fix ]
1919
- id: ruff-format
20-
- id: ruff
21-
args: [ --select, ISC001, --fix ]

docs/usage.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ Command-Line Arguments
3535
.. argparse::
3636
:ref: fmriprep.cli.parser._build_parser
3737
:prog: fmriprep
38-
:nodefault:
39-
:nodefaultconst:
4038

4139

4240
The command-line interface of the docker wrapper

fmriprep/_warnings.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,20 @@
2929
_wlog.addHandler(logging.NullHandler())
3030

3131

32-
def _warn(message, category=None, stacklevel=1, source=None):
32+
def _warn(message, category=None, stacklevel=1, source=None, **kwargs):
3333
"""Redefine the warning function."""
3434
if category is not None:
3535
category = type(category).__name__
3636
category = category.replace('type', 'WARNING')
3737

38+
if kwargs:
39+
logging.getLogger('py.warnings').warning('Extra warning kwargs: %s', kwargs)
40+
3841
logging.getLogger('py.warnings').warning('%s: %s', category or 'WARNING', message)
3942

4043

41-
def _showwarning(message, category, filename, lineno, file=None, line=None):
42-
_warn(message, category=category)
44+
def _showwarning(message, category, filename, lineno, file=None, line=None, **kwargs):
45+
_warn(message, category=category, **kwargs)
4346

4447

4548
warnings.warn = _warn

fmriprep/cli/parser.py

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"""Parser."""
2424

2525
import sys
26+
from pathlib import Path
2627

2728
from .. import config
2829

@@ -32,9 +33,13 @@ def _build_parser(**kwargs):
3233
3334
``kwargs`` are passed to ``argparse.ArgumentParser`` (mainly useful for debugging).
3435
"""
35-
from argparse import Action, ArgumentDefaultsHelpFormatter, ArgumentParser
36+
from argparse import (
37+
Action,
38+
ArgumentDefaultsHelpFormatter,
39+
ArgumentParser,
40+
BooleanOptionalAction,
41+
)
3642
from functools import partial
37-
from pathlib import Path
3843

3944
from niworkflows.utils.spaces import OutputReferencesAction, Reference
4045
from packaging.version import Version
@@ -413,7 +418,7 @@ def _fallback_trt(value, parser):
413418
'--slice-time-ref',
414419
required=False,
415420
action='store',
416-
default=None,
421+
default=0.5,
417422
type=SliceTimeRef,
418423
help='The time of the reference slice to correct BOLD values to, as a fraction '
419424
'acquisition time. 0 indicates the start, 0.5 the midpoint, and 1 the end '
@@ -496,7 +501,6 @@ def _fallback_trt(value, parser):
496501
)
497502
g_conf.add_argument(
498503
'--project-goodvoxels',
499-
required=False,
500504
action='store_true',
501505
default=False,
502506
help='Exclude voxels whose timeseries have locally high coefficient of variation '
@@ -521,10 +525,11 @@ def _fallback_trt(value, parser):
521525
'(default is 91k, which equates to 2mm resolution)',
522526
)
523527
g_outputs.add_argument(
524-
'--no-msm',
525-
action='store_false',
528+
'--msm',
529+
action=BooleanOptionalAction,
530+
default=True,
526531
dest='run_msmsulc',
527-
help='Disable Multimodal Surface Matching surface registration.',
532+
help='Enable or disable Multimodal Surface Matching surface registration.',
528533
)
529534

530535
g_confounds = parser.add_argument_group('Options relating to confounds')
@@ -634,10 +639,11 @@ def _fallback_trt(value, parser):
634639
'(default: OUTPUT_DIR/freesurfer)',
635640
)
636641
g_fs.add_argument(
637-
'--no-submm-recon',
638-
action='store_false',
642+
'--submm-recon',
643+
action=BooleanOptionalAction,
644+
default=True,
639645
dest='hires',
640-
help='Disable sub-millimeter (hires) reconstruction',
646+
help='Enable or disable sub-millimeter (hi-res) reconstruction.',
641647
)
642648
g_fs.add_argument(
643649
'--fs-no-reconall',
@@ -656,6 +662,7 @@ def _fallback_trt(value, parser):
656662
g_carbon = parser.add_argument_group('Options for carbon usage tracking')
657663
g_carbon.add_argument(
658664
'--track-carbon',
665+
default=False,
659666
action='store_true',
660667
help='Tracks power draws using CodeCarbon package',
661668
)
@@ -682,7 +689,6 @@ def _fallback_trt(value, parser):
682689
'--work-dir',
683690
action='store',
684691
type=Path,
685-
default=Path('work').absolute(),
686692
help='Path where intermediate results should be stored',
687693
)
688694
g_other.add_argument(
@@ -776,6 +782,9 @@ def parse_args(args=None, namespace=None):
776782
config.execution.log_level = int(max(25 - 5 * opts.verbose_count, logging.DEBUG))
777783
config.from_dict(vars(opts), init=['nipype'])
778784

785+
if config.execution.work_dir is None:
786+
config.execution.work_dir = Path('work').absolute()
787+
779788
# Consistency checks
780789
force_set = set(config.workflow.force)
781790
ignore_set = set(config.workflow.ignore)

fmriprep/cli/tests/test_parser.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,3 +270,19 @@ def test_derivatives(tmp_path):
270270
parser.parse_args(temp_args)
271271

272272
_reset_config()
273+
274+
275+
@pytest.mark.parametrize(
276+
('supp_args', 'opt', 'expected'),
277+
[
278+
(['--no-submm-recon'], 'hires', False),
279+
(['--submm-recon'], 'hires', True),
280+
([], 'hires', True),
281+
(['--no-msm'], 'run_msmsulc', False),
282+
],
283+
)
284+
def test_optional_booleans(tmp_path, supp_args, opt, expected):
285+
out_path = str(tmp_path / 'out')
286+
args = [str(tmp_path), out_path, 'participant'] + supp_args
287+
pargs = _build_parser().parse_args(args)
288+
assert getattr(pargs, opt) == expected

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[build-system]
2-
requires = ["hatchling", "hatch-vcs", "nipreps-versions"]
2+
requires = ["hatchling>=1.27", "hatch-vcs", "nipreps-versions"]
33
build-backend = "hatchling.build"
44

55
[project]
@@ -11,13 +11,13 @@ classifiers = [
1111
"Development Status :: 5 - Production/Stable",
1212
"Intended Audience :: Science/Research",
1313
"Topic :: Scientific/Engineering :: Image Recognition",
14-
"License :: OSI Approved :: Apache Software License",
1514
"Programming Language :: Python :: 3.10",
1615
"Programming Language :: Python :: 3.11",
1716
"Programming Language :: Python :: 3.12",
1817
"Programming Language :: Python :: 3.13",
1918
]
20-
license = {file = "LICENSE"}
19+
license = "Apache-2.0"
20+
license-files = ["LICENSE"]
2121
requires-python = ">=3.10"
2222
dependencies = [
2323
"acres >= 0.2.0",

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ pandas==2.2.3
312312
# tedana
313313
patool==4.0.1
314314
# via datalad
315-
pillow==11.2.1
315+
pillow==11.3.0
316316
# via
317317
# bokeh
318318
# imageio

0 commit comments

Comments
 (0)