Skip to content

Commit 31b982c

Browse files
committed
Make joblib an optional dependency
1 parent f68c29a commit 31b982c

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

neo/rawio/baserawio.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ def __init__(self, use_cache=False, cache_path='same_as_resource', **kargs):
156156

157157
self.use_cache = use_cache
158158
if use_cache:
159-
import joblib
160159
self.setup_cache(cache_path)
161160
else:
162161
self._cache = None
@@ -697,7 +696,10 @@ def rescale_epoch_duration(self, raw_duration, dtype='float64',
697696
return self._rescale_epoch_duration(raw_duration, dtype, event_channel_index)
698697

699698
def setup_cache(self, cache_path, **init_kargs):
700-
import joblib
699+
try:
700+
import joblib
701+
except ImportError:
702+
raise ImportError("Using the RawIO cache needs joblib to be installed")
701703

702704
if self.rawmode in ('one-file', 'multi-file'):
703705
resource_name = self.filename

pyproject.toml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ classifiers = [
2424
dependencies = [
2525
"packaging",
2626
"numpy>=1.19.5",
27-
"quantities>=0.14.1",
28-
"joblib>=1.0.0"
27+
"quantities>=0.14.1"
2928
]
3029

3130
[project.urls]
@@ -41,6 +40,10 @@ build-backend = "setuptools.build_meta"
4140

4241
[project.optional-dependencies]
4342

43+
iocache = [
44+
"joblib>=1.0.0"
45+
]
46+
4447
test = [
4548
"pytest",
4649
"pytest-cov",
@@ -60,6 +63,7 @@ test = [
6063
"sonpy",
6164
"pynwb",
6265
"probeinterface",
66+
"joblib>=1.0.0"
6367
]
6468

6569
docs = [
@@ -96,5 +100,6 @@ all = [
96100
"scipy>=1.0.0",
97101
"sonpy",
98102
"tqdm",
103+
"joblib>=1.0.0"
99104
]
100105
# we do not include 'stfio' in 'all' as it is not pip installable

0 commit comments

Comments
 (0)