Skip to content

ENH: Conform to latest pydra-tasks-template #7

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

Merged
merged 2 commits into from
Jul 8, 2020
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
23 changes: 19 additions & 4 deletions .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@

name: Python package

# Set once
env:
SUBPACKAGE: nipype1

on:
push:
branches: [ master ]
Expand All @@ -11,22 +15,33 @@ on:

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8]
pip-flags: ['', '--editable']
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 dependencies
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install ".[dev]"
- 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__}')"
- name: Test with pytest
run: |
pytest -sv --doctest-modules pydra/tasks/nipype1
pytest -sv --doctest-modules pydra/tasks/$SUBPACKAGE
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [yyyy] [name of copyright owner]
Copyright 2020 Nipype developers

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## For developers

Install repo in developer mode from the source directory. It is also useful to
install pre-commit to take care of styling via black:

```
pip install -e .[dev]
pre-commit install
```
4 changes: 2 additions & 2 deletions pydra/tasks/nipype1/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

from ._version import get_versions
__version__ = get_versions()['version']

__version__ = get_versions()["version"]
del get_versions
8 changes: 4 additions & 4 deletions pydra/tasks/nipype1/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ def traitedspec_to_specinfo(traitedspec):
name="Inputs",
fields=[
(name, attr.ib(type=ty.Any, metadata={"help_string": trait.desc}))
for name, trait in traitedspec.traits().items() if name in trait_names
for name, trait in traitedspec.traits().items()
if name in trait_names
],
bases=(pydra.engine.specs.BaseSpec,)
bases=(pydra.engine.specs.BaseSpec,),
)


Expand Down Expand Up @@ -66,7 +67,6 @@ def __init__(
self.output_spec = traitedspec_to_specinfo(interface._outputs())

def _run_task(self):
inputs = attr.asdict(self.inputs,
filter=lambda a, v: v is not attr.NOTHING)
inputs = attr.asdict(self.inputs, filter=lambda a, v: v is not attr.NOTHING)
res = self._interface.run(**inputs)
self.output_ = res.outputs.get()
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[tool.black]
line-length = 99
target-version = ['py37', 'py38']
exclude = '_version.py'
31 changes: 25 additions & 6 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[DEFAULT]
subpackage = nipype1

[metadata]
author = Chris Markiewicz
author_email = [email protected]
Expand All @@ -6,21 +9,37 @@ description = Tools for importing nipype 1.x interfaces into Pydra
[options]
python_requires = >=3.7
install_requires =
pydra >= 0.6.1
pydra >= 0.6.2
nipype
packages = pydra.tasks.nipype1
namespace_packages = pydra.tasks

packages = pydra.tasks.%(subpackage)s

[options.extras_require]
doc =
packaging
sphinx >= 2.1.2
sphinx_rtd_theme
sphinxcontrib-apidoc ~= 0.3.0
sphinxcontrib-napoleon
sphinxcontrib-versioning
docs =
%(doc)s
test =
pytest
pytest >= 4.4.0
tests =
%(test)s
dev =
%(test)s
black
pre-commit
all =
%(doc)s
%(dev)s

[versioneer]
VCS = git
style = pep440
versionfile_source = pydra/tasks/nipype1/_version.py
versionfile_build = pydra/tasks/nipype1/_version.py
versionfile_source = pydra/tasks/%(subpackage)s/_version.py
versionfile_build = pydra/tasks/%(subpackage)s/_version.py
tag_prefix =
parentdir_prefix =
15 changes: 8 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
#!/usr/bin/env python
import sys
import os

from setuptools import setup
import versioneer

# Give setuptools a hint to complain if it's too old a version
# 30.3.0 allows us to put most metadata in setup.cfg
# Should match pyproject.toml
SETUP_REQUIRES = ['setuptools >= 30.3.0']
SETUP_REQUIRES = ["setuptools >= 30.3.0"]
# This enables setuptools to install wheel on-the-fly
SETUP_REQUIRES += ['wheel'] if 'bdist_wheel' in sys.argv else []
SETUP_REQUIRES += ["wheel"] if "bdist_wheel" in sys.argv else []

if __name__ == "__main__":
setup(name='pydra-nipype1',
setup_requires=SETUP_REQUIRES,
version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass())
setup(
name="pydra-nipype1",
setup_requires=SETUP_REQUIRES,
version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass(),
)