Registry / storage / hickle

hickle

JSON →
library5.0.3pypypi✓ verified 83d ago

Hickle is an HDF5-based serialization library for Python, designed as a drop-in replacement for pickle with better performance and cross-language support. Current version is 5.0.3, supporting Python >=3.7. It wraps h5py and allows saving/loading Python objects (including NumPy arrays) in HDF5 files. Release cadence is irregular.

pip install hickle
INSTALL
IMPORT
SIG · HICKLE
H
hickle
storagepythonv5.0.3
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

hickle
import hickle
from hickle import *
Wildcard imports are discouraged; use explicit module.

Serialize a dictionary containing a NumPy array to an HDF5 file and read it back.

import hickle import numpy as np data = {'array': np.array([1,2,3]), 'string': 'hello'} # Save to HDF5 file hickle.dump(data, 'data.hickle5') # Load back loaded = hickle.load('data.hickle5') print(loaded)
Debug
Known issues
gotchahickle does not serialize arbitrary Python objects like functions or classes; it primarily supports basic types, NumPy arrays, dicts, lists, and tuples. Attempting to pickle complex objects may raise an error.
fix
Only use hickle for objects with a simple structure or implement custom serialization hooks.
affects: all
gotchaFile extension should be '.hickle5' (HDF5-based) not '.hickle' (old format). Using the old extension may cause confusion.
fix
Use '.hickle5' extension for new HDF5 files. For legacy '.hickle' files, use hickle.load with explicit format='pickle' if needed.
affects: >=4.0.0
deprecatedThe old pickle-based format ('.hickle' extension) is deprecated in favor of HDF5 ('.hickle5'). Loading the old format still works but saving will use HDF5 by default.
fix
Migrate existing hickle files to hickle5 by loading and re-saving with hickle.dump(..., format='hickle5').
affects: >=4.0.0
Errors
Common errors & fixes
ImportError: No module named 'hickle'
hickle is not installed.
fix
Run 'pip install hickle'.
ValueError: Unsupported type: <class 'function'>
hickle cannot serialize functions or lambdas.
fix
Remove the function from the data before serialization, or implement a workaround (e.g., store function name as string).
TypeError: Object of type XXX is not JSON serializable
hickle uses JSON for metadata, and some types (e.g., custom classes) are not directly supported.
fix
Ensure the object contains only hickle-compatible types (dict, list, tuple, numpy arrays, scalars, strings, bytes, None).
h5py._errors.Can't write data (inflate request failed)
HDF5 compression error, often due to incompatible data types or corruption.
fix
Check data for NaN, Inf, or unsupported dtypes; try saving without compression (compression=None in h5py).
Upgrade
Version history
5.0.3latest on PyPI · released Mar 30, 2024
Audit
Dependencies
h5pyrequiredRequired for HDF5 file operations
numpyrequiredRequired for array serialization
Agent activity
33 hits · last 30 days
node
32
Amazon
1
Resources
hickle — pip install hickle · libregistry