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 given default implementations of to_json, from_json, __reduce__ (for pickling), and other serialization helpers.

Your derived class must:

  • provide a user-defined to_dict() method which returns a dictionary.

  • The keys of the dictionary returned by to_dict() must match the arguments to the __init__ of your class.

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 expect 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.0.4.tar.gz (6.7 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: serializable-0.0.4.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for serializable-0.0.4.tar.gz
Algorithm Hash digest
SHA256 92a7ae43184ce538847519acf9bbcdc0e2a7d35c8adfba4f83c24156b06dc467
MD5 99e2b4fa91508e5cb4070d60d51063a3
BLAKE2b-256 0ada69e2ab26491595feca421aa8eff6ef099445cab0767d4c9edfd8a07a3971

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