Skip to content

Commit

Permalink
Merge pull request #134 from fact-project/fix_133
Browse files Browse the repository at this point in the history
Add missing depencency click, better error if zstd is not available, fixes #133
  • Loading branch information
maxnoe authored Dec 5, 2019
2 parents 5811d73 + 9616726 commit 5c6d7aa
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion fact/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.26.0
0.26.1
10 changes: 7 additions & 3 deletions fact/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)

Expand All @@ -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'
)


Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
setup_requires=['pytest-runner'],
install_requires=[
'astropy',
'click',
'h5py',
'matplotlib>=1.4',
'numpy',
Expand All @@ -45,7 +46,7 @@
'setuptools',
'simple-crypt',
'sqlalchemy',
'tables', # pytables in anaconda
'tables>=3.3', # pytables in anaconda
'wrapt',
],
zip_safe=False,
Expand Down

0 comments on commit 5c6d7aa

Please sign in to comment.