An experienced coding friend new to Django asked me about the "best" way to implement APIs—specifically, Django REST Framework vs Django-Ninja. I've heard a lot of positive things about Ninja lately.

Does anyone have firsthand experience of the pros/cons of each approach right now?

I know @frank has some opinions on this!

@wsvincent @frank The hardest conceptual part of Django Ninja is that you need to fall back to the Django's docs/way of doing things if you don't find it in the Ninja docs. Otherwise, it feels underwhelming, and the learning curve feels steeper than it is. I'd love to see the docs spell this out more and link to Django's docs.

I think Ninja is great, but its benefit and weakness is that it's tied to Pydantic, which has had a recent non-trivial upgrade.

@wsvincent @frank I hope now that Pydantic v2 is now supported that future Pydantic versions will be easier to upgrade.

The other gotcha if you like class-based views, is that there are a few third-party packages that add them to Nina, but it's not obvious if any are blessed or recommended. Since Ninja doesn't ship with an opinion here, it'd be nice to have something to work with.

@wsvincent @frank Overall, I'm impressed with it and warming up to it.

I have done several small projects with it to feel it out, and if they could fill in some knowledge pages like previously mentioned (plus ship an API key model), I think it has a brighter future than DRF.

If I were building something big today, I would still default to DRF until Ninja at least has some pointers for more things.

@webology @wsvincent I think ninja will be my default position going forward. Obviously if client or existing project is using DRF or has deep DRF experience to leverage that would sway things.

I also like that's it is QUITE a bit faster than DRF because of Pydantic. Everything feels snappier in a React app, even just locally.

@frank @webology @wsvincent This checks out, DRFs serializers are great but definitely one of the slower implementations of serialisation/validation in Py-land. Even more so since Pydantic v2 and its Rust backend.
@frank @webology @wsvincent I haven’t used Ninja yet but you’ve encouraged me to give it a look, thanks all.