From ed3e6305bdf7dfa3d3842a32cac1bc60742929c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20N=C3=B6the?= Date: Thu, 5 Dec 2019 12:43:19 +0100 Subject: [PATCH] Add missing depencency click, better error if zstd is not available --- fact/VERSION | 2 +- fact/io.py | 10 +++++++--- setup.py | 1 + 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/fact/VERSION b/fact/VERSION index 4e8f395..30f6cf8 100644 --- a/fact/VERSION +++ b/fact/VERSION @@ -1 +1 @@ -0.26.0 +0.26.1 diff --git a/fact/io.py b/fact/io.py index 49d91ea..fadd2e5 100644 --- a/fact/io.py +++ b/fact/io.py @@ -37,7 +37,11 @@ def create_blosc_compression_options(complevel=5, complib='blosc:zstd', shuffle= ''' shuffle = 2 if shuffle == 'bit' else 1 if shuffle else 0 compressors = tables.filters.blosc_compressor_list() - complib = ['blosc:' + c for c in compressors].index(complib) + try: + complib = ['blosc:' + c for c in compressors].index(complib) + except ValueError: + raise ValueError('Unsupported compression "{}"'.format(complib)) + args = { 'compression': 32001, 'compression_opts': (0, 0, 0, 0, complevel, shuffle, complib) @@ -49,9 +53,8 @@ def create_blosc_compression_options(complevel=5, complib='blosc:zstd', shuffle= DEFAULT_COMPRESSION = {} with tempfile.NamedTemporaryFile(suffix='.hdf5') as f: - zstd_opts = create_blosc_compression_options() - try: + zstd_opts = create_blosc_compression_options() with h5py.File(f.name, 'w') as of: of.create_dataset('test', dtype='float64', shape=(1, ), **zstd_opts) @@ -63,6 +66,7 @@ def create_blosc_compression_options(complevel=5, complib='blosc:zstd', shuffle= ' make sure tables and h5py are linked against the same hdf5 library' ' e.g. by installing hdf5 in your system and doing ' ' `pip install --no-binary=tables --no-binary=h5py tables h5py`' + ' or using conda' ) diff --git a/setup.py b/setup.py index bff3e7e..81e9c48 100644 --- a/setup.py +++ b/setup.py @@ -34,6 +34,7 @@ setup_requires=['pytest-runner'], install_requires=[ 'astropy', + 'click', 'h5py', 'matplotlib>=1.4', 'numpy',