Skip to content

Commit 152a80d

Browse files
authored
chore: Update minimum dependencies, test with tox-uv (#3412)
This is narrowly targeted to get tests passing. Python 3.13 support depends on a new release of sdcflows. Will work on that today.
2 parents 3e77638 + e6b5fcb commit 152a80d

File tree

12 files changed

+71
-88
lines changed

12 files changed

+71
-88
lines changed

.github/workflows/contrib.yml

-38
This file was deleted.

.github/workflows/test.yml

+23-3
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ jobs:
5757
run: |
5858
sudo apt update
5959
sudo apt install -y --no-install-recommends graphviz
60+
- name: Install the latest version of uv
61+
uses: astral-sh/setup-uv@v4
6062
- name: Set up Python ${{ matrix.python-version }}
6163
uses: actions/setup-python@v5
6264
with:
@@ -65,14 +67,32 @@ jobs:
6567
run: python -c "import sys; print(sys.version)"
6668
- name: Install tox
6769
run: |
68-
python -m pip install --upgrade pip
69-
python -m pip install tox tox-gh-actions
70+
uv tool install --with=tox-uv --with=tox-gh-actions tox
7071
- name: Show tox config
7172
run: tox c
7273
- name: Run tox
7374
run: tox -v --exit-and-dump-after 1200
7475
- uses: codecov/codecov-action@v5
7576
with:
76-
file: coverage.xml
7777
token: ${{ secrets.CODECOV_TOKEN }}
7878
if: ${{ always() }}
79+
80+
checks:
81+
runs-on: "ubuntu-latest"
82+
continue-on-error: true
83+
strategy:
84+
matrix:
85+
check: ["style", "spellcheck"]
86+
87+
steps:
88+
- uses: actions/checkout@v4
89+
with:
90+
persist-credentials: false
91+
- name: Install the latest version of uv
92+
uses: astral-sh/setup-uv@v4
93+
- name: Install tox
94+
run: uv tool install tox --with=tox-uv
95+
- name: Show tox config
96+
run: tox c -e ${{ matrix.check }}
97+
- name: Run check
98+
run: tox -e ${{ matrix.check }}

.maint/paper_author_list.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def _aslist(inlist):
3838
aff_indexes = [
3939
', '.join(
4040
[
41-
'%d' % (affiliations.index(a) + 1)
41+
str(affiliations.index(a) + 1)
4242
for a in _aslist(author.get('affiliation', 'Unaffiliated'))
4343
]
4444
)
@@ -52,7 +52,7 @@ def _aslist(inlist):
5252
file=sys.stderr,
5353
)
5454

55-
print('Authors (%d):' % len(author_matches))
55+
print(f'Authors ({len(author_matches)}):')
5656
print(
5757
'{}.'.format(
5858
'; '.join(

.maint/update_authors.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ def _aslist(value):
259259
aff_indexes = [
260260
', '.join(
261261
[
262-
'%d' % (affiliations.index(a) + 1)
262+
str(affiliations.index(a) + 1)
263263
for a in _aslist(author.get('affiliation', 'Unaffiliated'))
264264
]
265265
)
@@ -272,7 +272,7 @@ def _aslist(value):
272272
file=sys.stderr,
273273
)
274274

275-
print('Authors (%d):' % len(hits))
275+
print(f'Authors ({len(hits)}):')
276276
print(
277277
'{}.'.format(
278278
'; '.join(

fmriprep/cli/tests/test_parser.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ def test_parser_valid(tmp_path, args):
8282
('1000MB', 1),
8383
('1T', 1000),
8484
('1TB', 1000),
85-
('%dK' % 1e6, 1),
86-
('%dKB' % 1e6, 1),
87-
('%dB' % 1e9, 1),
85+
('1000000K', 1),
86+
('1000000KB', 1),
87+
('1000000000B', 1),
8888
],
8989
)
9090
def test_memory_arg(tmp_path, argval, gb):

fmriprep/config.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -149,11 +149,10 @@
149149
# Just get so analytics track one hit
150150
from contextlib import suppress
151151

152-
from requests import ConnectionError, ReadTimeout
153-
from requests import get as _get_url
152+
import requests
154153

155-
with suppress((ConnectionError, ReadTimeout)):
156-
_get_url('https://rig.mit.edu/et/projects/nipy/nipype', timeout=0.05)
154+
with suppress((requests.ConnectionError, requests.ReadTimeout)):
155+
requests.get('https://rig.mit.edu/et/projects/nipy/nipype', timeout=0.05)
157156

158157
# Execution environment
159158
_exec_env = os.name

fmriprep/conftest.py

+5
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ def copytree_or_skip(source, target):
2626
pytest.skip(f'Cannot copy {data_dir!r} into {target / data_dir.name}. Probably in a zip.')
2727

2828

29+
@pytest.fixture(scope='session', autouse=True)
30+
def _legacy_printoptions():
31+
np.set_printoptions(legacy='1.21')
32+
33+
2934
@pytest.fixture(autouse=True)
3035
def _populate_namespace(doctest_namespace, tmp_path):
3136
doctest_namespace['copytree_or_skip'] = copytree_or_skip

fmriprep/interfaces/reports.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -242,13 +242,13 @@ def _generate_segment(self):
242242
reg = {
243243
'FSL': [
244244
'FSL <code>flirt</code> with boundary-based registration'
245-
' (BBR) metric - %d dof' % dof,
245+
f' (BBR) metric - {dof} dof',
246246
'FSL <code>flirt</code> rigid registration - 6 dof',
247247
],
248248
'FreeSurfer': [
249249
'FreeSurfer <code>bbregister</code> '
250-
'(boundary-based registration, BBR) - %d dof' % dof,
251-
'FreeSurfer <code>mri_coreg</code> - %d dof' % dof,
250+
f'(boundary-based registration, BBR) - {dof} dof',
251+
f'FreeSurfer <code>mri_coreg</code> - {dof} dof',
252252
],
253253
}[self.inputs.registration][self.inputs.fallback]
254254

fmriprep/utils/telemetry.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def process_crashfile(crashfile):
116116
scope.set_extra(k, strv[0])
117117
else:
118118
for i, chunk in enumerate(strv):
119-
scope.set_extra('%s_%02d' % (k, i), chunk)
119+
scope.set_extra(f'{k}_{i:02d}', chunk)
120120

121121
fingerprint = ''
122122
issue_title = f'{node_name}: {gist}'

fmriprep/workflows/bold/stc.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def init_bold_stc_wf(
106106
frac = config.workflow.slice_time_ref
107107
tzero = np.round(first + frac * (last - first), 3)
108108

109-
afni_ver = ''.join('%02d' % v for v in afni.Info().version() or [])
109+
afni_ver = ''.join(f'{v:02d}' for v in afni.Info().version() or [])
110110
workflow = Workflow(name=name)
111111
workflow.__desc__ = f"""\
112112
BOLD runs were slice-time corrected to {tzero:0.3g}s ({frac:g} of slice acquisition range

pyproject.toml

+21-21
Original file line numberDiff line numberDiff line change
@@ -19,28 +19,28 @@ classifiers = [
1919
license = {file = "LICENSE"}
2020
requires-python = ">=3.10"
2121
dependencies = [
22-
"acres",
23-
"looseversion",
22+
"acres >= 0.2.0",
23+
"looseversion >= 1.3",
2424
"nibabel >= 4.0.1",
2525
"nipype >= 1.8.5",
26-
"nireports >= 23.2.2",
27-
"nitime",
28-
"nitransforms >= 24.0.2",
29-
"niworkflows >= 1.11.0",
30-
"numpy >= 1.22",
31-
"packaging",
32-
"pandas",
26+
"nireports >= 24.0.3",
27+
"nitime >= 0.9",
28+
"nitransforms >= 24.1.0",
29+
"niworkflows >= 1.12.1",
30+
"numpy >= 1.24",
31+
"packaging >= 24",
32+
"pandas >= 1.2",
3333
"psutil >= 5.4",
34-
"pybids >= 0.15.2",
35-
"requests",
34+
"pybids >= 0.16",
35+
"requests >= 2.27",
3636
"sdcflows >= 2.10.0",
3737
"smriprep >= 0.16.0",
3838
"tedana >= 23.0.2",
39-
"templateflow >= 24.1.0",
40-
"transforms3d",
41-
"toml",
42-
"codecarbon",
43-
"APScheduler",
39+
"templateflow >= 24.2.2",
40+
"transforms3d >= 0.4",
41+
"toml >= 0.10",
42+
"codecarbon >= 2",
43+
"APScheduler >= 3.10",
4444
]
4545
dynamic = ["version"]
4646

@@ -59,7 +59,7 @@ doc = [
5959
"sphinx_rtd_theme>=0.5.2",
6060
]
6161
dev = [
62-
"ruff ~= 0.4.3",
62+
"ruff",
6363
"pre-commit",
6464
]
6565
duecredit = ["duecredit"]
@@ -75,11 +75,11 @@ telemetry = [
7575
"sentry-sdk >= 1.3",
7676
]
7777
test = [
78-
"coverage[toml]",
79-
"pytest",
80-
"pytest-cov",
78+
"coverage[toml] >= 5.2.1",
79+
"pytest >= 8.1",
80+
"pytest-cov >= 2.11",
8181
"pytest-env",
82-
"pytest-xdist",
82+
"pytest-xdist >= 2.5",
8383
]
8484
maint = [
8585
"fuzzywuzzy",

tox.ini

+7-10
Original file line numberDiff line numberDiff line change
@@ -38,21 +38,18 @@ pass_env =
3838
CLICOLOR
3939
CLICOLOR_FORCE
4040
PYTHON_GIL
41+
deps =
42+
py313: traits @ git+https://github.com/enthought/traits.git@10954eb
4143
extras = test
4244
setenv =
45+
pre: UV_EXTRA_INDEX_URL=https://pypi.anaconda.org/scientific-python-nightly-wheels/simple
4346
pre: PIP_EXTRA_INDEX_URL=https://pypi.anaconda.org/scientific-python-nightly-wheels/simple
44-
deps =
45-
min: nibabel == 4.0.1
46-
min: nipype == 1.8.5
47-
min: nitransforms == 21.0.0
48-
min: numpy == 1.22
49-
min: psutil == 5.4
50-
min: pybids == 0.15.2
51-
min: tedana == 23.0.2
52-
min: templateflow == 24.1.0
47+
uv_resolution =
48+
min: lowest-direct
5349

5450
commands_pre =
55-
python scripts/fetch_templates.py
51+
# Use py* to disable for other environments
52+
py3{10,11,12,13}: python scripts/fetch_templates.py
5653
commands =
5754
pytest --cov-report term-missing --durations=20 --durations-min=1.0 {posargs:-n auto}
5855

0 commit comments

Comments
 (0)