diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..6c9e83fc --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,10 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "monthly" + groups: + actions-infrastructure: + patterns: + - "actions/*" diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 71a1494b..6dac22f0 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -20,10 +20,10 @@ jobs: steps: - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Build package @@ -90,7 +90,7 @@ jobs: if: "!contains(github.event.head_commit.message, '[skip ci]')" runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python 3 - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 - run: pipx run flake8 nitransforms diff --git a/.github/workflows/travis.yml b/.github/workflows/travis.yml index 7efe2c74..2a9473ed 100644 --- a/.github/workflows/travis.yml +++ b/.github/workflows/travis.yml @@ -1,67 +1,91 @@ name: Deps & CI -on: [push] +on: + push: + branches: [ '*' ] + pull_request: + branches: [ master, 'maint/*' ] + schedule: + - cron: '0 0 * * 1' + # Allow job to be triggered manually from GitHub interface + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: read jobs: - build-linux: - if: "!contains(github.event.head_commit.message, '[skip ci]' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name != 'nipy/nitransforms'))" + cache-test-data: + if: "!contains(github.event.head_commit.message, '[skip ci]')" runs-on: ubuntu-latest env: TEST_DATA_HOME: /home/runner/testdata/nitransforms-tests - strategy: - max-parallel: 5 - matrix: - python-version: ['3.8', '3.9', '3.10', '3.11'] - + outputs: + SHA: ${{ steps.test-head.outputs.SHA }} steps: - name: Git settings (pacify DataLad) run: | git config --global user.name 'NiPreps Bot' git config --global user.email 'nipreps@gmail.com' - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - uses: actions/cache@v3 - id: conda - with: - path: | - /usr/share/miniconda/pkgs - /home/runner/.cache/pip - key: python-${{ matrix.python-version }}-v1 - restore-keys: | - python-${{ matrix.python-version }}- - name: Install DataLad run: | - $CONDA/bin/conda install -c conda-forge git-annex datalad pip pytest - $CONDA/bin/python -m pip install datalad-osf + $CONDA/bin/conda install -c conda-forge git-annex + python -m pip install datalad datalad-next datalad-osf + - name: Check remote HEAD + id: test-head + run: | + git ls-remote https://gin.g-node.org/oesteban/nitransforms-tests \ + | awk '/HEAD/{ print "SHA=" $1 }' >> $GITHUB_OUTPUT - - uses: actions/cache@v3 + - uses: actions/cache@v4 with: path: ${{ env.TEST_DATA_HOME }} - key: data-cache-v2 + key: data-cache-v2-${{ steps.test-head.outputs.SHA }} restore-keys: | + data-cache-v2-${{ steps.test-head.outputs.SHA }} data-cache-v2 - name: Install test data run: | export PATH=$CONDA/bin:$PATH mkdir -p /home/runner/testdata - cd /home/runner/testdata - $CONDA/bin/datalad install https://gin.g-node.org/oesteban/nitransforms-tests - $CONDA/bin/datalad update --merge -d nitransforms-tests/ - $CONDA/bin/datalad get -d nitransforms-tests/ + datalad install -s https://gin.g-node.org/oesteban/nitransforms-tests $TEST_DATA_HOME + datalad update --merge -d $TEST_DATA_HOME + datalad get -J 2 -d $TEST_DATA_HOME + + build-linux: + if: "!contains(github.event.head_commit.message, '[skip ci]')" + runs-on: ubuntu-latest + needs: [cache-test-data] + env: + TEST_DATA_HOME: /home/runner/testdata/nitransforms-tests + strategy: + max-parallel: 5 + matrix: + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] + steps: + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - uses: actions/cache/restore@v4 + with: + path: ${{ env.TEST_DATA_HOME }} + key: data-cache-v2-${{ needs.cache-test-data.outputs.SHA }} - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install minimal dependencies run: | - $CONDA/bin/pip install .[tests] + pip install .[tests] - name: Run pytest run: | - $CONDA/bin/pytest -v --cov nitransforms --cov-config .coveragerc --cov-report xml:cov.xml --doctest-modules nitransforms/ + pytest -v --cov nitransforms --cov-config .coveragerc --cov-report xml:cov.xml --doctest-modules nitransforms/ - name: Submit code coverage - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 with: files: cov.xml diff --git a/CHANGES.rst b/CHANGES.rst index b9e933aa..7aa56a65 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,21 @@ +24.0.1 (September 17, 2024) +=========================== +Bug-fix release in the 24.0.x series. + +New Contributors +---------------- +* @shnizzedy made their first contribution in https://github.com/nipy/nitransforms/pull/222 + +CHANGES +------- + +* FIX: Use standard library ``pathlib`` by @shnizzedy in https://github.com/nipy/nitransforms/pull/222 +* MAINT: Support pre-``__or__`` types by @effigies in https://github.com/nipy/nitransforms/pull/223 +* MAINT: Bump the actions-infrastructure group with 3 updates by @dependabot in https://github.com/nipy/nitransforms/pull/224 +* MAINT: Bump codecov/codecov-action from 3 to 4 by @dependabot in https://github.com/nipy/nitransforms/pull/225 + +**Full Changelog**: https://github.com/nipy/nitransforms/compare/24.0.0...24.0.1 + 24.0.0 (August 18, 2024) ======================== A new series incorporating several major changes, including bugfixes and taking on several diff --git a/nitransforms/resampling.py b/nitransforms/resampling.py index d7c7f9c5..1045cde1 100644 --- a/nitransforms/resampling.py +++ b/nitransforms/resampling.py @@ -12,7 +12,7 @@ from os import cpu_count from functools import partial from pathlib import Path -from typing import Callable, TypeVar +from typing import Callable, TypeVar, Union import numpy as np from nibabel.loadsave import load as _nbload @@ -144,8 +144,8 @@ async def _apply_serial( def apply( transform: TransformBase, - spatialimage: str | Path | SpatialImage, - reference: str | Path | SpatialImage = None, + spatialimage: Union[str, Path, SpatialImage], + reference: Union[str, Path, SpatialImage] = None, order: int = 3, mode: str = "constant", cval: float = 0.0, @@ -154,7 +154,7 @@ def apply( dtype_width: int = 8, serialize_nvols: int = SERIALIZE_VOLUME_WINDOW_WIDTH, max_concurrent: int = min(cpu_count(), 12), -) -> SpatialImage | np.ndarray: +) -> Union[SpatialImage, np.ndarray]: """ Apply a transformation to an image, resampling on the reference spatial object. diff --git a/setup.cfg b/setup.cfg index 158a9013..4607288f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -27,7 +27,6 @@ install_requires = scipy >= 1.6.0 nibabel >= 3.0 h5py - pathlib test_requires = pytest pytest-cov