4 ms·
Curious, but how does pydantic compare to marshmallow? I'm currently using marshmallow in a project, specifically using the functionality that builds parsers f
by JPKab 5y ago
Curious, but how does pydantic compare to marshmallow?
I'm currently using marshmallow in a project, specifically using the functionality that builds parsers from dataclasses.
I was curious what the differences were.
- AlphaSite 5y agoMarshmallow feels like a more flexible project, but it needs more work for a similar effect IMO. My cons are: - Uses some dsl to define types - Doesn’t marshal to model objects by default, but from DICT to DICT My pro is: - much more configurable and powerful
- goodoldneon 5y agoMy company soured on Marshmallow a while back due to performance. Maybe it’s gotten a lot better, but it has a bad reputation here. Most people seem really happy after we started using Pydantic. Take all that with a grain of salt since I’m just parroting hearsay :)
- kortex 5y agoPersonal opinion: pydantic crushes Marshmallow. Not even a fair fight. Pydantic is more performant, has better mypy/linter integration, and more powerful data model. We had a project where we pre-emptively used marshmallow to marshall/validate data. Had to remove that and solely use it at the ORM layer because of performance (and it still struggles). I haven't used pydantic's ORM integration, but I don't hesitate to use pydantic models everywhere as business logic classes unless I need ludicrous speed. That's all opinion, but I'd definitely give pydantic a swing.