Skip to main content

No project description provided

Project description

GraphQL helpers for Python.

CI status: ci-status

Schema definition

PyQL provides a better / cleaner syntax for defining GraphQL schemas.

Using PyQL:

from pyql import Schema

schema = Schema()

def resolve_hello(root, info, name: str = 'world') -> str:
    return 'Hello {}'.format(name)

compiled = schema.compile()

Equivalent using graphql-core:

from graphql import (
    GraphQLObjectType, GraphQLField, GraphQLArgument, GraphQLString,

Query = GraphQLObjectType(
    fields=lambda: {
        'hello': GraphQLField(
                'name': GraphQLArgument(
            resolver=lambda root, info, name = 'world': f'Hello, {name}'

schema = GraphQLSchema(query=Query)

Graphene looks slightly better, but it’s quite confusing, and makes use of unncessary objects:

import graphene

class Query(graphene.ObjectType):
    hello = graphene.Field(

    def resolve_hello(self, info, name='world'):
        return f'Hello {name}'

schema = graphene.Schema(query=Query)

PyQL uses standard Python introspection when possible to figure out things, so eg. argument definitions can be picked up automatically from a resolver function, etc.


While there are plans for field argument documentation to be picked up automatically from docstrings, it’s not currently implemented as reliably parsing docstrings is a non-trivial task.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for PyQL, version 3.0.0
Filename, size File type Python version Upload date Hashes
Filename, size PyQL-3.0.0-py3-none-any.whl (12.4 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size PyQL-3.0.0.tar.gz (10.9 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page