Hacker News new | ask | show | jobs
by rtpg 332 days ago
In the Django world I have gotten very frustrated at people rushing to go from DRFs serializers to Django Ninja + Pydantic.

You have way less in terms of tools to actually provide nice straightforward APIs. I appreciate that Pydantic gives you type safety but at one point the actual ease of writing correct code goes beyond type safety

Just real straightforward stuff around dealing with loading in user input becomes a whole song and dance because Pydantic is an extremely basic validation thing… the hacks in DRF like request contexts are useful!

I’ve seen many projects do this and it feels like such a step back in offering simple-to-maintain APIs. Maybe I’m just biased cuz I “get” DRF (and did lose half a day recently to weird DRF behavior…)

3 comments

Are you refering to DRF model serializers? For medium to big applications I think they are worthless.
Shrug, I find them more helpful than Pydantic models for lots of canonical cases.

I have had good success with DRF model serializers in like Django projects with 100+ apps (was the sprawling nature of the apps itself a problem? Sure, maybe). Got the job done

As with anything you gotta built your own wrappers around these things to get value in larger projects though

Could you elaborate a bit more, perhaps with examples ?
This is the Javascript hipster effect. FastAPI and Pydantic are pushed heavily because of their fancy docs page and the evangelism which thrives on reinventing the wheel. So we are all now stuck with everything being Pydantic this Pydantic that, instead of existing frameworks which are frankly better.
To be fair I do think that Pydantic leaning into the type annotation story is nice. If you’re really going lean or performant the restrictions work well in your favor. Just like… for the bog standard B2B SaaS the expressivity tradeoff just doesn’t feel worth it.

In a more just world pythons typing story was closer to typescript’s and we could have a fully realized idea like it that supports the asymmetric nature of serializing/deserializing and offers nice abstractions through the stack

Right now Pydantic for me is like “you can validate a straightforward data structure! Now it’s up to you to actually build up a useful data structure from the straightforward one”. Other tools give me both in one go. At the cost of safety (that you can contain, but you gotta do it right)

Which existing framework is better?
What alternatives do you suggest then?
It's a tough answer because we have had years of artificially-pumped support and development and ecosystem growth of Pydantic.

But if I had to roll the clock back I'd recommend marshmallow and that entire ecosystem. It's definitely way less bloated than Pydantic currently, and only lacks some features. Beyond that, just use plain-old dataclasses.

https://marshmallow.readthedocs.io/en/latest/

It's also because Pydantic has VC money and needs to grow fast now, or else.
Wow really I had no idea. This rabbit hole goes deeper then I expected!

In 2022, the project evolved into a commercial entity called Pydantic Services Inc., founded by Samuel Colvin and Adrian Garcia Badaracco, to build products around the open-source library. The company raised $4.7 million in seed funding in February 2023, led by Sequoia Capital, with participation from Partech, Irregular Expressions, and other investors. This was followed by a $12.5 million Series A round in October 2024, again led by Sequoia Capital and including Partech Partners, bringing the total funding to approximately $17.2 million across rounds. The Series A funding coincided with the launch of Pydantic Logfire, a commercial observability platform for backend applications, aimed at expanding beyond the core open-source validation framework. As of mid-2025, no additional funding rounds have been publicly reported.

https://techcrunch.com/2023/02/16/sequoia-backs-open-source-...

What’s the story here, can anyone enlighten me? How can they make money being a Python library?

I can stretch my imagination about Astral monetizing their tools, but this one is too difficult

Pydantic (the company) owns logfire, a logging service. There’s a lot of money in logging/observability. The pydantic library itself is not monetizable, as you indicate.