Make apitools-generated classes pickleable
- Dominant language
- Python
- Stars
- 157
- Forks
- 131
- PR merge metrics
- No merged PRs in 30d
Description
Presently, apitools can generate nested classes, which, because they aren't [defined at the top-level of the module](https://docs.python.org/2/library/pickle.html#what-can-be-pickled-and-unpickled), are un-pickleable. Pickling is necessary for passing apitools objects to other processes, which in turn is useful when optimizing performance by spreading work out over multiple processes and threads.
This is a feature request to add `__reduce__` and other appropriate logic so that apitools-generated objects can be pickled without any intervention by library consumers. This could be added either to generated classes or the base message classes in protorpclite
As a workaround, the consumers of a generated library can manual using encoding.MessageToJson prior to pickling and JsonToMessage after pickling, but it's extra work for each consumer.
Contributor guide
Assessment
This issue has not been assessed yet.