Skip to main content

Base class with serialization helpers for user-defined Python objects

Project description

Build Status

serializable

Base class with serialization methods for user-defined Python objects

Usage

Classes which inherit from Serializable are enabled with default implementations of to_json, from_json, __reduce__ (for pickling), and other serialization helpers. A derived class must either have a member data matching the name of each argument to __init__ or, alternatively, must provide a user-defined to_dict() method which returns a dictionary whose keys match the arguments to __init__.

Limitations

  • Serializable objects must inherit from Serializable, be tuples or namedtuples, be serializble primitive types such as dict, list, int, float, or str.

  • The serialized representation of objects relies on reserved keywords (such as "__name__", and "__class__"), so dictionaries are expected to not contain any keys which begin with two underscores.

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

serializable-0.1.1.tar.gz (7.6 kB view details)

Uploaded Source

File details

Details for the file serializable-0.1.1.tar.gz.

File metadata

File hashes

Hashes for serializable-0.1.1.tar.gz
Algorithm Hash digest
SHA256 87f9fadbd0fba5c7951858d16ae9109afa4c96fd486e663419f3051f352a22d9
MD5 dfb019409549f16cfdf7f9496d01a7b9
BLAKE2b-256 1a8c140c24214f503366c80cf9d42c474df2696ea5291bdd318c24d014a859db

See more details on using hashes here.

Supported by

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