python-dataclasses-serialization icon indicating copy to clipboard operation
python-dataclasses-serialization copied to clipboard

Handle tuples

Open petered opened this issue 2 years ago • 1 comments

Adds Tuple-handling to the JSONSerializer, using a tuple_deserialization function that will also make it easier for custom serialisers to handle tuples.

Also adds documentation and type-annotations to the Serializer class and the enigmatic RefinementDict.

petered avatar Jan 19 '23 19:01 petered

Hey @madman-bob . I was looking to make a nice general-purpose tool for python serialisation in the coming months, as it seems that serialization is one of those things where people constantly re-invent the wheel. So I was happy to find your PyPi package - which really provides a really nicely written foundation for this. I'm not sure to what extent you want to extend the scope of this package - there're a few things that I'd like to add. I can either add them to this repo, or to another repo with this repo as a dependency.

Can you me know which, if any, you'd consider taking them as PR's in your repo?

  1. This PR (allowing serialisation of, e.g. Tuple[int, str] in default JSONSerializer)
  2. Versioning support (basically a clear protocol for handling backwards/forwards compatibility when your data class changes fields but you still want to be able to load past/future files with current code).
  3. Support for putting multiple objects in a single file, which can be read sequentially and lazily (e.g. read metadata without reading data, or lazily read a stream without reading whole stream on start)
  4. Numpy support (would involve adding numpy, msgpack, msgpack_numpy dependencies)

petered avatar Jan 23 '23 16:01 petered