News for hackers. Stuff that matters.
Re:Parse, Don't Validate (2019) by JPKab on Saturday June 26, 2021 @12:49PM (#27643474)
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.

Re:Parse, Don't Validate (2019) by goodoldneon on Saturday June 26, 2021 @04:33PM (#27645570)
My 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 :)
Re:Parse, Don't Validate (2019) by kortex on Sunday June 27, 2021 @10:55AM (#27652057)
Personal 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.

Re:Parse, Don't Validate (2019) by AlphaSite on Saturday June 26, 2021 @09:53PM (#27647820)
Marshmallow 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