Implement customizable serializer#214
Conversation
7ba6e00 to
b56b9ce
Compare
s3rius
left a comment
There was a problem hiding this comment.
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:
JSONFormatterexists for the backward compatibility.ProxyFormatteris used by default, which operates overbroker.serializerAPIJSONSerializerwhich is a thin wrapper around plainjson.dumps()andjson.loads()TaskiqSerializerbase 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
cborandmsgpackserializers as well if you are ok with optional dependencies (say,cbor2is required only if a user explicitly importstaskiq.serializers.cbor_serializer:CBORSerializer.