6

which lib is better to integrate with a new django project?

i red the docs and still doesnt know how performatic or easier to integrate each one can be in prod environment.

i used graphene before to integrate with some pipefy code that i did at work but im pretty new in graphql and dont know at this point what way i should go.

pdrferrari
  • 65
  • 6

1 Answers1

11

I'm the maintainer of Strawberry, so there might be some bias in my answer

Both Strawberry and Graphene are based on GraphQL-core which is the library that provides the GraphQL execution, so in terms of performance they are comparable. For Strawberry we have a performance dashboard here: https://speed.strawberry.rocks/ and you can see we've been working to make it as fast as we can, but GraphQL-core will always be the deciding factor for the speed[1]

For Django, I personally don't tend to use the integrations from models as I think it is a bad practise, but both Graphene and Strawberry have integration in that sense. Graphene integration's probably more mature, but Strawberry's is getting better every day (the maintainer works on both strawberry-django and strawberry-django-plus, and he's doing amazing work).

Graphene has also probably more extensions at the moment and maybe more guides online, though most might not be up-to-date any more.

Strawberry is well maintained and makes releases quite often, and we are trying to not have big breaking changes, even if we are at version 0.x. Graphene has been unmaintained for a bit but luckily now there are more maintainers.

I'd definitely encourage you to do a small prototype with both libraries and see which one resonates the most with you as they have different DX, with Strawberry leveraging Python Type Hints and Graphene having a syntax very similar to Django models.

[1] I do have some ideas on how we can make the library faster, but I don't know when I'll be able to implement them :)

patrick
  • 6,533
  • 7
  • 45
  • 66
  • thank you for the answer! i will put in my todo list this prototype test! strawberry seems to work in a pythonic way! this thing about uptodate maintanment worries me, i will look into this too! thanks again. – pdrferrari Sep 30 '22 at 16:27
  • @lightbow88 you're welcome! feel free to join our discord if you have more questions – patrick Sep 30 '22 at 20:04
  • `strawberry-django-plus` automatic queries optimizer is a killer feature. It work very well with filters module. There is a similar extension for graphene but after testing it doesn't work as well. – fabien-michel Oct 27 '22 at 08:39