Description
Is your feature request related to a problem? Please describe.
No, but it would make this tool easier for broad scale usage
Describe the solution you'd like
Currently, there are several neural-specific package dependencies that may not be necessary for all researchers using this tool for temporal networks:
'nilearn>=0.6.0',
'pybids>=0.9',
'statsmodels>=0.8.0',
'networkx>=2.0',
'python-louvain>=0.13',
'pandas>=0.21',
'scipy>=1.4.1',
'numpy>=1.16.1',
'templateflow>=0.4.1'],
Would it be possible to not require templateflow
, nilearn
, and pybids
for installation? For example, there could be a warning shown during installation that says for full functionality, please additionally install x, y, and z?
Describe alternatives you've considered
This could also be implemented as a decorator that you could use for neural-dependent functions?
import importlib
def assert_installed_packages(func, packages=["templateflow", "nilearn", "pybids"]):
packages = np.asarray(sorted(set(packages)))
def wrapper():
installed = list()
for package in packages:
try:
globals()[package] = importlib.import_module(package)
installed.append(True)
except ImportError:
installed.append(False)
installed = np.asarray(installed)
assert np.all(installed), "Please install the following packages to use this functionality:\n{}".format(", ".join(packages[~installed]))
return wrapper
def function_not_dependent_on_neuralpackages(x):
return x
@assert_installed_packages(packages=["hello"])
def function_dependent_on_neuralpackage(x):
return x
If I tried to use function_dependent_on_neuralpackage
but didn't have the required packages it would tell me to install templateflow
, nilearn
, and pybids
.
The code above is fully functional but I could help out with that if you were interested.
Additional context
Add any other context or screenshots about the feature request here.