-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Split packer into a class that supports msgpack's ExtType #70
Conversation
Hi, thanks for this contribution. If I understand correctly, this changeset try to extend support of datetime.* objects by using pickle as Serializer before passing them to msgpack ? I'm OK to break backward compatibility for this release, but there is a quick win you can apply to not break too much things by keeping pseud/common.py p = Packer()
msgpack_packb = p.packb
msgpack_unpackb = p.unpackb then you can reduce the size of the diff drastically. And since each Packer instance holds a caching dictionary, using it as a singleton will improve overall performance. |
This changeset is to allow users of pseud to extend the packer's translation table to include custom classes. I want to 'send' some classes in my project and have msgpack turn it into an ExtType and back on the other side. I don't want a singleton for this, as it's not necessary at all. If you want a singleton for performance, you can pass in a singleton packer instance you made into your clients and servers. Without the singleton enforced, it allows one to create asymmetric serialization (which is something I use): class A sent from the client becomes class B on the server. While this is possible with the singleton if you're either the client or server, it won't work if you're both (testing). |
I understand better now, thanks for explanation. |
153cdd3
to
7432f4e
Compare
Oh, I couldn't run the tests locally using tox so I thought they were normally broken. If you're using travis, I think you should remove tox.ini to not confuse developers. |
I plan to use tox within Travis, to make everyone happy :) |
78caba5
to
cf059f2
Compare
tox doesn't support the custom zeromq version stuff, as far as I could tell. In any case, I finally got the tests working (there was a lot of flakiness, is that normal?) |
That's a great contribution, |
Split packer into a class that supports msgpack's ExtType
There is, however, one drawback. datetime objects sent over the wire aren't wire-compatible. Fixing that makes the code very complicated and I don't know how needed that is since v0.1.0 is going to be backwards-incompatible anyway.