Building GraphQL APIs in Python Using Graphene with Syrus Akbary

The Python Podcast.__init__

Episode | Podcast

Date: Mon, 31 Dec 2018 07:00:00 -0500

<h3>Summary</h3> <p>The web has spawned numerous methods for communicating between applications, including protocols such as SOAP, XML-RPC, and REST. One of the newest entrants is GraphQL which promises a simplified approach to client development and reduced network requests. To make implementing these APIs in Python easier, Syrus Akbary created the Graphene project. In this episode he explains the origin story of Graphene, how GraphQL compares to REST, how you can start using it in your applications, and how he is working to make his efforts sustainable.</p> <h3>Preface</h3> <ul> <li>Hello and welcome to Podcast.&#95;&#95;init&#95;&#95;, the podcast about Python and the people who make it great.</li> <li>When you&#8217;re ready to launch your next app or want to try a project you hear about on the show, you&#8217;ll need somewhere to deploy it, so check out Linode. With 200 Gbit/s private networking, scalable shared block storage, node balancers, and a 40 Gbit/s public network, all controlled by a brand new API you&#8217;ve got everything you need to scale up. Go to <a href="https://www.pythonpodcast.com/linode?utm_source=rss&amp;utm_medium=rss">pythonpodcast.com/linode</a> to get a $20 credit and launch a new server in under a minute.</li> <li>And to keep track of how your team is progressing on building new features and squashing bugs, you need a project management system designed by software engineers, for software engineers. Clubhouse lets you craft a workflow that fits your style, including per-team tasks, cross-project epics, a large suite of pre-built integrations, and a simple API for crafting your own. Podcast.&#95;&#95;init&#95;&#95; listeners get 2 months free on any plan by going to <a href="https://www.pythonpodcast.com/clubhouse?utm_source=rss&amp;utm_medium=rss">pythonpodcast.com/clubhouse</a> today and signing up for a trial.</li> <li>Visit the <a href="https://www.pythonpodcast.com?utm_source=rss&amp;utm_medium=rss">site</a> to subscribe to the show, sign up for the newsletter, and read the show notes. And if you have any questions, comments, or suggestions I would love to hear them. You can reach me on Twitter at <a href="https://twtiter.com/Podcast&#095;&#095;init&#095;&#095;?utm_source=rss&amp;utm_medium=rss" rel="noopener" target="_blank">@Podcast&#95;&#95;init&#95;&#95;</a> or email <a href="mailto:hosts@podcastinit.com">hosts@podcastinit.com</a>)</li> <li>To help other people find the show please leave a review on <a href="https://itunes.apple.com/us/podcast/podcast.-init/id981834425?mt=2&amp;uo=6&amp;at=&amp;ct=&amp;utm_source=rss&amp;utm_medium=rss" rel="noopener" target="_blank">iTunes</a>, or <a href="https://play.google.com/music/m/I7ogju4xv6adasgqz6545jndgsy?t=Podcastinit_-_Python_and_the_people_who_make_it_great&amp;utm_source=rss&amp;utm_medium=rss" rel="noopener" target="_blank">Google Play Music</a>, tell your friends and co-workers, and share it on social media.</li> <li>Join the community in the new Zulip chat workspace at <a href="https://www.pythonpodcast.com/chat?utm_source=rss&amp;utm_medium=rss">pythonpodcast.com/chat</a></li> <li>Your host as usual is Tobias Macey and today I&#8217;m interviewing Syrus Akbary about Graphene, a python library for building your APIs with GraphQL</li> </ul> <h3>Interview</h3> <ul> <li>Introductions</li> <li>How did you get introduced to Python?</li> <li>What is GraphQL and what is the benefit vs a REST-based API? <ul> <li>How does it compare to specifications such as OpenAPI (formerly Swagger) or RAML?</li> </ul> </li> <li>Can you explain what Graphene is and your motivation for building it? <ul> <li>In addition to the Python implementation there is also a JavaScript library. Is that primarily for use as a client or can it also be used in Node for serving APIs?</li> </ul> </li> <li>What is involved in building a GraphQL API? <ul> <li>What does Graphene do to simplify this process?</li> </ul> </li> <li>How is Graphene implemented and how has that evolved since you first started working on it? <ul> <li>Is there a set of tests for verifying the compliance of Graphene or a specific API with the GraphQL specification?</li> </ul> </li> <li>What are some of the most complex or confusing aspects of building a GraphQL API?</li> <li>What are some of the unique capabilities that are offered by building an application with GraphQL as the communication interface?</li> <li>While reading through documentation in preparation for our conversation I noticed the Quiver project. Can you explain what that is and how it fits with the other Graphene projects? <ul> <li>What is it doing under the hood to optimize serving of the API?</li> </ul> </li> <li>For someone who is interested in adding a GraphQL interface to an existing application, what would be involved?</li> <li>The documentation mentions creation of a schema, as well as defining queries. Is it possible for a client to craft queries that don&#8217;t match directly with those defined in the server layer?</li> <li>What are some of the most interesting or surprising uses of Graphene and GraphQL that you have seeen?</li> <li>What are some cases where it would be more practical to implement an API using REST instead of GraphQL?</li> <li>What are some references that you would recommend for anyone who wants to learn more about GraphQL and its ecosystem?</li> <li>What are your plans for the future of Graphene?</li> </ul> <h3>Keep In Touch</h3> <ul> <li><a href="https://github.com/syrusakbary?utm_source=rss&amp;utm_medium=rss" rel="noopener" target="_blank">syrusakbary</a> on GitHub</li> <li><a href="http://syrusakbary.com/?utm_source=rss&amp;utm_medium=rss" rel="noopener" target="_blank">Website</a></li> <li><a href="https://twitter.com/syrusakbary?utm_source=rss&amp;utm_medium=rss" rel="noopener" target="_blank">@syrusakbary</a> on Twitter</li> </ul> <h3>Picks</h3> <ul> <li>Tobias <ul> <li><a href="https://amzn.to/2Sxit6Y?utm_source=rss&amp;utm_medium=rss" rel="noopener" target="_blank">Audible</a></li> </ul> </li> <li>Syrus <ul> <li><a href="https://webassembly.org/?utm_source=rss&amp;utm_medium=rss" rel="noopener" target="_blank">Web Assembly</a></li> </ul> </li> </ul> <h3>Links</h3> <ul> <li><a href="https://graphene-python.org/?utm_source=rss&amp;utm_medium=rss" rel="noopener" target="_blank">Graphene</a></li> <li><a href="https://graphql.org?utm_source=rss&amp;utm_medium=rss" rel="noopener" target="_blank">GraphQL</a></li> <li><a href="https://en.wikipedia.org/wiki/Representational_state_transfer?utm_source=rss&amp;utm_medium=rss" rel="noopener" target="_blank">REST (REpresentational State Transfer</a></li> <li><a href="https://www.openapis.org/?utm_source=rss&amp;utm_medium=rss" rel="noopener" target="_blank">OpenAPI</a></li> <li><a href="https://raml.org/?utm_source=rss&amp;utm_medium=rss" rel="noopener" target="_blank">RAML</a></li> <li><a href="http://www.php.net/?utm_source=rss&amp;utm_medium=rss" rel="noopener" target="_blank">PHP</a></li> <li><a href="https://code.fb.com/?utm_source=rss&amp;utm_medium=rss" rel="noopener" target="_blank">Facebook Engineering</a></li> <li><a href="https://github.com/graphql-python/graphene-sqlalchemy?utm_source=rss&amp;utm_medium=rss" rel="noopener" target="_blank">Graphene-SQLAlchemy</a></li> <li><a href="https://github.com/graphql-python/graphene-django?utm_source=rss&amp;utm_medium=rss" rel="noopener" target="_blank">Graphene-Django</a></li> <li><a href="https://github.com/graphql/graphiql?utm_source=rss&amp;utm_medium=rss" rel="noopener" target="_blank">GraphiQL</a></li> <li><a href="https://github.com/syrusakbary/pyjade?utm_source=rss&amp;utm_medium=rss" rel="noopener" target="_blank">PyJade</a></li> <li><a href="http://www.django-rest-framework.org/?utm_source=rss&amp;utm_medium=rss" rel="noopener" target="_blank">Django Rest Framework</a></li> <li><a href="https://howtographql.org?utm_source=rss&amp;utm_medium=rss" rel="noopener" target="_blank">How To GraphQL</a></li> <li><a href="https://docs.python.org/3/library/dataclasses.html?utm_source=rss&amp;utm_medium=rss" rel="noopener" target="_blank">Python 3.7 Dataclasses</a> <ul> <li><a href="https://github.com/graphql-python/graphene/issues/729?utm_source=rss&amp;utm_medium=rss" rel="noopener" target="_blank">Graphene GitHub Issue</a></li> </ul> </li> </ul> <p>The intro and outro music is from Requiem for a Fish <a href="http://freemusicarchive.org/music/The_Freak_Fandango_Orchestra/?utm_source=rss&amp;utm_medium=rss" rel="noopener" target="_blank">The Freak Fandango Orchestra</a> / <a href="http://creativecommons.org/licenses/by-sa/3.0/?utm_source=rss&amp;utm_medium=rss" rel="noopener" target="_blank">CC BY-SA</a><img alt="" height="0" src="https://analytics.boundlessnotions.com/piwik.php?idsite=1&amp;rec=1&amp;url=https%3A%2F%2Fwww.pythonpodcast.com%2Fgraphene-with-syrus-akbary-episode-192%2F&amp;action_name=Building+GraphQL+APIs+in+Python+Using+Graphene+with+Syrus+Akbary+-+Episode+192&amp;urlref=https%3A%2F%2Fwww.pythonpodcast.com%2Ffeed%2F&amp;utm_source=rss&amp;utm_medium=rss" style="border: 0; width: 0; height: 0;" width="0" /></p>