diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..d056e98 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,19 @@ +# EditorConfig + +# 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 2-space indentation for YAML. +[*.{yml,yaml}] +indent_size = 2 +indent_style = space diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..dc05d30 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,32 @@ +name: publish + +on: + # Trigger this workflow when a release is created. + release: + types: + - published + +permissions: + # Allow checkout of the project. + contents: read + +env: + # Default Python version on which jobs are run. + DEFAULT_PYTHON_VERSION: '3.9' + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: ${{ env.DEFAULT_PYTHON_VERSION }} + - name: Install build frontend + run: python -m pip install build + - name: Build distribution package + run: python -m build + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index f26133f..979871c 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -10,7 +10,6 @@ env: on: push: branches: [ main ] - tags: [ '*' ] pull_request: branches: [ main ] @@ -19,101 +18,85 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ['3.7', '3.11'] # Check oldest and newest versions - pip-flags: ['', '--editable'] + python-version: [ '3.7', '3.11' ] # 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@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__}')" test: runs-on: ubuntu-latest strategy: matrix: - python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] + python-version: [ '3.7', '3.8', '3.9', '3.10', '3.11' ] 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@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() }} deploy: - needs: [devcheck, test] + needs: [ devcheck, test ] runs-on: ubuntu-latest strategy: matrix: - python-version: [3.9] + python-version: [ '3.9' ] 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 build twine - - name: Build source and wheel distributions - run: python -m build - - 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/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 build twine + - name: Build source and wheel distributions + run: python -m build + - name: Check distributions + run: twine check dist/* + - uses: actions/upload-artifact@v2 + with: + name: distributions + path: dist/ diff --git a/CHANGELOG.md b/CHANGELOG.md index df7ef20..ecf0c47 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,16 @@ All notable changes to this project will be documented in this file. +## [0.2.1] – 2022-11-22 + +### Added + +- Publish package automatically on release. + +### Fixed + +- Update project metadata. + ## [0.2.0] – 2022-11-21 ### Added @@ -21,5 +31,6 @@ All notable changes to this project will be documented in this file. - Initial release for PyPI +[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 diff --git a/pyproject.toml b/pyproject.toml index b381503..e630f8a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "flit_scm:buildapi" name = "pydra-nipype1" description = "Tools for importing nipype 1.x interfaces into Pydra" readme = "README.md" -requires-python = "~=3.7" +requires-python = ">=3.7" dependencies = [ "pydra >=0.6.2", "nipype", @@ -16,6 +16,9 @@ license = {file = "LICENSE"} authors = [ {name = "Chris Markiewicz", email = "markiewicz@stanford.edu"}, ] +maintainers = [ + {name = "Ghislain Vaillant", email = "ghislain.vaillant@icm-institute.org"}, +] keywords = [ "pydra", "nipype", @@ -27,6 +30,7 @@ classifiers = [ "License :: OSI Approved :: Apache Software License", "Operating System :: MacOS :: MacOS X", "Operating System :: POSIX :: Linux", + "Programming Language :: Python :: 3", "Topic :: Scientific/Engineering", ] dynamic = ["version"] @@ -36,14 +40,6 @@ dev = [ "black", "pre-commit", ] -doc = [ - "packaging", - "sphinx >=2.1.2", - "sphinx_rtd_theme", - "sphinxcontrib-apidoc ~=0.3.0", - "sphinxcontrib-napoleon", - "sphinxcontrib-versioning", -] test = [ "pytest>=4.4.0", "pytest-cov", @@ -64,5 +60,5 @@ write_to = "pydra/tasks/nipype1/_version.py" [tool.black] line-length = 99 -target-version = ["py37", "py38"] +target-version = ["py37"] exclude = "_version.py"