Introduction

GQL 3 is a GraphQL Client for Python 3.8+ which plays nicely with other graphql implementations compatible with the spec.

Under the hood, it uses GraphQL-core which is a Python port of GraphQL.js, the JavaScript reference implementation for GraphQL.

Installation

You can install GQL 3 and all the extra dependencies using pip:

pip install "gql[all]"

To have the latest pre-releases versions of gql, you can use:

pip install --pre "gql[all]"

After installation, you can start using GQL by importing from the top-level gql package.

Less dependencies

GQL supports multiple transports to communicate with the backend. Each transport can necessitate specific dependencies. If you only need one transport you might want to install only the dependency needed for your transport, instead of using the “all” extra dependency as described above, which installs everything.

If for example you only need the AIOHTTPTransport, which needs the aiohttp dependency, then you can install GQL with:

pip install gql[aiohttp]

The corresponding between extra dependencies required and the GQL classes is:

Extra dependencies

Classes

aiohttp

AIOHTTPTransport

AIOHTTPWebsocketsTransport

websockets

WebsocketsTransport

PhoenixChannelWebsocketsTransport

AppSyncWebsocketsTransport

requests

RequestsHTTPTransport

httpx

HTTPTXTransport

HTTPXAsyncTransport

botocore

AppSyncIAMAuthentication

Note

It is also possible to install multiple extra dependencies if needed using commas: gql[aiohttp,websockets]

Installation with conda

It is also possible to install gql using conda.

To install gql with all extra dependencies:

conda install gql-with-all

To install gql with less dependencies, you might want to instead install a combinaison of the following packages: gql-with-aiohttp, gql-with-websockets, gql-with-requests, gql-with-botocore

If you want to have the latest pre-releases version of gql and graphql-core, you can install them with conda using:

conda install -c conda-forge -c conda-forge/label/graphql_core_alpha -c conda-forge/label/gql_beta gql-with-all

Reporting Issues and Contributing

Please visit the GitHub repository for gql if you’re interested in the current development or want to report issues or send pull requests.

We welcome all kinds of contributions if the coding guidelines are respected. Please check the Contributing file to learn how to make a good pull request.