Skip to content

Commit

Permalink
Merge branch 'main' into fix/no_mutate_on_run
Browse files Browse the repository at this point in the history
  • Loading branch information
effigies authored Mar 23, 2024
2 parents 9b2ff04 + d033633 commit 7fd9e72
Show file tree
Hide file tree
Showing 15 changed files with 268 additions and 2,630 deletions.
24 changes: 24 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# EditorConfig <editorconfig.org>

# This is the top-most EditorConfig file.
root = true

# Use Unix-style newlines with a newline ending for all files.
[*]
end_of_line = lf
insert_final_newline = true

# Use 4-space indentation for Python.
[*.py]
indent_size = 4
indent_style = space

# Use 4-space indentation for TOML.
[*.toml]
indent_size = 4
indent_style = space

# Use 2-space indentation for YAML.
[*.{yml,yaml}]
indent_size = 2
indent_style = space
172 changes: 85 additions & 87 deletions .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,114 +6,112 @@ name: Python package
# Set once
env:
SUBPACKAGE: nipype1
FSLCONDA: https://fsl.fmrib.ox.ac.uk/fsldownloads/fslconda/public/

on:
push:
branches: [ main ]
tags: [ '*' ]
branches: [main]
pull_request:
branches: [ main ]
branches: [main]
release:
types:
- published

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

defaults:
run:
shell: bash -el {0}

jobs:
devcheck:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.9] # Check oldest and newest versions
pip-flags: ['', '--editable']
python-version: ["3.8", "3.12"] # Check oldest and newest versions
pip-flags: ["", "--editable"]
pydra:
- 'pydra'
- '--editable git+https://github.com/nipype/pydra.git#egg=pydra'
- "pydra"
- "--editable git+https://github.com/nipype/pydra.git#egg=pydra"

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
- name: Install Pydra
run: |
pip install ${{ matrix.pydra }}
python -c "import pydra as m; print(f'{m.__name__} {m.__version__} @ {m.__file__}')"
- name: Install task package
run: |
pip install ${{ matrix.pip-flags }} ".[dev]"
python -c "import pydra.tasks.$SUBPACKAGE as m; print(f'{m.__name__} {m.__version__} @ {m.__file__}')"
python -c "import pydra as m; print(f'{m.__name__} {m.__version__} @ {m.__file__}')"
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
- name: Install Pydra
run: |
pip install ${{ matrix.pydra }}
python -c "import pydra as m; print(f'{m.__name__} {m.__version__} @ {m.__file__}')"
- name: Install task package
run: |
pip install ${{ matrix.pip-flags }} ".[dev]"
python -c "import pydra.tasks.$SUBPACKAGE as m; print(f'{m.__name__} {m.__version__} @ {m.__file__}')"
python -c "import pydra as m; print(f'{m.__name__} {m.__version__} @ {m.__file__}')"
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8, 3.9]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Set up NeuroDebian
run: bash <(wget -q -O- http://neuro.debian.net/_files/neurodebian-travis.sh)
- name: Install FSL
run: sudo apt-get install -y fsl
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
- name: Install task package
run: |
pip install ".[test]"
python -c "import pydra.tasks.$SUBPACKAGE as m; print(f'{m.__name__} {m.__version__} @ {m.__file__}')"
python -c "import pydra as m; print(f'{m.__name__} {m.__version__} @ {m.__file__}')"
- name: Test with pytest
run: |
source /etc/fsl/fsl.sh
pytest -sv --doctest-modules pydra/tasks/$SUBPACKAGE \
--cov pydra.tasks.$SUBPACKAGE --cov-report xml
- uses: codecov/codecov-action@v1
if: ${{ always() }}
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: conda-incubator/setup-miniconda@v3
with:
python-version: ${{ matrix.python-version }}
mamba-version: "*"
channels: ${{ env.FSLCONDA }},conda-forge,defaults
channel-priority: true
- name: Install FSL
run: |
mamba install fsl-avwutils
mamba env config vars set FSLDIR="$CONDA_PREFIX" FSLOUTPUTTYPE="NIFTI_GZ"
# Hack because we're not doing a full FSL install
echo "6.0.7.9" > $CONDA_PREFIX/etc/fslversion
- name: Upgrade pip
run: |
python -m pip install --upgrade pip
- name: Install task package
run: |
pip install ".[test]"
python -c "import pydra.tasks.$SUBPACKAGE as m; print(f'{m.__name__} {m.__version__} @ {m.__file__}')"
python -c "import pydra as m; print(f'{m.__name__} {m.__version__} @ {m.__file__}')"
- name: Test with pytest
run: |
pytest -sv --doctest-modules pydra/tasks/$SUBPACKAGE \
--cov pydra.tasks.$SUBPACKAGE --cov-report xml
- uses: codecov/codecov-action@v4
if: ${{ always() }}
with:
token: ${{ secrets.CODECOV_TOKEN }}

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- uses: hynek/build-and-inspect-python-package@v2

deploy:
needs: [devcheck, test]
needs: [build, devcheck, test]
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.9]
permissions:
id-token: write
if: github.repository_owner == 'nipype' && github.event.action == 'published'
environment: Publish
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install build tools
run: python -m pip install --upgrade pip setuptools wheel twine
- name: Build source and wheel distributions
run: python setup.py sdist bdist_wheel
- name: Check distributions
run: twine check dist/*
- uses: actions/upload-artifact@v2
with:
name: distributions
path: dist/
# Deploy on tags if PYPI_API_TOKEN is defined in the repository secrets.
# Secrets are not accessible in the if: condition [0], so set an output variable [1]
# [0] https://github.community/t/16928
# [1] https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-output-parameter
- name: Check for PyPI token on tag
id: deployable
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
env:
PYPI_API_TOKEN: "${{ secrets.PYPI_API_TOKEN }}"
run: if [ -n "$PYPI_API_TOKEN" ]; then echo ::set-output name=DEPLOY::true; fi
- name: Upload to PyPI
if: steps.deployable.outputs.DEPLOY
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 # v1.4.2
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
- uses: actions/download-artifact@v4
with:
name: Packages
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,6 @@ dmypy.json

# Pyre type checker
.pyre/

# Generated by flit_scm
_version.py
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
rev: v4.5.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.10.0
rev: 24.3.0
hooks:
- id: black
52 changes: 50 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,52 @@
0.1.0 (9 April 2021)
====================
# Changelog

All notable changes to this project will be documented in this file.

## [0.3.0] - 2024-03-22

### Changed

* Pydra 0.23+ compatibility
* Drop Python 3.7 compatibility, test Python 3.12
* Updates to CI workflows

## [0.2.2] – 2022-11-22

### Changed

- Set Nipype developers as maintainers.

## [0.2.1] – 2022-11-22

### Added

- Publish package automatically on release.

### Fixed

- Update project metadata.

## [0.2.0] – 2022-11-21

### Added

- Expose `Nipype1Task` to the root of the package.

### Changed

- Use modern `attrs` namespace instead of `attr`.
- Migrate project to `flit_scm`.

### Fixed

- Keep collection types in wrapped interfaces.

## [0.1.0] – 2021-04-09

- Initial release for PyPI

[0.3.0]: https://github.com/nipype/pydra-nipype1/compare/0.2.2...0.3.0
[0.2.2]: https://github.com/nipype/pydra-nipype1/compare/0.2.1...0.2.2
[0.2.1]: https://github.com/nipype/pydra-nipype1/compare/0.2.0...0.2.1
[0.2.0]: https://github.com/nipype/pydra-nipype1/compare/0.1.0...0.2.0
[0.1.0]: https://github.com/nipype/pydra-nipype1/releases/tag/0.1.0
2 changes: 0 additions & 2 deletions MANIFEST.in

This file was deleted.

15 changes: 12 additions & 3 deletions pydra/tasks/nipype1/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
from ._version import get_versions
"""
>>> from pydra import ShellCommandTask
>>> import pydra.tasks.nipype1
"""

__version__ = get_versions()["version"]
del get_versions
try:
from ._version import __version__
except ImportError:
pass

from .utils import Nipype1Task

__all__ = ["Nipype1Task"]
Loading

0 comments on commit 7fd9e72

Please sign in to comment.