diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml deleted file mode 100644 index f039cb8..0000000 --- a/.github/workflows/pre-release.yml +++ /dev/null @@ -1,69 +0,0 @@ -name: Pre-release checks - -on: - push: - branches: - - main - pull_request: - branches: - - main - -defaults: - run: - shell: bash - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -permissions: - contents: read - -jobs: - pre-release: - # Check pre-releases of dependencies on stable Python - runs-on: ${{ matrix.os }} - continue-on-error: true - strategy: - matrix: - os: ['ubuntu-latest'] - python-version: ['3.10', '3.11', '3.12'] - install: ['pip'] - check: ['tests'] - pip-flags: ['PRE_PIP_FLAGS'] - env: - INSTALL_TYPE: ${{ matrix.install }} - CHECK_TYPE: ${{ matrix.check }} - EXTRA_PIP_FLAGS: ${{ matrix.pip-flags }} - OS_TYPE: ${{ matrix.os }} - - steps: - - uses: actions/checkout@v4 - with: - submodules: recursive - fetch-depth: 0 - - name: Install dependencies - run: .maint/ci/install_dependencies.sh - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - name: Display Python version - run: python -c "import sys; print(sys.version)" - - name: Create virtual environment - run: .maint/ci/create_venv.sh - - name: Build archive - run: | - source .maint/ci/build_archive.sh - echo "ARCHIVE=$ARCHIVE" >> $GITHUB_ENV - - name: Install fMRIPost-AROMA - run: .maint/ci/install.sh - - name: Install extras - run: .maint/ci/install_extras.sh - - name: Run tests - run: .maint/ci/check.sh - - uses: codecov/codecov-action@v4 - with: - file: coverage.xml - token: ${{ secrets.CODECOV_TOKEN }} - if: ${{ always() }} diff --git a/.github/workflows/stable.yml b/.github/workflows/test.yml similarity index 56% rename from .github/workflows/stable.yml rename to .github/workflows/test.yml index a9d5664..dc8966d 100644 --- a/.github/workflows/stable.yml +++ b/.github/workflows/test.yml @@ -1,21 +1,25 @@ -name: Stable tests +name: Tests on: push: branches: - main - maint/* - - next pull_request: branches: - main - maint/* - - next + # Allow job to be triggered manually from GitHub interface + workflow_dispatch: defaults: run: shell: bash +# Force tox and pytest to use color +env: + FORCE_COLOR: true + concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true @@ -31,42 +35,37 @@ jobs: matrix: os: ['ubuntu-latest'] python-version: ['3.10', '3.11', '3.12'] - install: ['pip'] - check: ['tests'] - pip-flags: [''] + dependencies: ['full', 'pre'] + include: + - os: ubuntu-latest + python-version: '3.10' + dependencies: 'min' + env: - INSTALL_TYPE: ${{ matrix.install }} - CHECK_TYPE: ${{ matrix.check }} - EXTRA_PIP_FLAGS: ${{ matrix.pip-flags }} - OS_TYPE: ${{ matrix.os }} + DEPENDS: ${{ matrix.dependencies }} steps: - uses: actions/checkout@v4 with: submodules: recursive fetch-depth: 0 - - name: Install dependencies - run: .maint/ci/install_dependencies.sh - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} + allow-prereleases: true - name: Display Python version run: python -c "import sys; print(sys.version)" - - name: Create virtual environment - run: .maint/ci/create_venv.sh - - name: Build archive + - name: Install tox run: | - source .maint/ci/build_archive.sh - echo "ARCHIVE=$ARCHIVE" >> $GITHUB_ENV - - name: Install fMRIPost-AROMA - run: .maint/ci/install.sh - - name: Install extras - run: .maint/ci/install_extras.sh - - name: Run tests - run: .maint/ci/check.sh + python -m pip install --upgrade pip + python -m pip install tox tox-gh-actions + - name: Show tox config + run: tox c + - name: Run tox + run: tox -v --exit-and-dump-after 1200 - uses: codecov/codecov-action@v4 + if: ${{ always() }} with: - file: coverage.xml + files: cov.xml token: ${{ secrets.CODECOV_TOKEN }} - if: ${{ always() }} diff --git a/docs/conf.py b/docs/conf.py index d81e650..65f2a1d 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -13,53 +13,55 @@ import os import sys -from packaging import version as pver # Avoid distutils.LooseVersion which is deprecated +from packaging import ( + version as pver, # Avoid distutils.LooseVersion which is deprecated +) from sphinx import __version__ as sphinxversion # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. -sys.path.append(os.path.abspath('sphinxext')) -sys.path.insert(0, os.path.abspath('../wrapper')) +sys.path.append(os.path.abspath("sphinxext")) +sys.path.insert(0, os.path.abspath("../wrapper")) from github_link import make_linkcode_resolve # noqa: E402 # -- General configuration ------------------------------------------------ # If your documentation needs a minimal Sphinx version, state it here. -needs_sphinx = '1.5.3' +needs_sphinx = "1.5.3" # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named "sphinx.ext.*") or your custom # ones. extensions = [ - 'sphinx.ext.autodoc', - 'sphinx.ext.doctest', - 'sphinx.ext.intersphinx', - 'sphinx.ext.coverage', - 'sphinx.ext.mathjax', - 'sphinx.ext.linkcode', - 'sphinx.ext.napoleon', - 'sphinxarg.ext', # argparse extension - 'nipype.sphinxext.plot_workflow', + "sphinx.ext.autodoc", + "sphinx.ext.doctest", + "sphinx.ext.intersphinx", + "sphinx.ext.coverage", + "sphinx.ext.mathjax", + "sphinx.ext.linkcode", + "sphinx.ext.napoleon", + "sphinxarg.ext", # argparse extension + "nipype.sphinxext.plot_workflow", ] # Mock modules in autodoc: autodoc_mock_imports = [ - 'numpy', - 'nitime', - 'matplotlib', + "numpy", + "nitime", + "matplotlib", ] -if pver.parse(sphinxversion) >= pver.parse('1.7.0'): +if pver.parse(sphinxversion) >= pver.parse("1.7.0"): autodoc_mock_imports += [ - 'pandas', - 'nilearn', - 'seaborn', + "pandas", + "nilearn", + "seaborn", ] # Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] +templates_path = ["_templates"] # Accept custom section names to be parsed for numpy-style docstrings # of parameters. @@ -67,41 +69,41 @@ # https://github.com/sphinx-contrib/napoleon/pull/10 is merged. napoleon_use_param = False napoleon_custom_sections = [ - ('Inputs', 'Parameters'), - ('Outputs', 'Parameters'), + ("Inputs", "Parameters"), + ("Outputs", "Parameters"), ] # The suffix(es) of source filenames. # You can specify multiple suffix as a list of string: # source_suffix = [".rst", ".md"] -source_suffix = '.rst' +source_suffix = ".rst" # The encoding of source files. # source_encoding = "utf-8-sig" # The master toctree document. -master_doc = 'index' +master_doc = "index" # General information about the project. -project = 'fMRIPost-AROMA' -author = 'The fMRIPost-AROMA developers' -copyright = f'2016-, {author}' +project = "fMRIPost-AROMA" +author = "The fMRIPost-AROMA developers" +copyright = f"2016-, {author}" # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. -version = 'version' +version = "version" # The full version, including alpha/beta/rc tags. -release = 'version' +release = "version" # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. # # This is also used if you do content translation via gettext catalogs. # Usually you set "language" from the command line for these cases. -language = 'en' +language = "en" # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: @@ -112,7 +114,7 @@ # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. # This patterns also effect to html_static_path and html_extra_path -exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] +exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] # The reST default role (used for this markup: `text`) to use for all # documents. @@ -130,7 +132,7 @@ # show_authors = False # The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'sphinx' +pygments_style = "sphinx" # A list of ignored prefixes for module index sorting. # modindex_common_prefix = [] @@ -146,7 +148,7 @@ # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. -html_theme = 'sphinx_rtd_theme' +html_theme = "sphinx_rtd_theme" # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the @@ -175,7 +177,7 @@ # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] +html_static_path = ["_static"] # Add any extra paths that contain custom files (such as robots.txt or # .htaccess) here, relative to this directory. These files are copied @@ -240,7 +242,7 @@ # html_search_scorer = 'scorer.js' # Output file base name for HTML help builder. -htmlhelp_basename = 'fmripost_aroma_doc' +htmlhelp_basename = "fmripost_aroma_doc" # -- Options for LaTeX output --------------------------------------------- @@ -259,7 +261,7 @@ # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ - (master_doc, 'fmripost_aroma.tex', 'fMRIPost-AROMA Documentation', author, 'manual'), + (master_doc, "fmripost_aroma.tex", "fMRIPost-AROMA Documentation", author, "manual"), ] # The name of an image file (relative to this directory) to place at the top of @@ -287,7 +289,7 @@ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). -man_pages = [(master_doc, 'fmripost-aroma', 'fMRIPost-AROMA Documentation', [author], 1)] +man_pages = [(master_doc, "fmripost-aroma", "fMRIPost-AROMA Documentation", [author], 1)] # If true, show URL addresses after external links. # man_show_urls = False @@ -301,12 +303,12 @@ texinfo_documents = [ ( master_doc, - 'fMRIPost-AROMA', - 'fMRIPost-AROMA Documentation', + "fMRIPost-AROMA", + "fMRIPost-AROMA Documentation", author, - 'fMRIPost-AROMA', - 'One line description of project.', - 'Miscellaneous', + "fMRIPost-AROMA", + "One line description of project.", + "Miscellaneous", ), ] @@ -324,31 +326,31 @@ # The following is used by sphinx.ext.linkcode to provide links to github linkcode_resolve = make_linkcode_resolve( - 'fmripost_aroma', - 'https://github.com/nipreps/fMRIPost-AROMA/blob/{revision}/{package}/{path}#L{lineno}', + "fmripost_aroma", + "https://github.com/nipreps/fMRIPost-AROMA/blob/{revision}/{package}/{path}#L{lineno}", ) # Example configuration for intersphinx: refer to the Python standard library. intersphinx_mapping = { - 'python': ('https://docs.python.org/3/', None), - 'numpy': ('https://numpy.org/doc/stable/', None), - 'scipy': ('https://docs.scipy.org/doc/scipy/', None), - 'matplotlib': ('https://matplotlib.org/stable/', None), - 'bids': ('https://bids-standard.github.io/pybids/', None), - 'nibabel': ('https://nipy.org/nibabel/', None), - 'nipype': ('https://nipype.readthedocs.io/en/latest/', None), - 'niworkflows': ('https://www.nipreps.org/niworkflows/', None), - 'fmriprep': ('https://fmriprep.org/en/stable/', None), - 'sdcflows': ('https://www.nipreps.org/sdcflows/', None), - 'smriprep': ('https://www.nipreps.org/smriprep/', None), - 'templateflow': ('https://www.templateflow.org/python-client', None), - 'tedana': ('https://tedana.readthedocs.io/en/latest/', None), + "python": ("https://docs.python.org/3/", None), + "numpy": ("https://numpy.org/doc/stable/", None), + "scipy": ("https://docs.scipy.org/doc/scipy/", None), + "matplotlib": ("https://matplotlib.org/stable/", None), + "bids": ("https://bids-standard.github.io/pybids/", None), + "nibabel": ("https://nipy.org/nibabel/", None), + "nipype": ("https://nipype.readthedocs.io/en/latest/", None), + "niworkflows": ("https://www.nipreps.org/niworkflows/", None), + "fmriprep": ("https://fmriprep.org/en/stable/", None), + "sdcflows": ("https://www.nipreps.org/sdcflows/", None), + "smriprep": ("https://www.nipreps.org/smriprep/", None), + "templateflow": ("https://www.templateflow.org/python-client", None), + "tedana": ("https://tedana.readthedocs.io/en/latest/", None), } -suppress_warnings = ['image.nonlocal_uri'] +suppress_warnings = ["image.nonlocal_uri"] def setup(app): - app.add_css_file('theme_overrides.css') + app.add_css_file("theme_overrides.css") # We need this for the boilerplate script - app.add_js_file('https://cdn.rawgit.com/chrisfilo/zenodo.js/v0.1/zenodo.js') + app.add_js_file("https://cdn.rawgit.com/chrisfilo/zenodo.js/v0.1/zenodo.js") diff --git a/docs/sphinxext/github_link.py b/docs/sphinxext/github_link.py index fabba0a..5dc699a 100644 --- a/docs/sphinxext/github_link.py +++ b/docs/sphinxext/github_link.py @@ -10,16 +10,16 @@ from functools import partial from operator import attrgetter -REVISION_CMD = 'git rev-parse --short HEAD' +REVISION_CMD = "git rev-parse --short HEAD" def _get_git_revision(): try: revision = subprocess.check_output(REVISION_CMD.split()).strip() except (subprocess.CalledProcessError, OSError): - print('Failed to execute git to get revision') + print("Failed to execute git to get revision") return None - return revision.decode('utf-8') + return revision.decode("utf-8") def _linkcode_resolve(domain, info, package, url_fmt, revision): @@ -39,14 +39,14 @@ def _linkcode_resolve(domain, info, package, url_fmt, revision): if revision is None: return - if domain not in ('py', 'pyx'): + if domain not in ("py", "pyx"): return - if not info.get('module') or not info.get('fullname'): + if not info.get("module") or not info.get("fullname"): return - class_name = info['fullname'].split('.')[0] - module = __import__(info['module'], fromlist=[class_name]) - obj = attrgetter(info['fullname'])(module) + class_name = info["fullname"].split(".")[0] + module = __import__(info["module"], fromlist=[class_name]) + obj = attrgetter(info["fullname"])(module) # Unwrap the object to get the correct source # file in case that is wrapped by a decorator @@ -68,7 +68,7 @@ def _linkcode_resolve(domain, info, package, url_fmt, revision): try: lineno = inspect.getsourcelines(obj)[1] except Exception: - lineno = '' + lineno = "" return url_fmt.format(revision=revision, package=package, path=fn, lineno=lineno) diff --git a/pyproject.toml b/pyproject.toml index b8e87ac..0065a39 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,6 +29,14 @@ dependencies = [ ] dynamic = ["version"] +[project.optional-dependencies] +test = [ + "coverage", + "pytest", + "pytest-cov", + "pytest-env", +] + [project.urls] Documentation = "https://github.com/nipreps/fmripost-aroma#readme" Issues = "https://github.com/nipreps/fmripost-aroma/issues" diff --git a/scripts/fetch_templates.py b/scripts/fetch_templates.py index 04881d6..11b1ac0 100755 --- a/scripts/fetch_templates.py +++ b/scripts/fetch_templates.py @@ -23,13 +23,13 @@ def fetch_MNI2009(): tpl-MNI152NLin2009cAsym/tpl-MNI152NLin2009cAsym_res-02_desc-fMRIPrep_boldref.nii.gz tpl-MNI152NLin2009cAsym/tpl-MNI152NLin2009cAsym_res-01_label-brain_probseg.nii.gz """ - template = 'MNI152NLin2009cAsym' + template = "MNI152NLin2009cAsym" - tf.get(template, resolution=(1, 2), desc=None, suffix='T1w') - tf.get(template, resolution=(1, 2), desc='brain', suffix='mask') - tf.get(template, resolution=1, atlas=None, desc='carpet', suffix='dseg') - tf.get(template, resolution=2, desc='fMRIPrep', suffix='boldref') - tf.get(template, resolution=1, label='brain', suffix='probseg') + tf.get(template, resolution=(1, 2), desc=None, suffix="T1w") + tf.get(template, resolution=(1, 2), desc="brain", suffix="mask") + tf.get(template, resolution=1, atlas=None, desc="carpet", suffix="dseg") + tf.get(template, resolution=2, desc="fMRIPrep", suffix="boldref") + tf.get(template, resolution=1, label="brain", suffix="probseg") def fetch_MNI6(): @@ -42,12 +42,12 @@ def fetch_MNI6(): tpl-MNI152NLin6Asym/tpl-MNI152NLin6Asym_res-02_desc-brain_mask.nii.gz tpl-MNI152NLin6Asym/tpl-MNI152NLin6Asym_res-02_atlas-HCP_dseg.nii.gz """ - template = 'MNI152NLin6Asym' + template = "MNI152NLin6Asym" - tf.get(template, resolution=(1, 2), desc=None, suffix='T1w') - tf.get(template, resolution=(1, 2), desc='brain', suffix='mask') + tf.get(template, resolution=(1, 2), desc=None, suffix="T1w") + tf.get(template, resolution=(1, 2), desc="brain", suffix="mask") # CIFTI - tf.get(template, resolution=2, atlas='HCP', suffix='dseg') + tf.get(template, resolution=2, atlas="HCP", suffix="dseg") def fetch_OASIS(): @@ -61,14 +61,14 @@ def fetch_OASIS(): tpl-OASIS30ANTs/tpl-OASIS30ANTs_res-01_desc-brain_mask.nii.gz tpl-OASIS30ANTs/tpl-OASIS30ANTs_res-01_desc-BrainCerebellumExtraction_mask.nii.gz """ - template = 'OASIS30ANTs' + template = "OASIS30ANTs" - tf.get(template, resolution=1, desc=None, label=None, suffix='T1w') - tf.get(template, resolution=1, label='WM', suffix='probseg') - tf.get(template, resolution=1, label='BS', suffix='probseg') - tf.get(template, resolution=1, label='brain', suffix='probseg') - tf.get(template, resolution=1, label='brain', suffix='mask') - tf.get(template, resolution=1, desc='BrainCerebellumExtraction', suffix='mask') + tf.get(template, resolution=1, desc=None, label=None, suffix="T1w") + tf.get(template, resolution=1, label="WM", suffix="probseg") + tf.get(template, resolution=1, label="BS", suffix="probseg") + tf.get(template, resolution=1, label="brain", suffix="probseg") + tf.get(template, resolution=1, label="brain", suffix="mask") + tf.get(template, resolution=1, desc="BrainCerebellumExtraction", suffix="mask") def fetch_fsaverage(): @@ -84,11 +84,11 @@ def fetch_fsaverage(): tpl-fsaverage/tpl-fsaverage_hemi-L_den-164k_sulc.shape.gii tpl-fsaverage/tpl-sfaverage_hemi-R_den-164k_sulc.shape.gii """ - template = 'fsaverage' + template = "fsaverage" - tf.get(template, density='164k', desc='std', suffix='sphere') - tf.get(template, density='164k', suffix='midthickness') - tf.get(template, density='164k', suffix='sulc') + tf.get(template, density="164k", desc="std", suffix="sphere") + tf.get(template, density="164k", suffix="midthickness") + tf.get(template, density="164k", suffix="sulc") def fetch_fsLR(): @@ -104,7 +104,7 @@ def fetch_fsLR(): tpl-fsLR/tpl-fsLR_space-fsaverage_hemi-L_den-32k_sphere.surf.gii tpl-fsLR/tpl-fsLR_space-fsaverage_hemi-R_den-32k_sphere.surf.gii """ - tf.get('fsLR', density='32k') + tf.get("fsLR", density="32k") def fetch_all(): @@ -115,21 +115,21 @@ def fetch_all(): # fetch_fsLR() -if __name__ == '__main__': +if __name__ == "__main__": parser = argparse.ArgumentParser( - description='Helper script for pre-caching required templates to run fMRIPost-AROMA', + description="Helper script for pre-caching required templates to run fMRIPost-AROMA", ) parser.add_argument( - '--tf-dir', + "--tf-dir", type=os.path.abspath, - help='Directory to save templates in. If not provided, templates will be saved to' - ' `${HOME}/.cache/templateflow`.', + help="Directory to save templates in. If not provided, templates will be saved to" + " `${HOME}/.cache/templateflow`.", ) opts = parser.parse_args() # set envvar (if necessary) prior to templateflow import if opts.tf_dir is not None: - os.environ['TEMPLATEFLOW_HOME'] = opts.tf_dir + os.environ["TEMPLATEFLOW_HOME"] = opts.tf_dir import templateflow.api as tf diff --git a/src/fmripost_aroma/__init__.py b/src/fmripost_aroma/__init__.py index 2afc7fe..d34bde0 100644 --- a/src/fmripost_aroma/__init__.py +++ b/src/fmripost_aroma/__init__.py @@ -25,4 +25,4 @@ try: from ._version import __version__ except ImportError: - __version__ = '0+unknown' + __version__ = "0+unknown" diff --git a/src/fmripost_aroma/cli/parser.py b/src/fmripost_aroma/cli/parser.py index 0a53310..28cade6 100644 --- a/src/fmripost_aroma/cli/parser.py +++ b/src/fmripost_aroma/cli/parser.py @@ -21,6 +21,7 @@ # https://www.nipreps.org/community/licensing/ # """Parser.""" + import sys from fmripost_aroma import config @@ -31,6 +32,7 @@ def _build_parser(**kwargs): ``kwargs`` are passed to ``argparse.ArgumentParser`` (mainly useful for debugging). """ + from argparse import Action, ArgumentDefaultsHelpFormatter, ArgumentParser from functools import partial from pathlib import Path @@ -45,14 +47,14 @@ def __call__(self, parser, namespace, values, option_string=None): d = {} for spec in values: try: - name, loc = spec.split('=') + name, loc = spec.split("=") loc = Path(loc) except ValueError: loc = Path(spec) name = loc.name if name in d: - raise ValueError(f'Received duplicate derivative name: {name}') + raise ValueError(f"Received duplicate derivative name: {name}") d[name] = loc setattr(namespace, self.dest, d) @@ -189,16 +191,16 @@ def _bids_filter(value, parser): ), ) g_bids.add_argument( - '-d', - '--derivatives', + "-d", + "--derivatives", action=ToDict, - metavar='PACKAGE=PATH', + metavar="PACKAGE=PATH", type=str, - nargs='+', + nargs="+", help=( - 'Search PATH(s) for pre-computed derivatives. ' - 'These may be provided as named folders ' - '(e.g., `--derivatives smriprep=/path/to/smriprep`).' + "Search PATH(s) for pre-computed derivatives. " + "These may be provided as named folders " + "(e.g., `--derivatives smriprep=/path/to/smriprep`)." ), ) g_bids.add_argument( @@ -292,8 +294,8 @@ def _bids_filter(value, parser): ), ) g_conf.add_argument( - '--output-spaces', - nargs='*', + "--output-spaces", + nargs="*", action=OutputReferencesAction, help="""\ Standard and non-standard spaces to resample denoised functional images to. \ @@ -304,7 +306,7 @@ def _bids_filter(value, parser): Non-standard spaces imply specific orientations and sampling grids. \ For further details, please check out \ https://fmriprep.readthedocs.io/en/%s/spaces.html""" - % (currentv.base_version if is_release else 'latest'), + % (currentv.base_version if is_release else "latest"), ) g_conf.add_argument( "--dummy-scans", @@ -464,6 +466,7 @@ def _bids_filter(value, parser): def parse_args(args=None, namespace=None): """Parse args and run further checks on the command line.""" + import logging parser = _build_parser() diff --git a/src/fmripost_aroma/cli/run.py b/src/fmripost_aroma/cli/run.py index 7c4112e..ebeaeb9 100644 --- a/src/fmripost_aroma/cli/run.py +++ b/src/fmripost_aroma/cli/run.py @@ -22,6 +22,7 @@ # https://www.nipreps.org/community/licensing/ # """fMRI preprocessing workflow.""" + from fmripost_aroma import config EXITCODE: int = -1 @@ -29,6 +30,7 @@ def main(): """Entry point.""" + import gc import sys from multiprocessing import Manager, Process @@ -140,7 +142,9 @@ def main(): config.loggers.workflow.log( 15, - "\n".join(["fMRIPost-AROMA config:"] + ["\t\t%s" % s for s in config.dumps().splitlines()]), + "\n".join( + ["fMRIPost-AROMA config:"] + ["\t\t%s" % s for s in config.dumps().splitlines()] + ), ) config.loggers.workflow.log(25, "fMRIPost-AROMA started!") errno = 1 # Default is error exit unless otherwise set @@ -151,7 +155,10 @@ def main(): from fmripost_aroma.utils.telemetry import process_crashfile crashfolders = [ - config.execution.fmripost_aroma_dir / f"sub-{s}" / "log" / config.execution.run_uuid + config.execution.fmripost_aroma_dir + / f"sub-{s}" + / "log" + / config.execution.run_uuid for s in config.execution.participant_label ] for crashfolder in crashfolders: @@ -195,7 +202,9 @@ def main(): dseg_tsv = str(api.get("fsaverage", suffix="dseg", extension=[".tsv"])) _copy_any(dseg_tsv, str(config.execution.fmripost_aroma_dir / "desc-aseg_dseg.tsv")) - _copy_any(dseg_tsv, str(config.execution.fmripost_aroma_dir / "desc-aparcaseg_dseg.tsv")) + _copy_any( + dseg_tsv, str(config.execution.fmripost_aroma_dir / "desc-aparcaseg_dseg.tsv") + ) errno = 0 finally: from pkg_resources import resource_filename as pkgrf @@ -217,7 +226,9 @@ def main(): config=pkgrf("fmripost_aroma", "data/reports-spec.yml"), packagename="fmripost_aroma", ) - write_derivative_description(config.execution.bids_dir, config.execution.fmripost_aroma_dir) + write_derivative_description( + config.execution.bids_dir, config.execution.fmripost_aroma_dir + ) write_bidsignore(config.execution.fmripost_aroma_dir) if sentry_sdk is not None and failed_reports: diff --git a/src/fmripost_aroma/config.py b/src/fmripost_aroma/config.py index eae2ac3..8615933 100644 --- a/src/fmripost_aroma/config.py +++ b/src/fmripost_aroma/config.py @@ -87,6 +87,7 @@ :py:class:`~bids.layout.BIDSLayout`, etc.) """ + import os from multiprocessing import set_start_method diff --git a/src/fmripost_aroma/data/__init__.py b/src/fmripost_aroma/data/__init__.py index 9fea898..7cb3508 100644 --- a/src/fmripost_aroma/data/__init__.py +++ b/src/fmripost_aroma/data/__init__.py @@ -10,6 +10,7 @@ .. autoclass:: Loader """ + from __future__ import annotations import atexit diff --git a/src/fmripost_aroma/interfaces/reportlets.py b/src/fmripost_aroma/interfaces/reportlets.py index 5a9fb07..b6207c8 100644 --- a/src/fmripost_aroma/interfaces/reportlets.py +++ b/src/fmripost_aroma/interfaces/reportlets.py @@ -44,7 +44,6 @@ from niworkflows import NIWORKFLOWS_LOG from smriprep.interfaces.freesurfer import ReconAll - SUBJECT_TEMPLATE = """\ \t