Welcome to hickle’s documentation!

Hickle is a HDF5-based clone of pickle, with a twist: instead of serializing to a pickle file, Hickle dumps to a HDF5 file (Hierarchical Data Format). It is designed to be a “drop-in” replacement for pickle (for common data objects), but is really an amalgam of h5py and dill/pickle with extended functionality.

That is: hickle is a neat little way of dumping python variables to HDF5 files that can be read in most programming languages, not just Python. Hickle is fast, and allows for transparent compression of your data (LZF / GZIP).

hickle.load(fileobj, path='/', safe=True)

Load a hickle file and reconstruct a python object

Parameters:
  • fileobj – file object, h5py.File, or filename string safe (bool): Disable automatic depickling of arbitrary python objects. DO NOT set this to False unless the file is from a trusted source. (see http://www.cs.jhu.edu/~s/musings/pickle.html for an explanation)
  • path (str) – path within hdf5 file to save data to. Defaults to root /
hickle.dump(py_obj, file_obj, mode='w', track_times=True, path='/', **kwargs)

Write a pickled representation of obj to the open file object file.

Args: obj (object): python object o store in a Hickle file: file object, filename string, or h5py.File object

file in which to store the object. A h5py.File or a filename is also acceptable.
mode (str): optional argument, ‘r’ (read only), ‘w’ (write) or ‘a’ (append).
Ignored if file is a file object.
compression (str): optional argument. Applies compression to dataset. Options: None, gzip,
lzf (+ szip, if installed)
track_times (bool): optional argument. If set to False, repeated hickling will produce
identical files.

path (str): path within hdf5 file to save data to. Defaults to root /

Indices and tables