Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Update minimum dependencies, test with tox-uv #3412

Merged
merged 9 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 0 additions & 38 deletions .github/workflows/contrib.yml

This file was deleted.

26 changes: 23 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ jobs:
run: |
sudo apt update
sudo apt install -y --no-install-recommends graphviz
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
Expand All @@ -65,14 +67,32 @@ jobs:
run: python -c "import sys; print(sys.version)"
- name: Install tox
run: |
python -m pip install --upgrade pip
python -m pip install tox tox-gh-actions
uv tool install --with=tox-uv --with=tox-gh-actions tox
- name: Show tox config
run: tox c
- name: Run tox
run: tox -v --exit-and-dump-after 1200
- uses: codecov/codecov-action@v5
with:
file: coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}
if: ${{ always() }}

checks:
runs-on: "ubuntu-latest"
continue-on-error: true
strategy:
matrix:
check: ["style", "spellcheck"]

steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v4
- name: Install tox
run: uv tool install tox --with=tox-uv
- name: Show tox config
run: tox c -e ${{ matrix.check }}
- name: Run check
run: tox -e ${{ matrix.check }}
4 changes: 2 additions & 2 deletions .maint/paper_author_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def _aslist(inlist):
aff_indexes = [
', '.join(
[
'%d' % (affiliations.index(a) + 1)
str(affiliations.index(a) + 1)
for a in _aslist(author.get('affiliation', 'Unaffiliated'))
]
)
Expand All @@ -52,7 +52,7 @@ def _aslist(inlist):
file=sys.stderr,
)

print('Authors (%d):' % len(author_matches))
print(f'Authors ({len(author_matches)}):')
print(
'{}.'.format(
'; '.join(
Expand Down
4 changes: 2 additions & 2 deletions .maint/update_authors.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ def _aslist(value):
aff_indexes = [
', '.join(
[
'%d' % (affiliations.index(a) + 1)
str(affiliations.index(a) + 1)
for a in _aslist(author.get('affiliation', 'Unaffiliated'))
]
)
Expand All @@ -272,7 +272,7 @@ def _aslist(value):
file=sys.stderr,
)

print('Authors (%d):' % len(hits))
print(f'Authors ({len(hits)}):')
print(
'{}.'.format(
'; '.join(
Expand Down
6 changes: 3 additions & 3 deletions fmriprep/cli/tests/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ def test_parser_valid(tmp_path, args):
('1000MB', 1),
('1T', 1000),
('1TB', 1000),
('%dK' % 1e6, 1),
('%dKB' % 1e6, 1),
('%dB' % 1e9, 1),
('1000000K', 1),
('1000000KB', 1),
('1000000000B', 1),
],
)
def test_memory_arg(tmp_path, argval, gb):
Expand Down
7 changes: 3 additions & 4 deletions fmriprep/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,10 @@
# Just get so analytics track one hit
from contextlib import suppress

from requests import ConnectionError, ReadTimeout
from requests import get as _get_url
import requests

Check warning on line 152 in fmriprep/config.py

View check run for this annotation

Codecov / codecov/patch

fmriprep/config.py#L152

Added line #L152 was not covered by tests

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

Check warning on line 155 in fmriprep/config.py

View check run for this annotation

Codecov / codecov/patch

fmriprep/config.py#L154-L155

Added lines #L154 - L155 were not covered by tests

# Execution environment
_exec_env = os.name
Expand Down
5 changes: 5 additions & 0 deletions fmriprep/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ def copytree_or_skip(source, target):
pytest.skip(f'Cannot copy {data_dir!r} into {target / data_dir.name}. Probably in a zip.')


@pytest.fixture(scope='session', autouse=True)
def _legacy_printoptions():
np.set_printoptions(legacy='1.21')


@pytest.fixture(autouse=True)
def _populate_namespace(doctest_namespace, tmp_path):
doctest_namespace['copytree_or_skip'] = copytree_or_skip
Expand Down
6 changes: 3 additions & 3 deletions fmriprep/interfaces/reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,13 +242,13 @@ def _generate_segment(self):
reg = {
'FSL': [
'FSL <code>flirt</code> with boundary-based registration'
' (BBR) metric - %d dof' % dof,
f' (BBR) metric - {dof} dof',
'FSL <code>flirt</code> rigid registration - 6 dof',
],
'FreeSurfer': [
'FreeSurfer <code>bbregister</code> '
'(boundary-based registration, BBR) - %d dof' % dof,
'FreeSurfer <code>mri_coreg</code> - %d dof' % dof,
f'(boundary-based registration, BBR) - {dof} dof',
f'FreeSurfer <code>mri_coreg</code> - {dof} dof',
],
}[self.inputs.registration][self.inputs.fallback]

Expand Down
2 changes: 1 addition & 1 deletion fmriprep/utils/telemetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
scope.set_extra(k, strv[0])
else:
for i, chunk in enumerate(strv):
scope.set_extra('%s_%02d' % (k, i), chunk)
scope.set_extra(f'{k}_{i:02d}', chunk)

Check warning on line 119 in fmriprep/utils/telemetry.py

View check run for this annotation

Codecov / codecov/patch

fmriprep/utils/telemetry.py#L119

Added line #L119 was not covered by tests

fingerprint = ''
issue_title = f'{node_name}: {gist}'
Expand Down
2 changes: 1 addition & 1 deletion fmriprep/workflows/bold/stc.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def init_bold_stc_wf(
frac = config.workflow.slice_time_ref
tzero = np.round(first + frac * (last - first), 3)

afni_ver = ''.join('%02d' % v for v in afni.Info().version() or [])
afni_ver = ''.join(f'{v:02d}' for v in afni.Info().version() or [])
workflow = Workflow(name=name)
workflow.__desc__ = f"""\
BOLD runs were slice-time corrected to {tzero:0.3g}s ({frac:g} of slice acquisition range
Expand Down
42 changes: 21 additions & 21 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,28 @@ classifiers = [
license = {file = "LICENSE"}
requires-python = ">=3.10"
dependencies = [
"acres",
"looseversion",
"acres >= 0.2.0",
"looseversion >= 1.3",
"nibabel >= 4.0.1",
"nipype >= 1.8.5",
"nireports >= 23.2.2",
"nitime",
"nitransforms >= 24.0.2",
"niworkflows >= 1.11.0",
"numpy >= 1.22",
"packaging",
"pandas",
"nireports >= 24.0.3",
"nitime >= 0.9",
"nitransforms >= 24.1.0",
"niworkflows >= 1.12.1",
"numpy >= 1.24",
"packaging >= 24",
"pandas >= 1.2",
"psutil >= 5.4",
"pybids >= 0.15.2",
"requests",
"pybids >= 0.16",
"requests >= 2.27",
"sdcflows >= 2.10.0",
"smriprep >= 0.16.0",
"tedana >= 23.0.2",
"templateflow >= 24.1.0",
"transforms3d",
"toml",
"codecarbon",
"APScheduler",
"templateflow >= 24.2.2",
"transforms3d >= 0.4",
"toml >= 0.10",
"codecarbon >= 2",
"APScheduler >= 3.10",
]
dynamic = ["version"]

Expand All @@ -59,7 +59,7 @@ doc = [
"sphinx_rtd_theme>=0.5.2",
]
dev = [
"ruff ~= 0.4.3",
"ruff",
"pre-commit",
]
duecredit = ["duecredit"]
Expand All @@ -75,11 +75,11 @@ telemetry = [
"sentry-sdk >= 1.3",
]
test = [
"coverage[toml]",
"pytest",
"pytest-cov",
"coverage[toml] >= 5.2.1",
"pytest >= 8.1",
"pytest-cov >= 2.11",
"pytest-env",
"pytest-xdist",
"pytest-xdist >= 2.5",
]
maint = [
"fuzzywuzzy",
Expand Down
17 changes: 7 additions & 10 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,18 @@ pass_env =
CLICOLOR
CLICOLOR_FORCE
PYTHON_GIL
deps =
py313: traits @ git+https://github.com/enthought/traits.git@10954eb
extras = test
setenv =
pre: UV_EXTRA_INDEX_URL=https://pypi.anaconda.org/scientific-python-nightly-wheels/simple
pre: PIP_EXTRA_INDEX_URL=https://pypi.anaconda.org/scientific-python-nightly-wheels/simple
deps =
min: nibabel == 4.0.1
min: nipype == 1.8.5
min: nitransforms == 21.0.0
min: numpy == 1.22
min: psutil == 5.4
min: pybids == 0.15.2
min: tedana == 23.0.2
min: templateflow == 24.1.0
uv_resolution =
min: lowest-direct

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

Expand Down
Loading