COPYRIGHT © 2009–2019 MIRUMEE SOFTWARE Creating a GraphQL API in Python: from Django to fully asynchronous Marcin Gębala & Patryk Zawadzki DjangoCon Europe 2019
COPYRIGHT © 2009–2019 MIRUMEE SOFTWARE About us Marcin Gębala Python developer @ Mirumee Software, Lead developer @ Saleor github.com/maarcingebala @maarcingebala Patryk Zawadzki Head of Technology @ Mirumee Software, Python developer github.com/patrys @patrys
COPYRIGHT © 2009–2019 MIRUMEE SOFTWARE Agenda ■ Saleor ■ GraphQL - core concepts ■ Workshop
COPYRIGHT © 2009–2019 MIRUMEE SOFTWARE https://github.com/mirumee/graphql-workshop
COPYRIGHT © 2009–2019 MIRUMEE SOFTWARE Saleor - open-source e-commerce platform Backend: Django + GraphQL API (Graphene) Frontend: TypeScript + Apollo Client + React github.com/mirumee/saleor
COPYRIGHT © 2009–2019 MIRUMEE SOFTWARE ■ Single endpoint, single request ■ Client defines what data to fetch ■ Strong typing ■ Introspection ■ Queries, mutations, subscriptions GraphQL - core concepts
COPYRIGHT © 2009–2019 MIRUMEE SOFTWARE Queries ■ Queries allow fetching data from the server. ■ Each query has a resolver - a function that defines how to fetch the data from a data source (any).
COPYRIGHT © 2009–2019 MIRUMEE SOFTWARE Mutations ■ Mutations allow modifying data on the server.
COPYRIGHT © 2009–2019 MIRUMEE SOFTWARE ■ A schema file defines the types and operations available in the API. ■ A clear contract between backend and frontend ■ Easy to find usages of particular types Schema
COPYRIGHT © 2009–2019 MIRUMEE SOFTWARE Ariadne github.com/mirumee/ariadne Ariadne is a Python library for implementing schema-first GraphQL servers that is simple to use and open for extension. ■ Schema-first approach ■ Inspired by Apollo Server
COPYRIGHT © 2009–2019 MIRUMEE SOFTWARE https://github.com/mirumee/graphql-workshop
COPYRIGHT © 2009–2019 MIRUMEE SOFTWARE Intermission: asyncio
COPYRIGHT © 2009–2019 MIRUMEE SOFTWARE Event loop example from Python’s documentation
COPYRIGHT © 2009–2019 MIRUMEE SOFTWARE https://github.com/mirumee/graphql-workshop
COPYRIGHT © 2009–2019 MIRUMEE SOFTWARE THANK YOU! @maarcingebala @patrys

Creating a GraphQL API in Python: from Django to fully asynchronous

  • 1.
    COPYRIGHT © 2009–2019MIRUMEE SOFTWARE Creating a GraphQL API in Python: from Django to fully asynchronous Marcin Gębala & Patryk Zawadzki DjangoCon Europe 2019
  • 2.
    COPYRIGHT © 2009–2019MIRUMEE SOFTWARE About us Marcin Gębala Python developer @ Mirumee Software, Lead developer @ Saleor github.com/maarcingebala @maarcingebala Patryk Zawadzki Head of Technology @ Mirumee Software, Python developer github.com/patrys @patrys
  • 3.
    COPYRIGHT © 2009–2019MIRUMEE SOFTWARE Agenda ■ Saleor ■ GraphQL - core concepts ■ Workshop
  • 4.
    COPYRIGHT © 2009–2019MIRUMEE SOFTWARE https://github.com/mirumee/graphql-workshop
  • 5.
    COPYRIGHT © 2009–2019MIRUMEE SOFTWARE Saleor - open-source e-commerce platform Backend: Django + GraphQL API (Graphene) Frontend: TypeScript + Apollo Client + React github.com/mirumee/saleor
  • 6.
    COPYRIGHT © 2009–2019MIRUMEE SOFTWARE ■ Single endpoint, single request ■ Client defines what data to fetch ■ Strong typing ■ Introspection ■ Queries, mutations, subscriptions GraphQL - core concepts
  • 7.
    COPYRIGHT © 2009–2019MIRUMEE SOFTWARE Queries ■ Queries allow fetching data from the server. ■ Each query has a resolver - a function that defines how to fetch the data from a data source (any).
  • 8.
    COPYRIGHT © 2009–2019MIRUMEE SOFTWARE Mutations ■ Mutations allow modifying data on the server.
  • 9.
    COPYRIGHT © 2009–2019MIRUMEE SOFTWARE ■ A schema file defines the types and operations available in the API. ■ A clear contract between backend and frontend ■ Easy to find usages of particular types Schema
  • 10.
    COPYRIGHT © 2009–2019MIRUMEE SOFTWARE Ariadne github.com/mirumee/ariadne Ariadne is a Python library for implementing schema-first GraphQL servers that is simple to use and open for extension. ■ Schema-first approach ■ Inspired by Apollo Server
  • 11.
    COPYRIGHT © 2009–2019MIRUMEE SOFTWARE https://github.com/mirumee/graphql-workshop
  • 12.
    COPYRIGHT © 2009–2019MIRUMEE SOFTWARE Intermission: asyncio
  • 13.
    COPYRIGHT © 2009–2019MIRUMEE SOFTWARE Event loop example from Python’s documentation
  • 14.
    COPYRIGHT © 2009–2019MIRUMEE SOFTWARE https://github.com/mirumee/graphql-workshop
  • 15.
    COPYRIGHT © 2009–2019MIRUMEE SOFTWARE THANK YOU! @maarcingebala @patrys