Welcome to py-gql’s documentation!#

Release: v0.4.0 (Installation)

https://img.shields.io/circleci/project/github/lirsacc/py-gql.svg?logo=circleci https://img.shields.io/codecov/c/github/lirsacc/py-gql.svg? https://img.shields.io/pypi/v/py-gql.svg https://img.shields.io/pypi/pyversions/py-gql.svg?logo=python&logoColor=white https://img.shields.io/pypi/wheel/py-gql.svg

py-gql is a pure python GraphQL implementation aimed at creating GraphQL servers. It supports:

  • Parsing the GraphQL query language and schema definition language.

  • Building a GraphQL type schema programatically and from Schema Definition files (including support for schema directives).

  • Validating and Executing a GraphQL request against a type schema.

The source code, issue tracker and development guidelines are available on Github.

Hello World#

from py_gql import build_schema, graphql_blocking

schema = build_schema(
    type Query {
        hello(value: String = "world"): String!

def resolve_hello(*_, value):
    return "Hello {}!".format(value)

result = graphql_blocking(schema, '{ hello(value: "Foo") }')
assert result.response() == {"data": {"hello": "Hello Foo!"}}


GraphQL is a data query language and runtime specification for fulfilling these queries against your data. It provides semantics for describing your data as a type schema and exposing them to clients. It backend agnostic architecture, which means you can freely choose the transport and serialization protocols, data storage layer, etc. that fit your project / organisation and use GraphQL as a thin layer on top.

GraphQL was originally developped at Facebook and released publicly in 2015.


If you are not familiar with GraphQL already, we strongly suggest you head over to graphql.org and have a look at the official introduction and the specification before going any further.

Indices and tables#