Skip to main content

No project description provided

Project description

GraphQL helpers for Python.

Schema definition

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

Using PyQL:

from pyql import Object, Schema

Query = Object('Query')

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

schema = Schema(query=Query)
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.

The whole API is currently work in progress and might change in the future.

Documentation coming as soon as things get a bit more well defined.

Contributing: creating a release

  1. Update version number in

  2. Update version number in docs/

  3. Commit changes, eg:

    git add docs/
    git commit -m '0.2.1 ...'
  4. Tag the version, eg:

    git tag -a -m 'Version 0.2.1' v0.2.1
  5. Push changes to GitHub:

    git push
    git push --tags
  6. Release on PyPI:

    rm -rf dist
    python sdist bdist_wheel
    twine upload dist/*

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 0.2.2
Filename, size File type Python version Upload date Hashes
Filename, size PyQL-0.2.2-py3-none-any.whl (14.4 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size PyQL-0.2.2.tar.gz (11.7 kB) File type Source Python version None Upload date Hashes View

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page