biqqles / dataclassy

A fast and flexible reimplementation of data classes
https://pypi.org/project/dataclassy
Mozilla Public License 2.0
81 stars 9 forks source link

Compatibility with libraries dependent on dataclasses #22

Closed demberto closed 3 years ago

demberto commented 3 years ago

How do I combine dataclassy's dataclass with dataclass-property's dataclass or marshmallow_dataclass with marshmallow.validate? I need sub classing as well as validation. I think there's no other way than to write normal classes with property getters and setters. All my dataclasses have one ABC parent

biqqles commented 3 years ago

Unfortunately I have no idea since both of those depend on a totally different module to this. You would almost certainly have to fork those libraries to make them work with dataclassy.


@giannitedesco this might be interesting for you - marshmallow_dataclass seems to have a mypy plugin (#19).

giannitedesco commented 3 years ago

Interesting, looks like when it comes to the dataclass part, it just passes the heavy-lifting on to the existing dataclass plugin. So it must have the same semantics as standard dataclasses.

biqqles commented 3 years ago

Closing due to inactivity. Sorry we couldn't be of more help.

demberto commented 3 years ago

No issue, when it comes to things like validation class with property getter setter is the best solution