Fatal1ty / mashumaro

Fast and well tested serialization library
Apache License 2.0
751 stars 44 forks source link

Add array_like (de)serialization for dataclasses #234

Open mishamsk opened 1 month ago

mishamsk commented 1 month ago

Hi!

Wanted to float an idea of adding "array_like" serialization format for data classes. Essentially the same as this msgspec feature.

As of time of writing this is just a POC, see this single new test for a sample.

Such an option will be a big size reduction/performance boost, but the interaction with other options will be pretty tricky. At least the discrimination and defaults handling will have to be carefully handled. Some configuration combinations will have to be forbidden (e.g. skipping defaults with array_like enabled).

Wanted to get some feedback early before doing the entire thing, hence opening PR so early.

pep8speaks commented 1 month ago

Hello @mishamsk! Thanks for opening this PR. We checked the lines you've touched for PEP 8 issues, and found:

Line 1385:80: E501 line too long (80 > 79 characters) Line 1391:80: E501 line too long (80 > 79 characters)

Line 389:1: E302 expected 2 blank lines, found 1