Skip to content

Commit ed5f9ba

Browse files
authored
Merge branch 'main' into enh/renamer
2 parents 803f866 + 843d381 commit ed5f9ba

25 files changed

+397
-2539
lines changed

.coveragerc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[run]
2+
branch = True
3+
omit =
4+
*/_version.py

.flake8

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
[flake8]
3+
doctests = True
4+
exclude =
5+
**/__init__.py
6+
*build/
7+
docs/sphinxext/
8+
docs/tools/
9+
docs/conf.py
10+
docs/source/conf.py
11+
max-line-length = 88
12+
select = C,E,F,W,B,B950
13+
extend-ignore = E203,E501,E129,W503
14+
per-file-ignores =
15+
__init__.py:F401,F403

.gitattributes

Lines changed: 0 additions & 1 deletion
This file was deleted.

.github/workflows/pythonpackage.yaml

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
#This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3+
4+
# For deployment, it will be necessary to create a PyPI API token and store it as a secret
5+
# https://docs.github.com/en/actions/reference/encrypted-secrets
6+
7+
name: Python package
8+
9+
on:
10+
push:
11+
branches: [ main ]
12+
tags: [ '*' ]
13+
pull_request:
14+
branches: [ main ]
15+
16+
jobs:
17+
devcheck:
18+
runs-on: ubuntu-latest
19+
strategy:
20+
matrix:
21+
python-version: [3.7, '3.10'] # Check oldest and newest versions
22+
pip-flags: ['', '--editable']
23+
pydra:
24+
- 'pydra'
25+
- '--editable git+https://github.com/nipype/pydra.git#egg=pydra'
26+
27+
steps:
28+
- uses: actions/checkout@v3
29+
- name: Set up Python ${{ matrix.python-version }}
30+
uses: actions/setup-python@v4
31+
with:
32+
python-version: ${{ matrix.python-version }}
33+
- name: Install build dependencies
34+
run: |
35+
python -m pip install --upgrade pip
36+
- name: Install Pydra
37+
run: |
38+
pip install ${{ matrix.pydra }}
39+
python -c "import pydra as m; print(f'{m.__name__} {m.__version__} @ {m.__file__}')"
40+
- name: Install task package
41+
run: |
42+
pip install ${{ matrix.pip-flags }} ".[dev]"
43+
python -c "import pydra.tasks.CHANGEME as m; print(f'{m.__name__} {m.__version__} @ {m.__file__}')"
44+
python -c "import pydra as m; print(f'{m.__name__} {m.__version__} @ {m.__file__}')"
45+
46+
test:
47+
runs-on: ubuntu-latest
48+
strategy:
49+
matrix:
50+
python-version: [3.7, 3.8, 3.9, '3.10']
51+
52+
steps:
53+
- uses: actions/checkout@v3
54+
- name: Set up Python ${{ matrix.python-version }}
55+
uses: actions/setup-python@v4
56+
with:
57+
python-version: ${{ matrix.python-version }}
58+
- name: Install build dependencies
59+
run: |
60+
python -m pip install --upgrade pip
61+
- name: Install task package
62+
run: |
63+
pip install ".[test]"
64+
python -c "import pydra.tasks.CHANGEME as m; print(f'{m.__name__} {m.__version__} @ {m.__file__}')"
65+
python -c "import pydra as m; print(f'{m.__name__} {m.__version__} @ {m.__file__}')"
66+
- name: Test with pytest
67+
run: |
68+
pytest -sv --doctest-modules pydra/tasks/CHANGEME \
69+
--cov pydra.tasks.CHANGEME --cov-report xml
70+
- uses: codecov/codecov-action@v3
71+
if: ${{ always() }}
72+
73+
74+
deploy:
75+
needs: [devcheck, test]
76+
runs-on: ubuntu-latest
77+
strategy:
78+
matrix:
79+
python-version: [3.9]
80+
steps:
81+
- uses: actions/checkout@v3
82+
with:
83+
submodules: recursive
84+
fetch-depth: 0
85+
- name: Set up Python ${{ matrix.python-version }}
86+
uses: actions/setup-python@v4
87+
with:
88+
python-version: ${{ matrix.python-version }}
89+
- name: Install build tools
90+
run: python -m pip install build twine
91+
- name: Build source and wheel distributions
92+
run: python -m build
93+
- name: Check distributions
94+
run: twine check dist/*
95+
- uses: actions/upload-artifact@v3
96+
with:
97+
name: distributions
98+
path: dist/
99+
# Deploy on tags if PYPI_API_TOKEN is defined in the repository secrets.
100+
# Secrets are not accessible in the if: condition [0], so set an output variable [1]
101+
# [0] https://github.community/t/16928
102+
# [1] https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-output-parameter
103+
- name: Check for PyPI token on tag
104+
id: deployable
105+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
106+
env:
107+
PYPI_API_TOKEN: "${{ secrets.PYPI_API_TOKEN }}"
108+
run: if [ -n "$PYPI_API_TOKEN" ]; then echo "DEPLOY=true" >> $GITHUB_OUTPUT; fi
109+
- name: Upload to PyPI
110+
if: steps.deployable.outputs.DEPLOY
111+
uses: pypa/gh-action-pypi-publish@37f50c210e3d2f9450da2cd423303d6a14a6e29f # v1.5.1
112+
with:
113+
user: __token__
114+
password: ${{ secrets.PYPI_API_TOKEN }}

.github/workflows/pythonpackage.yml

Lines changed: 0 additions & 47 deletions
This file was deleted.

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,3 +133,9 @@ dmypy.json
133133

134134
# Vim
135135
.*.sw[op]
136+
137+
# VS Code
138+
.vscode
139+
140+
# Mac garbarge
141+
.DS_store

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
# See https://pre-commit.com/hooks.html for more hooks
33
repos:
44
- repo: https://github.com/pre-commit/pre-commit-hooks
5-
rev: v2.0.0
5+
rev: v4.4.0
66
hooks:
77
- id: trailing-whitespace
88
- id: end-of-file-fixer
99
- id: check-yaml
1010
- id: check-added-large-files
1111
- repo: https://github.com/psf/black
12-
rev: 19.3b0
12+
rev: 22.12.0
1313
hooks:
1414
- id: black

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright 2020 Nipype developers
1+
Copyright 2021 Nipype developers
22

33
Licensed under the Apache License, Version 2.0 (the "License");
44
you may not use this file except in compliance with the License.

MANIFEST.in

Lines changed: 0 additions & 2 deletions
This file was deleted.

README.md

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,33 +8,43 @@ All tasks will be inserted into the `pydra.tasks.<yourtaskpackagename>` namespac
88
1. Click on new repo.
99
1. Select this template from the repository template drop down list.
1010
1. Give your repo a name.
11-
1. Once the repo is created and cloned, search for TODO (`grep -rn TODO . `) and
11+
1. Once the repo is created and cloned, search for CHANGEME (`grep -rn CHANGEME . `) and
1212
replace with appropriate name.
13-
1. One of the folders is called TODO. This should also be renamed to your package
13+
1. One of the folders is called CHANGEME. This should also be renamed to your package
1414
name.
15-
1. Add tasks to the `pydra/tasks/<yourpackagename>` folder.
16-
1. An example subpackage is found in `pydra/tasks/<yourpackagename>/utils`.
17-
You may wish to add tools to it or delete it.
15+
1. Under the newly renamed package (i.e. formerly CHANGEME) there is a directory named "v1",
16+
`pydra/tasks/<package-name>/v1`, change this to valid Python package name starting with
17+
'v' to indicate the version of the tool the Pydra interfaces will be designed for,
18+
e.g. FSL v6.0.2 could be `pydra/tasks/fsl/v6` or `pydra/tasks/fsl/v6_0` depending on
19+
how stable the CLI of the tool is between minor versions.
20+
1. Edit `pydra/tasks/<package-name>/latest.py` to update references to `v1` to the
21+
tool target version
22+
1. Add tasks to the `pydra/tasks/<package-name>/v<package-version>` folder.
1823
1. You may want to initialize a [Sphinx] docs directory.
24+
1. Review the workflow in `.github/workflows/pythonpackage.yml`. Testing editable installations
25+
is probably not useful unless you are reconfiguring namespace packages.
1926
1. **Update this README after creating the new repository.**
2027

2128
[Sphinx]: https://www.sphinx-doc.org/en/master/usage/quickstart.html
2229

2330
# Features of this template
2431

25-
## Versioneer
32+
## Tag-based versioning
2633

27-
The [versioneer](https://github.com/warner/python-versioneer) tool allows for versioning based
34+
The [setuptools_scm](https://github.com/pypa/setuptools_scm) tool allows for versioning based
2835
on the most recent git tag. The release process can thus be:
2936

3037
```Shell
3138
git tag -a 1.0.0
32-
python setup.py sdist bdist_wheel
39+
python -m build
3340
twine upload dist/*
3441
```
3542

36-
Note that we assume tags will be version numbers and not be prefixed with `v` or some other
37-
string. See Versioneer documentation for alternative configurations.
43+
Note that uploading to PyPI is done via [Continuous integration](#continuous-integration)) when
44+
a tag is pushed to the repository, so only the first step needs to be donne manually.
45+
46+
Note also that we assume tags will be version numbers and not be prefixed with `v` or some other
47+
string. See `setuptools_scm` documentation for alternative configurations.
3848

3949
## Namespace packages
4050

@@ -70,6 +80,10 @@ non-compliant package can potentially affect Pydra or other task packages.
7080
In addition to verifying installations do not break or conflict, pytest is run on the package,
7181
including all tests found in `test/` directories and [doctests].
7282

83+
Finally, packages are built and uploaded as artifacts for inspection. When a tag is pushed,
84+
the packages are uploaded to PyPI if a valid [API token](https://pypi.org/help/#apitoken) is placed
85+
in the [repository secrets](https://docs.github.com/en/actions/reference/encrypted-secrets).
86+
7387
[doctests]: https://docs.python.org/3/library/doctest.html
7488

7589
# Contributing to this template
@@ -83,7 +97,7 @@ task packages.
8397
## For developers
8498

8599
Install repo in developer mode from the source directory. It is also useful to
86-
install pre-commit to take care of styling via black:
100+
install pre-commit to take care of styling via [black](https://black.readthedocs.io/):
87101

88102
```
89103
pip install -e .[dev]

0 commit comments

Comments
 (0)