GraphQL library for Python - Strawberry

Robert Matyszewski

Robert Matyszewski

I recently came across an interesting library for GraphQL. Strawberry is a new GraphQL library for Python 3, inspired by dataclasses. An initial version of Strawberry has been released on GitHub. To follow the project, you can sign up to get updates on the Strawberry site or github. Links below:

Strawberry is created by patrick91 who is also an organizer of @pyconit. It was originally announced during Python Pizza Berlin.

#PyPi release and demo

Alpha version on PyPI: Demo on Heroku using Starlette:


pip install strawberry-graphql

Getting Started

Create a file called with the following code:

import strawberry

class User:
    name: str
    age: int

class Query:
    def user(self, info) -> User:
        return User(name="Patrick", age=100)

schema = strawberry.Schema(query=Query)

This will create a GraphQL schema defining a User type and a single query field user that will return a hard-coded user.

To run the debug server run the following command:

strawberry run server app

Open the debug server by clicking on the following link:

This will open a GraphQL playground where you can test the API.

{% github strawberry-graphql/strawberry %}

⚡ Speed up your GraphQL API development

The GraphQL Editor is a supportive tool for both advanced GraphQL users as well as those taking their first steps with GraphQL APIs. Our all-in-one development environment for GraphQL will help you build, manage & deploy your GraphQL API much faster thanks to dozens of built-in micro features. Its graphical interface will also fix communication within your product team. Visualization is the key!

Try it for free