Skip to content

Commit 2c0ff10

Browse files
committed
avoid setting read mode to 'r' as it became the default in 3.0.0 and now raises a deprecation warning
1 parent 132ba26 commit 2c0ff10

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

qiita_files/util.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,17 @@
77
# -----------------------------------------------------------------------------
88

99
from contextlib import contextmanager
10+
from packaging import version
1011

1112
import h5py
1213

1314

14-
# not present in all 2.x series
15-
if hasattr(h5py.get_config(), 'default_file_mode'):
16-
h5py.get_config().default_file_mode = 'r'
15+
# Setting h5py.default_file_mode is deprecated.
16+
# 'r' (read-only) is the default from h5py 3.0.
17+
if version.Version(h5py.__version__) <= version.Version("3.0"):
18+
# not present in all 2.x series
19+
if hasattr(h5py.get_config(), 'default_file_mode'):
20+
h5py.get_config().default_file_mode = 'r'
1721

1822

1923
def _is_string_or_bytes(s):

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,6 @@
4343
'qiita_files/format',
4444
'qiita_files/parse'],
4545
extras_require={'test': ["nose >= 0.10.1", "pep8"]},
46-
install_requires=['numpy', 'h5py', 'joblib'],
46+
install_requires=['numpy', 'h5py', 'joblib', 'packaging'],
4747
classifiers=classifiers
4848
)

0 commit comments

Comments
 (0)