Welcome to py-gql’s documentation!#

Release: v0.6.1 (Installation)

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 programmatically and from Schema Definition files (including support for schema directives).
  • Validating and executing GraphQL operations against a type schema.

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


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: "World") }')
assert result.response() == {"data": {"hello": "Hello World!"}}


GraphQL is a data query language and runtime specification originally developed at Facebook and released publicly in 2015. It provides semantics for describing your data as a type schema and exposing them to clients. It is backend agnostic, which means you can freely choose the transport and serialization protocols, data storage layer, etc. that fit your project / organization and use GraphQL as a thin layer on top.

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#