Skip to content

Commit

Permalink
bump version, merge pull request #19 from AMYPAD/devel
Browse files Browse the repository at this point in the history
  • Loading branch information
casperdcl authored May 30, 2023
2 parents a724410 + 1e83fe2 commit 686ef24
Show file tree
Hide file tree
Showing 15 changed files with 193 additions and 233 deletions.
33 changes: 20 additions & 13 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
name: Test
on: [push, pull_request]
on:
push:
pull_request:
schedule: [{cron: '10 23 * * 6'}] # M H d m w (Sat at 23:10)
jobs:
check:
if: github.event_name != 'pull_request' || !contains('OWNER,MEMBER,COLLABORATOR', github.event.pull_request.author_association)
runs-on: ubuntu-latest
name: Check
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
Expand All @@ -19,7 +21,7 @@ jobs:
- name: dependencies
run: pip install -U pre-commit
- uses: reviewdog/action-setup@v1
- if: github.event_name != 'schedule'
- if: github.event_name == 'push' || github.event_name == 'pull_request'
name: comment
run: |
if [[ $EVENT == pull_request ]]; then
Expand All @@ -35,11 +37,11 @@ jobs:
- run: pre-commit run -a --show-diff-on-failure
test:
if: github.event_name != 'pull_request' || !contains('OWNER,MEMBER,COLLABORATOR', github.event.pull_request.author_association)
name: py${{ matrix.python }}
runs-on: ubuntu-latest
strategy:
matrix:
python: [3.7, '3.10']
name: Test py${{ matrix.python }}
python: [3.7, 3.11]
steps:
- uses: actions/checkout@v3
with:
Expand All @@ -49,22 +51,25 @@ jobs:
python-version: ${{ matrix.python }}
- run: pip install -U .[dev]
- run: pytest --durations-min=1
- run: codecov
- uses: codecov/codecov-action@v3
matlab:
if: github.event_name != 'pull_request' || !contains('OWNER,MEMBER,COLLABORATOR', github.event.pull_request.author_association)
name: MATLAB py${{ matrix.python }}
runs-on: [self-hosted, python, matlab]
name: Test matlab
strategy:
matrix:
python: [3.7, 3.8]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Run setup-python
run: setup-python -p3.7
- run: pip install -U .[dev]
run: setup-python -p${{ matrix.python }}
- run: pip install -U .[dev] 'setuptools<66' # ignore matlab engine PEP440 non-compliance https://github.com/pypa/setuptools/issues/3772
- run: pytest --durations-min=1
- run: codecov
- uses: codecov/codecov-action@v3
- name: Post Run setup-python
run: setup-python -p3.7 -Dr
run: setup-python -p${{ matrix.python }} -Dr
if: ${{ always() }}
deploy:
needs: [check, test, matlab]
Expand All @@ -75,6 +80,8 @@ jobs:
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: '3.x'
- id: dist
uses: casperdcl/deploy-pypi@v2
with:
Expand All @@ -83,10 +90,10 @@ jobs:
password: ${{ secrets.PYPI_TOKEN }}
upload: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') }}
- if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
name: release
name: Release
run: |
changelog=$(git log --pretty='format:%d%n- %s%n%b---' $(git tag --sort=v:refname | tail -n2 | head -n1)..HEAD)
tag="${GITHUB_REF#refs/tags/}"
gh release create --title "spm12 $tag beta" --draft --notes "$changelog" "$tag" dist/${{ steps.dist.outputs.whl }} dist/${{ steps.dist.outputs.whl_asc }}
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
GH_TOKEN: ${{ github.token }}
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
*.py[cod]
__pycache__/
/spm12/_dist_ver.py
/.eggs/
/*.egg-info/
/*.egg*/
/build/
/dist/
/.coverage*
/coverage.xml
/.pytest_cache/
9 changes: 6 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,14 @@ repos:
- flake8-comprehensions
- flake8-debugger
- flake8-isort
- flake8-pyproject
- flake8-string-format
- repo: https://github.com/psf/black
rev: 22.12.0
- repo: https://github.com/google/yapf
rev: v0.33.0
hooks:
- id: black
- id: yapf
args: [-i]
additional_dependencies: [toml]
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
Expand Down
2 changes: 1 addition & 1 deletion LICENCE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2020 AMYPAD
Copyright 2020-23 AMYPAD

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this project except in compliance with the License.
Expand Down
82 changes: 80 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,84 @@ build-backend = "setuptools.build_meta"
write_to = "spm12/_dist_ver.py"
write_to_template = "__version__ = '{version}'\n"

[tool.black]
target_version = ["py36", "py310"]
[tool.setuptools.packages.find]
exclude = ["tests"]

[tool.setuptools.package-data]
"*" = ["*.md", "*.rst", "*.m"]

[project.urls]
documentation = "https://github.com/AMYPAD/SPM12/#SPM12"
repository = "https://github.com/AMYPAD/SPM12"
changelog = "https://github.com/AMYPAD/SPM12/releases"
upstream-project = "https://www.fil.ion.ucl.ac.uk/spm"

[project]
name = "spm12"
dynamic = ["version"]
maintainers = [{name = "Casper da Costa-Luis", email = "casper.dcl@physics.org"}]
description = "Statistical Parametric Mapping"
readme = "README.rst"
requires-python = ">=3.7"
keywords = ["fMRI", "PET", "SPECT", "EEG", "MEG"]
license = {text = "Apache-2.0"}
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Intended Audience :: Education",
"Intended Audience :: Healthcare Industry",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: Apache Software License",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX :: Linux",
"Programming Language :: Other Scripting Engines",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3 :: Only",
"Topic :: Scientific/Engineering :: Medical Science Apps.",
"Topic :: Software Development :: Libraries",
"Topic :: System :: Installation/Setup"]
dependencies = ['importlib_resources; python_version < "3.9"', "argopt", "miutil[nii,web]>=0.12.0", "numpy", "scipy"]

[project.optional-dependencies]
dev = ["pytest>=6", "pytest-cov", "pytest-timeout", "pytest-xdist"]
demo = ["miutil[plot]>=0.3.0", "matplotlib"]

[project.scripts]
spm12 = "spm12.cli:main"

[tool.flake8]
max_line_length = 99
extend_ignore = ["E261"]
exclude = [".git", "__pycache__", "build", "dist", ".eggs"]

[tool.yapf]
spaces_before_comment = [15, 20]
arithmetic_precedence_indication = true
allow_split_before_dict_value = false
coalesce_brackets = true
column_limit = 99
each_dict_entry_on_separate_line = false
space_between_ending_comma_and_closing_bracket = false
split_before_named_assigns = false
split_before_closing_bracket = false
blank_line_before_nested_class_or_def = false

[tool.isort]
profile = "black"
line_length = 99
multi_line_output = 4
known_first_party = ["spm12", "tests"]

[tool.pytest.ini_options]
minversion = "6.0"
timeout = 300
log_level = "INFO"
python_files = ["tests/test_*.py"]
testpaths = ["tests"]
addopts = "-v --tb=short -rxs -W=error --log-level=debug -n=auto --durations=0 --durations-min=1 --cov=spm12 --cov-report=term-missing --cov-report=xml"
filterwarnings = ["ignore:numpy.ufunc size changed.*:RuntimeWarning"]
88 changes: 0 additions & 88 deletions setup.cfg

This file was deleted.

3 changes: 0 additions & 3 deletions setup.py

This file was deleted.

4 changes: 2 additions & 2 deletions spm12/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from .regseg import * # NOQA
from .utils import * # NOQA
from .regseg import * # NOQA, yapf: disable
from .utils import * # NOQA, yapf: disable

# version detector. Precedence: installed dist, git, 'UNKNOWN'
try:
Expand Down
2 changes: 1 addition & 1 deletion spm12/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@

from .cli import main

if __name__ == "__main__": # pragma: no cover
if __name__ == "__main__": # pragma: no cover
sys.exit(main(sys.argv[1:]))
4 changes: 3 additions & 1 deletion spm12/amypad_normw.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
job.subj.resample = flist4norm;
%job.woptions.bb = [NaN, NaN, NaN; NaN, NaN, NaN];
job.woptions.bb = bbox;
job.woptions.vox = [voxsz, voxsz, voxsz];
job.woptions.vox = voxsz; %[voxsz, voxsz, voxsz];
job.woptions.interp = intrp;
job.woptions.prefix = 'w';

addpath(fullfile(spm('Dir'),'config'));
spm_run_norm(job);
out=0;
end
2 changes: 1 addition & 1 deletion spm12/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ def main(argv=None):
logging.basicConfig(level=logging.DEBUG, format="%(levelname)s:%(funcName)s:%(message)s")
args = argopt(__doc__).parse_args(argv)
ensure_spm(cache=args.cache, version=args.spm_version)
print("SPM{v} is successfully installed".format(v=args.spm_version))
print(f"SPM{args.spm_version} is successfully installed")
return 0
Loading

0 comments on commit 686ef24

Please sign in to comment.