python-dataclasses-serialization
python-dataclasses-serialization copied to clipboard
Handle tuples
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
.
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?
- This PR (allowing serialisation of, e.g.
Tuple[int, str]
in defaultJSONSerializer
) - 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).
- 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)
- Numpy support (would involve adding
numpy
,msgpack
,msgpack_numpy
dependencies)