diff --git a/physutils/io.py b/physutils/io.py index 76a7f75..3cb8f79 100644 --- a/physutils/io.py +++ b/physutils/io.py @@ -9,7 +9,6 @@ import os.path as op import numpy as np -from bids import BIDSLayout from loguru import logger from physutils import physio @@ -28,7 +27,7 @@ def load_from_bids( suffix="physio", ): """ - Load physiological data from BIDS-formatted directory + Load physiological data from BIDS-formatted directory. Parameters ---------- @@ -50,6 +49,12 @@ def load_from_bids( data : :class:`physutils.Physio` Loaded physiological data """ + try: + from bids import BIDSLayout + except ImportError: + raise ImportError( + "To use BIDS-based feature, pybids must be installed. Install manually or with `pip install physutils[bids]`" + ) # check if file exists and is in BIDS format if not op.exists(bids_path): diff --git a/physutils/tasks.py b/physutils/tasks.py index 3da6c56..686db19 100644 --- a/physutils/tasks.py +++ b/physutils/tasks.py @@ -11,7 +11,6 @@ # from loguru import logger - try: from pydra import task except ImportError: diff --git a/setup.cfg b/setup.cfg index 86e5486..619fbf5 100644 --- a/setup.cfg +++ b/setup.cfg @@ -24,8 +24,6 @@ install_requires = matplotlib numpy >=1.9.3 loguru - pydra - pybids tests_require = pytest >=3.6 test_suite = pytest @@ -34,6 +32,10 @@ packages = find: include_package_data = True [options.extras_require] +pydra = + pydra +bids = + pybids doc = sphinx >=2.0 sphinx-argparse @@ -49,6 +51,8 @@ test = scipy pytest >=5.3 pytest-cov + %(pydra)s + %(bids)s %(style)s devtools = pre-commit