Skip to main content

HDF5-based serialization library for Python datatypes

Project description

RWA-python

RWA-python serializes Python datatypes and stores them in HDF5 files.

Code example

In module A referenced in sys.path:

class CustomClass(object):
  def __init__(self, arg=None):
    self.attr = arg

In module B:

from A import CustomClass
from rwa import HDF5Store

# make any complex construct
any_object = CustomClass((CustomClass('a'), dict(b=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()

Introduction

With Python3, RWA-python serialization is fully automatic for types with slots defined or such that the init constructor does not require any input argument.

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

Python >= 3.5 is required. RWA-python may still work with Python 2.7 but support has been dropped.

Windows users should favor Conda for installing RWA-python, as Conda will seamlessly install the HDF5 standard library which is a required dependency.

For other users, pip should work just fine:

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. Note that most package managers include this library.

The RWA-python package can also be installed using Conda:

conda install rwa-python -c conda-forge

or poetry:

poetry add rwa-python

See also

RWA-python is on readthedocs.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rwa_python-0.9.5.tar.gz (31.5 kB view details)

Uploaded Source

Built Distribution

rwa_python-0.9.5-py3-none-any.whl (34.2 kB view details)

Uploaded Python 3

File details

Details for the file rwa_python-0.9.5.tar.gz.

File metadata

  • Download URL: rwa_python-0.9.5.tar.gz
  • Upload date:
  • Size: 31.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.11.10 Linux/6.11.0-1-default

File hashes

Hashes for rwa_python-0.9.5.tar.gz
Algorithm Hash digest
SHA256 ddd32cdcbb5762fcfdc09fb025d9b19aac19b0ce396c26d9024c1e31f0d120ab
MD5 8e5b0922e142cb7d8216d7eacac89ad5
BLAKE2b-256 ff2eee168c8f651726009752d8a6c30b19b540acb70e612faeeb475d73d8737c

See more details on using hashes here.

File details

Details for the file rwa_python-0.9.5-py3-none-any.whl.

File metadata

  • Download URL: rwa_python-0.9.5-py3-none-any.whl
  • Upload date:
  • Size: 34.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.11.10 Linux/6.11.0-1-default

File hashes

Hashes for rwa_python-0.9.5-py3-none-any.whl
Algorithm Hash digest
SHA256 6f5a96b8cad5e434b210b9d16328bdadf014baaf8150d5a506cd3de473d88d16
MD5 239422b19ec604e0181b88ee24bc4031
BLAKE2b-256 0c2c53ba664e9fbeb1a4742134a6b55fc06ad015b72b799b6547d0d916a3d9b6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page