Add shared_session_scope_pickle for arbitrary object support#37
Conversation
- Add PickleStore class using pickle serialization - Add shared_session_scope_pickle function as convenience wrapper - Update documentation with pickle examples - Add test coverage for pickle functionality
|
Thanks for the PR - it looks good to me, I'll probably merge it and make a release over the weekend. I'm very interested in hearing your experience with the package. To be honest I didn't think that anyone was actually using it. I'm hoping to pick up development and fix the edge cases soon-ish, but since i've not myself really using it right now I'm not sure how useful it is in this state |
|
Hey, thanks for looking into my PR so quickly :-)
Well I have acceptance tests where I spin up a kubernetes cluster via pytest-kind. This alone consumes about 30s of time. Once I introduced pytest-xdist the sessions scoped "kind_cluster" and "container_image" fixtures did run in every process, which was slow and even caused race-conditions (shared kubeconfig on disk). So I did some research and found this in the xdist documentation. The approach worked, but my code looked really ugly. Then I had the issue that whichever process finished first tore down the kubernetes cluster and all other tests broke. I am no programming novice, but I am not deep enough into the low level stuff about how to elegantly determine with locks or similar which process is last. |
|
Cool, thanks for letting me know! I was afraid that the limitations was too big in the current state to actually use it in projects, but nice to know that it might not be like that. I took the liberty of pushing some smaller changes to the PR but in general it was very nicely done. Thanks! Will merge and release now |
|
v0.5.0 is released with this included, thanks! |
|
Hi, thank you very much for merging this and even creating a new release.
Your documentation showed multiple places to hook custom logic into. So I think it is very well usable. And I am not using Thank you btw for being active in OSS. Every bit helps. Like this little gem for example :-) |
Adds support for serializing arbitrary Python objects by introducing
shared_session_scope_picklewhich uses pickle instead of JSON. This eliminates the need for custom serialization functions when working with non-JSON serializable objects like class instances.The implementation adds a new
PickleStoreclass and convenience function, with updated documentation positioning pickle as the preferred option for arbitrary objects.