-
-
Notifications
You must be signed in to change notification settings - Fork 57
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
Implement customizable serializer #214
Conversation
7ba6e00
to
b56b9ce
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now I see the point crystally clear. These changes will create a simpler API for defining your own serializers. Thank you very much.
I'm totally ok with optional dependencies. In the next iteration I was planning to add a lot of optional depndencies to make installation process easier.
To fix To fix failing tests, make them async and mark with |
tests should be green now, at least locally I don't see any problem |
Codecov Report
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. @@ Coverage Diff @@
## develop #214 +/- ##
===========================================
+ Coverage 67.62% 73.27% +5.65%
===========================================
Files 37 51 +14
Lines 942 1553 +611
===========================================
+ Hits 637 1138 +501
- Misses 305 415 +110
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Since these mypy problems are totally minor, we can merge it now. I'll fix it later. |
Thank you very much for your contribution. |
You are welcome! The next step is PR for taskiq-pipelines |
Could you please consider publishing a new release? It is a pre-requirement for conversion taskiq-pipelines to use new serializers. |
Sure. |
Changes available in https://github.com/taskiq-python/taskiq/releases/tag/0.9.3. |
Pre-requirement for taskiq-python/taskiq-pipelines#13
The main idea is:
JSONFormatter
exists for the backward compatibility.ProxyFormatter
is used by default, which operates overbroker.serializer
APIJSONSerializer
which is a thin wrapper around plainjson.dumps()
andjson.loads()
TaskiqSerializer
base class works withbytes
, notstr
. The broker message type is a bytes anyway, plus formats like msgpack and cbor work with bytes anyway.I can implement
cbor
andmsgpack
serializers as well if you are ok with optional dependencies (say,cbor2
is required only if a user explicitly importstaskiq.serializers.cbor_serializer:CBORSerializer
.