diff --git a/.all-contributorsrc b/.all-contributorsrc index 1cbba90..5a3c0e4 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -27,6 +27,16 @@ "test", "maintenance" ] + }, + { + "login": "yyang1234", + "name": "Ying Yang", + "avatar_url": "https://avatars.githubusercontent.com/u/59220868?v=4", + "profile": "https://github.com/yyang1234", + "contributions": [ + "bug", + "userTesting" + ] } ], "contributorsPerLine": 7, @@ -34,5 +44,7 @@ "projectOwner": "cpp-lln-lab", "repoType": "github", "repoHost": "https://github.com", - "skipCi": true + "skipCi": true, + "commitType": "docs", + "commitConvention": "angular" } diff --git a/.circleci/config.yml b/.circleci/config.yml index 80344b9..d0f234d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -121,12 +121,13 @@ jobs: user_name=cpplab repo_name=$(echo "${CIRCLE_PROJECT_REPONAME}" | tr '[:upper:]' '[:lower:]') if [[ -n "${DOCKER_TOKEN}" ]]; then - echo "${DOCKER_TOKEN}" | docker login -u "${DOCKER_USER}" --password-stdin + echo "${DOCKER_TOKEN}" | docker login -u remigau --password-stdin : "Pushing to DockerHub ${user_name}/${repo_name}:unstable" docker tag "${user_name}/${repo_name}" "${user_name}/${repo_name}:unstable" docker push "${user_name}/${repo_name}:unstable" if [[ -n "${CIRCLE_TAG}" ]]; then : "Pushing to DockerHub ${user_name}/${repo_name}:${CIRCLE_TAG}" + docker tag "${user_name}/${repo_name}" "${user_name}/${repo_name}:latest" docker push "${user_name}/${repo_name}:latest" docker tag "${user_name}/${repo_name}" "${user_name}/${repo_name}:${CIRCLE_TAG}" docker push "${user_name}/${repo_name}:${CIRCLE_TAG}" @@ -141,21 +142,16 @@ workflows: build-test-deploy: jobs: - build - - get_data - test: requires: - build - get_data - - deploy: context: - DOCKER_HUB requires: - test - filters: - tags: - only: /.*/ diff --git a/.github/workflows/docker_build.yml b/.github/workflows/docker_build.yml index 02868da..7642824 100644 --- a/.github/workflows/docker_build.yml +++ b/.github/workflows/docker_build.yml @@ -13,6 +13,6 @@ jobs: docker_build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Build the Docker image run: make docker_build diff --git a/.github/workflows/new_issue.yml b/.github/workflows/new_issue.yml index 0f6a767..80c81ea 100644 --- a/.github/workflows/new_issue.yml +++ b/.github/workflows/new_issue.yml @@ -9,7 +9,7 @@ jobs: permissions: issues: write steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: ref: main - name: Install FAQtory @@ -22,7 +22,7 @@ jobs: with: path: ./suggest.md - name: Suggest FAQ - uses: peter-evans/create-or-update-comment@c6c9a1a66007646a28c153e2a8580a5bad27bcfa + uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 with: issue-number: ${{ github.event.issue.number }} body: ${{ steps.suggest.outputs.content }} diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index d8241f0..4429ffc 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -26,13 +26,13 @@ jobs: steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: recursive fetch-depth: 0 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} diff --git a/.github/workflows/system_tests.yml b/.github/workflows/system_tests.yml index 7510676..b445a93 100644 --- a/.github/workflows/system_tests.yml +++ b/.github/workflows/system_tests.yml @@ -24,10 +24,10 @@ jobs: steps: - name: Clone repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} diff --git a/.github/workflows/test_and_coverage.yml b/.github/workflows/test_and_coverage.yml index d41f4d9..b804dbb 100644 --- a/.github/workflows/test_and_coverage.yml +++ b/.github/workflows/test_and_coverage.yml @@ -18,7 +18,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, macOS-latest] # windows-latest: do not work. antspyx is not available for windows - python-version: ['3.8', '3.9', '3.10', '3.11'] + python-version: ['3.9', '3.10', '3.11'] exclude: - os: macOS-latest # anstpyx install is messed up with macOS and python 3.9 python-version: '3.9' @@ -27,10 +27,10 @@ jobs: steps: - name: Clone repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} @@ -43,7 +43,7 @@ jobs: run: pytest --cov bidsmreye --cov-report=xml - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 with: file: ./coverage.xml flags: tests diff --git a/.github/workflows/validate_cff.yml b/.github/workflows/validate_cff.yml index 3d21f31..3898a2e 100644 --- a/.github/workflows/validate_cff.yml +++ b/.github/workflows/validate_cff.yml @@ -18,7 +18,7 @@ jobs: validate_cff: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Check whether the citation metadata from CITATION.cff is valid uses: citation-file-format/cffconvert-github-action@2.0.0 with: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ff91648..bb51f29 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,7 +3,7 @@ # See https://pre-commit.com/hooks.html for more hooks repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v4.6.0 hooks: - id: end-of-file-fixer - id: check-added-large-files @@ -20,8 +20,14 @@ repos: - id: yamlfmt args: [--mapping, '4', --sequence, '4', --offset, '0'] +- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks + rev: v2.14.0 + hooks: + - id: pretty-format-toml + args: [--autofix, --indent, '4'] + - repo: https://github.com/asottile/pyupgrade - rev: v3.10.1 + rev: v3.17.0 hooks: - id: pyupgrade args: [--py38-plus] @@ -31,20 +37,32 @@ repos: hooks: - id: flynt -- repo: https://github.com/asottile/reorder-python-imports - rev: v3.10.0 +- repo: https://github.com/seddonym/import-linter + rev: v2.0 + hooks: + - id: import-linter + +- repo: https://github.com/pycqa/isort + rev: 5.13.2 hooks: - - id: reorder-python-imports - args: [--py37-plus, --add-import, from __future__ import annotations] + - id: isort + args: [--profile, black] -- repo: https://github.com/psf/black - rev: 23.9.1 +- repo: https://github.com/adamchainz/blacken-docs + rev: 1.18.0 + hooks: + - id: blacken-docs + additional_dependencies: + - black==24.2.0 + +- repo: https://github.com/psf/black-pre-commit-mirror + rev: 24.4.2 hooks: - id: black args: [--config=pyproject.toml, --verbose] - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.5.1 + rev: v1.11.0 hooks: - id: mypy additional_dependencies: [types-all, pydantic] @@ -52,21 +70,25 @@ repos: args: [--config-file, pyproject.toml] - repo: https://github.com/codespell-project/codespell - rev: v2.2.5 + rev: v2.3.0 hooks: - id: codespell args: [--toml=pyproject.toml] additional_dependencies: [tomli] - repo: https://github.com/jendrikseipp/vulture - rev: v2.9.1 + rev: v2.11 hooks: - id: vulture - repo: https://github.com/pycqa/flake8 - rev: 6.1.0 + rev: 7.1.0 hooks: - id: flake8 exclude: tests_.*.py|version.*.py|setup.py # ignore tests and versioneer related code args: [--verbose] additional_dependencies: [flake8-docstrings] + + +ci: + autoupdate_commit_msg: 'chore: update pre-commit hooks' diff --git a/.readthedocs.yml b/.readthedocs.yml index 2cdf987..feed142 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -6,6 +6,11 @@ # Required version: 2 +build: + os: ubuntu-22.04 + tools: + python: '3.11' + # Build documentation in the docs/ directory with Sphinx sphinx: configuration: docs/source/conf.py @@ -14,7 +19,6 @@ sphinx: # Optionally set the version of Python and requirements required to build your docs python: - version: '3.8' install: - method: pip path: . diff --git a/CITATION.cff b/CITATION.cff index 6ea6c99..4595ba9 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -20,8 +20,8 @@ identifiers: value: "10.5281/zenodo.7493322" contact: - - affiliation: "Université catholique de Louvain" - email: remi.gau@uclouvain.be + - affiliation: "McGill university" + email: remi.gau2@mcgill.ca family-names: Gau given-names: Rémi @@ -29,11 +29,16 @@ authors: - family-names: "Gau" given-names: "Rémi" orcid: "https://orcid.org/0000-0002-1535-9767" - affiliation: "Université catholique de Louvain" + affiliation: "McGill university" - family-names: "Cabee" given-names: "Pauline" + - family-names: "Yang" + given-names: "Ying" + orcid: "https://orcid.org/0000-0002-4157-2975" + affiliation: "Université catholique de Louvain" + license: GPL-3.0 keywords: diff --git a/Makefile b/Makefile index b781d61..63c6891 100644 --- a/Makefile +++ b/Makefile @@ -69,8 +69,8 @@ dist: clean ## builds source and wheel package clean-models: ## remove pretrained models rm -fr models/ -models: ## gets all pretrained models from OSF - bidsmreye_model --model_name all +models: + bidsmreye_model --model_name 1to6 models/dataset1_guided_fixations.h5: bidsmreye_model models/dataset2_pursuit.h5: diff --git a/README.md b/README.md index 114bc4d..5f2bf15 100644 --- a/README.md +++ b/README.md @@ -212,10 +212,13 @@ Thanks goes to these wonderful people - - - - + + + + + + +

Pauline Cabee

💻 🤔 🚇

Remi Gau

💻 🤔 ⚠️ 🚧
Pauline Cabee
Pauline Cabee

💻 🤔 🚇
Remi Gau
Remi Gau

💻 🤔 ⚠️ 🚧
Ying Yang
Ying Yang

🐛 📓
diff --git a/bidsmreye/__init__.py b/bidsmreye/__init__.py index a47f02a..48f5608 100644 --- a/bidsmreye/__init__.py +++ b/bidsmreye/__init__.py @@ -1,2 +1,3 @@ """Bidsmreye package.""" + from __future__ import annotations diff --git a/bidsmreye/bids_utils.py b/bidsmreye/bids_utils.py index fa27d0f..0671516 100644 --- a/bidsmreye/bids_utils.py +++ b/bidsmreye/bids_utils.py @@ -8,15 +8,16 @@ from bids import BIDSLayout # type: ignore from bidsmreye._version import __version__ -from bidsmreye.configuration import Config -from bidsmreye.configuration import config_to_dict -from bidsmreye.configuration import get_bids_filter_config -from bidsmreye.configuration import get_bidsname_config -from bidsmreye.configuration import get_pybids_config +from bidsmreye.configuration import ( + Config, + config_to_dict, + get_bids_filter_config, + get_bidsname_config, + get_pybids_config, +) from bidsmreye.logging import bidsmreye_log from bidsmreye.methods import methods -from bidsmreye.utils import copy_license -from bidsmreye.utils import create_dir_if_absent +from bidsmreye.utils import copy_license, create_dir_if_absent log = bidsmreye_log("bidsmreye") diff --git a/bidsmreye/bidsmreye.py b/bidsmreye/bidsmreye.py index 1b0fd99..6610cea 100755 --- a/bidsmreye/bidsmreye.py +++ b/bidsmreye/bidsmreye.py @@ -6,18 +6,19 @@ import json import sys from pathlib import Path -from typing import Any -from typing import IO +from typing import IO, Any import rich from bidsmreye._version import __version__ from bidsmreye.configuration import Config -from bidsmreye.defaults import allowed_actions -from bidsmreye.defaults import available_models -from bidsmreye.defaults import default_log_level -from bidsmreye.defaults import default_model -from bidsmreye.defaults import log_levels +from bidsmreye.defaults import ( + allowed_actions, + available_models, + default_log_level, + default_model, + log_levels, +) from bidsmreye.download import download from bidsmreye.generalize import generalize from bidsmreye.logging import bidsmreye_log diff --git a/bidsmreye/configuration.py b/bidsmreye/configuration.py index 708c0db..5454da2 100644 --- a/bidsmreye/configuration.py +++ b/bidsmreye/configuration.py @@ -6,10 +6,7 @@ from pathlib import Path from typing import Any -from attrs import asdict -from attrs import converters -from attrs import define -from attrs import field +from attrs import asdict, converters, define, field from bids import BIDSLayout # type: ignore from bidsmreye.logging import bidsmreye_log diff --git a/bidsmreye/defaults.py b/bidsmreye/defaults.py index 4388761..913cd4e 100644 --- a/bidsmreye/defaults.py +++ b/bidsmreye/defaults.py @@ -1,4 +1,5 @@ """Store defaults.""" + from __future__ import annotations diff --git a/bidsmreye/download.py b/bidsmreye/download.py index ccd1b3b..617a47c 100644 --- a/bidsmreye/download.py +++ b/bidsmreye/download.py @@ -1,19 +1,19 @@ """Download the models from OSF.""" + from __future__ import annotations import argparse import sys import warnings +from importlib import resources from pathlib import Path -from typing import Any -from typing import IO +from typing import IO, Any -import pkg_resources import pooch import rich -from bidsmreye.defaults import available_models -from bidsmreye.defaults import default_model +import bidsmreye +from bidsmreye.defaults import available_models, default_model from bidsmreye.logging import bidsmreye_log log = bidsmreye_log(name="bidsmreye") @@ -99,8 +99,9 @@ def download( base_url="https://osf.io/download/", registry=None, ) - registry_file = pkg_resources.resource_stream("bidsmreye", "models/registry.txt") - POOCH.load_registry(registry_file) + source = resources.files(bidsmreye).joinpath("models/registry.txt") + with resources.as_file(source) as registry_file: + POOCH.load_registry(registry_file) output_file = output_dir.joinpath(f"dataset_{model_name}") diff --git a/bidsmreye/generalize.py b/bidsmreye/generalize.py index a1fcdf3..dfe52bb 100644 --- a/bidsmreye/generalize.py +++ b/bidsmreye/generalize.py @@ -1,4 +1,5 @@ """TODO.""" + from __future__ import annotations import logging @@ -10,24 +11,26 @@ import numpy as np import pandas as pd from bids import BIDSLayout # type: ignore -from deepmreye import analyse -from deepmreye import train -from deepmreye.util import data_generator -from deepmreye.util import model_opts +from deepmreye import analyse, train +from deepmreye.util import data_generator, model_opts from rich import print -from bidsmreye.bids_utils import check_layout -from bidsmreye.bids_utils import create_bidsname -from bidsmreye.bids_utils import get_dataset_layout -from bidsmreye.bids_utils import list_subjects +from bidsmreye.bids_utils import ( + check_layout, + create_bidsname, + get_dataset_layout, + list_subjects, +) from bidsmreye.configuration import Config from bidsmreye.logging import bidsmreye_log from bidsmreye.quality_control import quality_control_output -from bidsmreye.utils import add_sidecar_in_root -from bidsmreye.utils import check_if_file_found -from bidsmreye.utils import create_dir_for_file -from bidsmreye.utils import move_file -from bidsmreye.utils import set_this_filter +from bidsmreye.utils import ( + add_sidecar_in_root, + check_if_file_found, + create_dir_for_file, + move_file, + set_this_filter, +) log = bidsmreye_log(name="bidsmreye") diff --git a/bidsmreye/methods.py b/bidsmreye/methods.py index 8b46ebc..a5a264e 100644 --- a/bidsmreye/methods.py +++ b/bidsmreye/methods.py @@ -1,4 +1,5 @@ """Write method section.""" + from __future__ import annotations import shutil @@ -8,8 +9,7 @@ import chevron from bidsmreye._version import __version__ -from bidsmreye.defaults import available_models -from bidsmreye.defaults import default_model +from bidsmreye.defaults import available_models, default_model from bidsmreye.utils import create_dir_for_file diff --git a/bidsmreye/prepare_data.py b/bidsmreye/prepare_data.py index 74870a2..452c54d 100644 --- a/bidsmreye/prepare_data.py +++ b/bidsmreye/prepare_data.py @@ -1,4 +1,5 @@ """Run coregistration and extract data.""" + from __future__ import annotations import pickle @@ -9,18 +10,22 @@ from bids import BIDSLayout # type: ignore from deepmreye import preprocess -from bidsmreye.bids_utils import check_layout -from bidsmreye.bids_utils import create_bidsname -from bidsmreye.bids_utils import get_dataset_layout -from bidsmreye.bids_utils import init_dataset -from bidsmreye.bids_utils import list_subjects -from bidsmreye.bids_utils import save_sampling_frequency_to_json +from bidsmreye.bids_utils import ( + check_layout, + create_bidsname, + get_dataset_layout, + init_dataset, + list_subjects, + save_sampling_frequency_to_json, +) from bidsmreye.configuration import Config from bidsmreye.logging import bidsmreye_log -from bidsmreye.utils import check_if_file_found -from bidsmreye.utils import get_deepmreye_filename -from bidsmreye.utils import move_file -from bidsmreye.utils import set_this_filter +from bidsmreye.utils import ( + check_if_file_found, + get_deepmreye_filename, + move_file, + set_this_filter, +) log = bidsmreye_log(name="bidsmreye") diff --git a/bidsmreye/quality_control.py b/bidsmreye/quality_control.py index 7bba678..de0d7af 100644 --- a/bidsmreye/quality_control.py +++ b/bidsmreye/quality_control.py @@ -1,4 +1,5 @@ """TODO.""" + from __future__ import annotations import json @@ -11,16 +12,16 @@ from bids import BIDSLayout # type: ignore from scipy.stats.distributions import chi2 -from bidsmreye.bids_utils import check_layout -from bidsmreye.bids_utils import create_bidsname -from bidsmreye.bids_utils import get_dataset_layout -from bidsmreye.bids_utils import init_dataset -from bidsmreye.bids_utils import list_subjects +from bidsmreye.bids_utils import ( + check_layout, + create_bidsname, + get_dataset_layout, + init_dataset, + list_subjects, +) from bidsmreye.configuration import Config from bidsmreye.logging import bidsmreye_log -from bidsmreye.utils import check_if_file_found -from bidsmreye.utils import create_dir_for_file -from bidsmreye.utils import set_this_filter +from bidsmreye.utils import check_if_file_found, create_dir_for_file, set_this_filter from bidsmreye.visualize import visualize_eye_gaze_data log = bidsmreye_log("bidsmreye") diff --git a/bidsmreye/visualize.py b/bidsmreye/visualize.py index b6f38e2..cd61000 100644 --- a/bidsmreye/visualize.py +++ b/bidsmreye/visualize.py @@ -11,13 +11,10 @@ from plotly.subplots import make_subplots from bidsmreye._version import __version__ -from bidsmreye.bids_utils import get_dataset_layout -from bidsmreye.bids_utils import list_subjects +from bidsmreye.bids_utils import get_dataset_layout, list_subjects from bidsmreye.configuration import Config from bidsmreye.logging import bidsmreye_log -from bidsmreye.utils import check_if_file_found -from bidsmreye.utils import set_this_filter - +from bidsmreye.utils import check_if_file_found, set_this_filter LINE_WIDTH = 3 FONT_SIZE = dict(size=14) diff --git a/pyproject.toml b/pyproject.toml index 1320c12..361ed35 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,50 +3,51 @@ build-backend = "hatchling.build" requires = ["hatchling", "hatch-vcs"] [project] -name = "bidsmreye" -description = "bids app using deepMReye to decode eye motion for fMRI time series data" -readme = "README.md" -requires-python = ">=3.8.0" -license = { file="LICENSE" } authors = [ - { name = "Remi Gau", email = "remi.gau@gmail.com" }, + {name = "Remi Gau", email = "remi.gau@gmail.com"} ] -keywords = [ - "BIDS", - "brain imaging data structure", - "neuroimaging", - "automated pipeline", - "MRI", - "Eyetracking", - "Machine learning", - ] classifiers = [ "Development Status :: 3 - Alpha", "Intended Audience :: Science/Research", "License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)", "Operating System :: Unix", "Programming Language :: Python", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Topic :: Scientific/Engineering :: Artificial Intelligence", - "Topic :: Scientific/Engineering :: Image Processing", + "Topic :: Scientific/Engineering :: Image Processing" ] dependencies = [ "attrs", - "chevron", - "deepmreye", + "chevron>=0.14.0", + "deepmreye>=0.2.1", "kaleido", - "pooch", + "pooch>=1.6.0", "pybids", "rich", "tqdm", - "tomli; python_version < '3.11'" + "tomli; python_version < '3.11'", + "keras<3.0.0" ] +description = "bids app using deepMReye to decode eye motion for fMRI time series data" dynamic = ["version"] +keywords = [ + "BIDS", + "brain imaging data structure", + "neuroimaging", + "automated pipeline", + "MRI", + "Eyetracking", + "Machine learning" +] +license = {file = "LICENSE"} +name = "bidsmreye" +readme = "README.md" +requires-python = ">=3.9.0" [project.optional-dependencies] +dev = ["bidsmreye[doc,test,style]"] # also stored in docs/requirements.txt # to speed up readthedocs build doc = [ @@ -59,7 +60,8 @@ doc = [ "sphinx-rtd-theme", "sphinxcontrib-bibtex" ] -style =[ +docs = ["bidsmreye[doc]"] +style = [ "black", "codespell", "flake8", @@ -68,24 +70,30 @@ style =[ 'types-all', 'pandas-stubs', "pre-commit", - "sourcery", + "sourcery" ] test = [ "pytest", - "pytest-cov", + "pytest-cov" ] -dev = ["bidsmreye[doc,test,style]"] -docs = ["bidsmreye[doc]"] tests = ["bidsmreye[test]"] -[project.urls] -Homepage = "https://github.com/cpp-lln-lab/bidsMReye" -"Bug Tracker" = "https://github.com/cpp-lln-lab/bidsMReye/issues" - [project.scripts] bidsmreye = "bidsmreye.bidsmreye:cli" bidsmreye_model = "bidsmreye.download:cli" +[project.urls] +"Bug Tracker" = "https://github.com/cpp-lln-lab/bidsMReye/issues" +Homepage = "https://github.com/cpp-lln-lab/bidsMReye" + +[tool.black] +line-length = 90 + +[tool.codespell] +builtin = "clear,rare" +ignore-words-list = "fo,slite" +skip = "*.svg,*.eps,.git,env,*build,.mypy*,outputs,.mypy_cache,moae_fmriprep,bidsmreye/templates/CITATION.bib" + [tool.hatch.build.hooks.vcs] version-file = "bidsmreye/_version.py" @@ -95,44 +103,49 @@ packages = ["bidsmreye"] [tool.hatch.version] source = "vcs" -[tool.black] -line-length = 90 - -[tool.codespell] -skip = "*.svg,*.eps,.git,env,*build,.mypy*,outputs,.mypy_cache,moae_fmriprep,bidsmreye/templates/CITATION.bib" -builtin = "clear,rare" -ignore-words-list = "fo,slite" +[tool.importlinter] +ignore_imports = [ + "bidsmreye._version" +] +root_package = "bidsmreye" -[tool.vulture] -min_confidence = 70 -paths = ["bidsmreye"] -sort_by_size = true +[[tool.importlinter.contracts]] +containers = "bidsmreye" +layers = [ + "bidsmreye", + "prepare_data | generalize | download", + "quality_control", + "visualize", + "bids_utils", + "methods", + "utils", + "configuration", + "logging", + "defaults" +] +name = "Layered architecture" +type = "layers" [tool.mypy] -exclude = ['tests/'] -plugins = "pydantic.mypy" check_untyped_defs = true disallow_any_generics = true disallow_incomplete_defs = true disallow_untyped_defs = true +exclude = ['tests/'] no_implicit_optional = true +plugins = "pydantic.mypy" warn_redundant_casts = true warn_unused_ignores = true -[tool.pydantic-mypy] -init_forbid_extra = true -init_typed = true -warn_required_dynamic_aliases = true -warn_untyped_fields = true - [[tool.mypy.overrides]] +ignore_errors = true module = [ 'bids.*', "bidsmreye._version" ] -ignore_errors = true [[tool.mypy.overrides]] +ignore_missing_imports = true module = [ 'attrs.*', "bidsmreye._version", @@ -143,9 +156,25 @@ module = [ 'plotly.*', 'pooch.*', 'rich.*', - 'scipy.*', + 'scipy.*' ] -ignore_missing_imports = true + +[tool.pydantic-mypy] +init_forbid_extra = true +init_typed = true +warn_required_dynamic_aliases = true +warn_untyped_fields = true [tool.pytest.ini_options] -addopts = "--cov bidsmreye -ra -vv" +addopts = "--cov bidsmreye -ra --strict-config --strict-markers --doctest-modules --showlocals -s -vv --durations=0" +doctest_optionflags = "NORMALIZE_WHITESPACE ELLIPSIS" +junit_family = "xunit2" +log_cli_level = "INFO" +minversion = "6.0" +testpaths = ["tests"] +xfail_strict = true + +[tool.vulture] +min_confidence = 70 +paths = ["bidsmreye"] +sort_by_size = true diff --git a/tests/test_bids_utils.py b/tests/test_bids_utils.py index 576bd5e..61c2ae7 100644 --- a/tests/test_bids_utils.py +++ b/tests/test_bids_utils.py @@ -6,16 +6,19 @@ import pytest -from .utils import pybids_test_dataset -from bidsmreye.bids_utils import check_layout -from bidsmreye.bids_utils import create_bidsname -from bidsmreye.bids_utils import get_dataset_layout -from bidsmreye.bids_utils import init_dataset -from bidsmreye.bids_utils import list_subjects +from bidsmreye.bids_utils import ( + check_layout, + create_bidsname, + get_dataset_layout, + init_dataset, + list_subjects, +) from bidsmreye.configuration import Config from bidsmreye.prepare_data import save_sampling_frequency_to_json from bidsmreye.utils import set_this_filter +from .utils import pybids_test_dataset + def test_create_bidsname(tmp_path): output_dir = tmp_path / "derivatives" diff --git a/tests/test_configuration.py b/tests/test_configuration.py index dca20b4..72b09f7 100644 --- a/tests/test_configuration.py +++ b/tests/test_configuration.py @@ -4,12 +4,15 @@ import pytest +from bidsmreye.configuration import ( + Config, + config_to_dict, + get_bidsname_config, + get_config, + get_pybids_config, +) + from .utils import pybids_test_dataset -from bidsmreye.configuration import Config -from bidsmreye.configuration import config_to_dict -from bidsmreye.configuration import get_bidsname_config -from bidsmreye.configuration import get_config -from bidsmreye.configuration import get_pybids_config def test_Config(): diff --git a/tests/test_download.py b/tests/test_download.py index 80db492..574efa7 100644 --- a/tests/test_download.py +++ b/tests/test_download.py @@ -5,8 +5,7 @@ import pytest -from bidsmreye.download import download -from bidsmreye.download import download_parser +from bidsmreye.download import download, download_parser def test_download_parser(): diff --git a/tests/test_quality_control.py b/tests/test_quality_control.py index d74e70f..1063a8d 100644 --- a/tests/test_quality_control.py +++ b/tests/test_quality_control.py @@ -6,21 +6,25 @@ import pandas as pd import pytest -from .utils import create_basic_data -from .utils import create_basic_json -from .utils import create_confounds_tsv -from .utils import return_bidsmreye_eyetrack_tsv -from .utils import rm_dir -from bidsmreye.bids_utils import create_bidsname -from bidsmreye.bids_utils import get_dataset_layout +from bidsmreye.bids_utils import create_bidsname, get_dataset_layout from bidsmreye.configuration import Config -from bidsmreye.quality_control import add_qc_to_sidecar -from bidsmreye.quality_control import compute_displacement_and_outliers -from bidsmreye.quality_control import compute_robust_outliers -from bidsmreye.quality_control import get_sampling_frequency -from bidsmreye.quality_control import perform_quality_control -from bidsmreye.quality_control import quality_control_input -from bidsmreye.quality_control import quality_control_output +from bidsmreye.quality_control import ( + add_qc_to_sidecar, + compute_displacement_and_outliers, + compute_robust_outliers, + get_sampling_frequency, + perform_quality_control, + quality_control_input, + quality_control_output, +) + +from .utils import ( + create_basic_data, + create_basic_json, + create_confounds_tsv, + return_bidsmreye_eyetrack_tsv, + rm_dir, +) def time_series(): diff --git a/tests/test_utils.py b/tests/test_utils.py index d1dde28..bfc357a 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -3,14 +3,17 @@ import shutil from pathlib import Path -from .utils import pybids_test_dataset from bidsmreye.bids_utils import get_dataset_layout from bidsmreye.configuration import Config -from bidsmreye.utils import copy_license -from bidsmreye.utils import get_deepmreye_filename -from bidsmreye.utils import return_deepmreye_output_filename -from bidsmreye.utils import return_regex -from bidsmreye.utils import set_this_filter +from bidsmreye.utils import ( + copy_license, + get_deepmreye_filename, + return_deepmreye_output_filename, + return_regex, + set_this_filter, +) + +from .utils import pybids_test_dataset def test_copy_license(tmp_path): diff --git a/tests/test_visualize.py b/tests/test_visualize.py index d67ac94..c6d873d 100644 --- a/tests/test_visualize.py +++ b/tests/test_visualize.py @@ -4,12 +4,11 @@ import pandas as pd -from .utils import create_confounds_tsv -from .utils import return_bidsmreye_eyetrack_tsv from bidsmreye.bidsmreye import bidsmreye from bidsmreye.configuration import Config -from bidsmreye.visualize import group_report -from bidsmreye.visualize import visualize_eye_gaze_data +from bidsmreye.visualize import group_report, visualize_eye_gaze_data + +from .utils import create_confounds_tsv, return_bidsmreye_eyetrack_tsv def test_visualize_eye_gaze_data(): diff --git a/tests/utils.py b/tests/utils.py index e95e88d..6cf5db1 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -8,8 +8,7 @@ import pandas as pd from bids.tests import get_test_data_path -from bidsmreye.quality_control import compute_displacement -from bidsmreye.quality_control import compute_robust_outliers +from bidsmreye.quality_control import compute_displacement, compute_robust_outliers def create_basic_data():