HDF5-based serialization library for Python datatypes
Project description
RWA-python serializes Python datatypes and stores them in HDF5 files.
Code example:
from rwa import HDF5Store class CustomClass(object): __slots__ = 'my_slot' def __init__(self, slot=None): self.my_slot = slot # make any complex construct any_object = CustomClass((CustomClass(5), dict(a=1))) # serialize hdf5 = HDF5Store('my_file.h5', 'w') hdf5.poke('my object', any_object) hdf5.close() # deserialize hdf5 = HDF5Store('my_file.h5', 'r') reloaded_object = hdf5.peek('my object') hdf5.close()
With Python3, RWA-python serialization is fully automatic. The library generates serialization schemes for most custom types. When deserializing objects, it also looks for and loads the modules where the corresponding types are defined.
If RWA-python complains about a type that cannot be serialized, a partial fix consists of ignoring this datatype:
hdf5_not_storable(type(unserializable_object))
With Python2, the library requires explicit definitions in most cases. In addition, string typing is sometimes problematic. Non-ascii characters should be explicit unicode.
Installation
You will need Python >= 2.7 or >= 3.5.
pip install --user rwa-python
pip install will install some Python dependencies if missing, but you may still need to install the HDF5 reference library.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for rwa_python-0.7-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c74c9347cf3e7aebbd36a64936792041d51f8d18091158a6eaab558536369ff8 |
|
MD5 | c6f4e3f5db9eb6bbc625ccdfccda5734 |
|
BLAKE2b-256 | e2789ab119d472fa5f53acb4c2d82c485bb0d2126b90b7813f90ccfa3cbb7fb1 |