gql

A GraphQL client in Python

https://github.com/graphql-python/gql

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (11.5%) to scientific vocabulary

Keywords

async-transport gql graphql graphql-client websockets-transport

Keywords from Contributors

audio cryptography transformer distributed closember diffusion n3 namespace nquads ntriples
Last synced: 6 months ago · JSON representation

Repository

A GraphQL client in Python

Basic Info
  • Host: GitHub
  • Owner: graphql-python
  • License: mit
  • Language: Python
  • Default Branch: master
  • Homepage: https://gql.readthedocs.io
  • Size: 1.07 MB
Statistics
  • Stars: 1,628
  • Watchers: 26
  • Forks: 184
  • Open Issues: 7
  • Releases: 43
Topics
async-transport gql graphql graphql-client websockets-transport
Created over 9 years ago · Last pushed 6 months ago
Metadata Files
Readme Contributing License Codeowners

README.md

GQL

This is a GraphQL client for Python. Plays nicely with graphene, graphql-core, graphql-js and any other GraphQL implementation compatible with the GraphQL specification.

GQL architecture is inspired by React-Relay and Apollo-Client.

GitHub-Actions pyversion pypi Anaconda-Server Badge codecov

Documentation

The complete documentation for GQL can be found at gql.readthedocs.io.

Features

Installation

You can install GQL with all the optional dependencies using pip:

```bash

Quotes may be required on certain shells such as zsh.

pip install "gql[all]" ```

NOTE: See also the documentation to install GQL with less extra dependencies depending on the transports you would like to use or for alternative installation methods.

Usage

Sync usage

```python from gql import Client, gql from gql.transport.aiohttp import AIOHTTPTransport

Select your transport with a defined url endpoint

transport = AIOHTTPTransport(url="https://countries.trevorblades.com/")

Create a GraphQL client using the defined transport

client = Client(transport=transport)

Provide a GraphQL query

query = gql( """ query getContinents { continents { code name } } """ )

Execute the query on the transport

result = client.execute(query) print(result) ```

Executing the above code should output the following result:

$ python basic_example.py {'continents': [{'code': 'AF', 'name': 'Africa'}, {'code': 'AN', 'name': 'Antarctica'}, {'code': 'AS', 'name': 'Asia'}, {'code': 'EU', 'name': 'Europe'}, {'code': 'NA', 'name': 'North America'}, {'code': 'OC', 'name': 'Oceania'}, {'code': 'SA', 'name': 'South America'}]}

WARNING: Please note that this basic example won't work if you have an asyncio event loop running. In some python environments (as with Jupyter which uses IPython) an asyncio event loop is created for you. In that case you should use instead the async usage example.

Async usage

```python import asyncio

from gql import Client, gql from gql.transport.aiohttp import AIOHTTPTransport

async def main():

# Select your transport with a defined url endpoint
transport = AIOHTTPTransport(url="https://countries.trevorblades.com/graphql")

# Create a GraphQL client using the defined transport
client = Client(transport=transport)

# Provide a GraphQL query
query = gql(
    """
    query getContinents {
      continents {
        code
        name
      }
    }
"""
)

# Using `async with` on the client will start a connection on the transport
# and provide a `session` variable to execute queries on this connection
async with client as session:

    # Execute the query
    result = await session.execute(query)
    print(result)

asyncio.run(main()) ```

Contributing

See CONTRIBUTING.md

License

MIT License

Owner

  • Name: GraphQL Python
  • Login: graphql-python
  • Kind: organization
  • Location: San Francisco

The GraphQL Python community. Created by @syrusakbary and maintained by the community

GitHub Events

Total
  • Create event: 12
  • Release event: 10
  • Issues event: 29
  • Watch event: 89
  • Delete event: 2
  • Issue comment event: 83
  • Push event: 48
  • Pull request review comment event: 2
  • Pull request review event: 8
  • Pull request event: 90
  • Fork event: 10
Last Year
  • Create event: 12
  • Release event: 10
  • Issues event: 29
  • Watch event: 89
  • Delete event: 2
  • Issue comment event: 83
  • Push event: 48
  • Pull request review comment event: 2
  • Pull request review event: 8
  • Pull request event: 90
  • Fork event: 10

Committers

Last synced: 9 months ago

All Time
  • Total Commits: 363
  • Total Committers: 59
  • Avg Commits per committer: 6.153
  • Development Distribution Score (DDS): 0.38
Past Year
  • Commits: 69
  • Committers: 6
  • Avg Commits per committer: 11.5
  • Development Distribution Score (DDS): 0.087
Top Committers
Name Email Commits
Hanusz Leszek l****z@g****m 225
Christoph Zwerschke c****o@o****e 32
Syrus Akbary me@s****m 21
Eran Kampf e****n@e****m 14
Manuel Bojato 3****a 10
Semyon Pupkov m****l@s****m 3
Connor Brinton c****r@b****m 2
Malte S. Stretz m****s@m****e 2
Nicholas Bollweg n****g@g****m 2
XuZvvHYmZfYdWJNRunkJ 3****c 2
Ignacio Tolosa i****2@s****l 2
Christofer Bertonha c****a@g****m 1
DENKweit GmbH 8****t 1
Dmitriy 3****v 1
E.S e****n 1
Florent Clairambault f****t@c****r 1
Gabriel Chiong g****g@g****m 1
Gerard Dalmau g****u 1
Helder Correia 1****o 1
Hugo Locurcio h****o@h****o 1
Jimmy Merrild Krag b****c@g****m 1
Chad Furman c****d@c****m 1
Borgstrom ♕ e****n@b****a 1
Aurélien a****n@g****m 1
Alexandre Detiste a****e@g****m 1
Abhishek Shekhar a****5@g****m 1
tlowery-scwx 1****x 1
sondale-git 6****t 1
Florent Clairambault f****t@h****r 1
Jonathan Leitschuh j****h@g****m 1
and 29 more...

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 126
  • Total pull requests: 179
  • Average time to close issues: about 2 months
  • Average time to close pull requests: 4 days
  • Total issue authors: 104
  • Total pull request authors: 29
  • Average comments per issue: 3.23
  • Average comments per pull request: 1.28
  • Merged pull requests: 155
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 13
  • Pull requests: 99
  • Average time to close issues: 14 days
  • Average time to close pull requests: 1 day
  • Issue authors: 11
  • Pull request authors: 6
  • Average comments per issue: 1.31
  • Average comments per pull request: 0.89
  • Merged pull requests: 85
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • leszekhanusz (6)
  • FrankC01 (5)
  • kloczek (3)
  • aalmazan (3)
  • Jonas1312 (2)
  • wvidana (2)
  • Vichoko (2)
  • markedwards (2)
  • david-waterworth (2)
  • HJA24 (2)
  • Hadevmin (2)
  • Dzeri96 (2)
  • Waitak (2)
  • Kinzowa (1)
  • devkral (1)
Pull Request Authors
  • leszekhanusz (139)
  • traylenator (4)
  • mss (3)
  • a-detiste (2)
  • MrSampson (2)
  • phdesign (2)
  • tlowery-scwx (2)
  • rahul-gj (2)
  • nocnokneo (2)
  • kasbaker (2)
  • gonzalezzfelipe (1)
  • qw-in (1)
  • abhishek-12355 (1)
  • eknvarli (1)
  • mangin (1)
Top Labels
Issue Labels
type: question or discussion (48) type: feature (23) type: bug (11) type: chore (8) type: invalid (7) type: documentation (5) status: needs more information (3) type: wontfix (2) type: optimization (2) type: duplicate (2) type: maintenance (1) misc: help wanted (1) type: rfc (1) type: tests (1)
Pull Request Labels
type: chore (6) type: bug (3)

Packages

  • Total packages: 5
  • Total downloads:
    • pypi 9,580,976 last-month
  • Total docker downloads: 764,276,128
  • Total dependent packages: 204
    (may contain duplicates)
  • Total dependent repositories: 2,545
    (may contain duplicates)
  • Total versions: 65
  • Total maintainers: 4
pypi.org: gql

GraphQL client for Python

  • Versions: 49
  • Dependent Packages: 194
  • Dependent Repositories: 2,538
  • Downloads: 9,580,976 Last month
  • Docker Downloads: 764,276,128
Rankings
Docker downloads count: 0.1%
Dependent packages count: 0.1%
Dependent repos count: 0.2%
Downloads: 0.2%
Average: 1.0%
Stargazers count: 1.8%
Forks count: 3.8%
Last synced: 6 months ago
spack.io: py-gql

This is a GraphQL client for Python. Plays nicely with graphene, graphql-core, graphql-js and any other GraphQL implementation compatible with the spec. GQL architecture is inspired by React-Relay and Apollo- Client.

  • Versions: 2
  • Dependent Packages: 2
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Stargazers count: 6.7%
Forks count: 7.8%
Average: 8.4%
Dependent packages count: 19.0%
Maintainers (1)
Last synced: 6 months ago
conda-forge.org: gql

This is a GraphQL client for Python. Plays nicely with graphene, graphql-core, graphql-js and any other GraphQL implementation compatible with the spec.

  • Versions: 9
  • Dependent Packages: 8
  • Dependent Repositories: 7
Rankings
Dependent packages count: 7.1%
Average: 11.2%
Stargazers count: 11.2%
Dependent repos count: 12.8%
Forks count: 13.8%
Last synced: 6 months ago
pypi.org: gql-hub

GraphQL client for Python

  • Versions: 2
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 0
Rankings
Stargazers count: 1.8%
Forks count: 3.8%
Dependent packages count: 4.8%
Dependent repos count: 6.3%
Average: 15.1%
Downloads: 58.8%
Last synced: about 1 year ago
conda-forge.org: gql-with-all

This is a GraphQL client for Python. Plays nicely with graphene, graphql-core, graphql-js and any other GraphQL implementation compatible with the spec.

  • Versions: 3
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Stargazers count: 10.6%
Forks count: 12.7%
Average: 27.1%
Dependent repos count: 34.0%
Dependent packages count: 51.2%
Last synced: 6 months ago

Dependencies

docs/requirements.txt pypi
  • multidict <5.0,>=4.5
  • sphinx >=3.0.0,<4
  • sphinx-argparse ==0.2.5
  • sphinx_rtd_theme >=0.4,<1
gql-checker/setup.py pypi
  • pycodestyle *
setup.py pypi
  • backoff >=1.11.1,<3.0
  • graphql-core >=3.2,<3.3
  • yarl >=1.6,<2.0
.github/workflows/deploy.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • pypa/gh-action-pypi-publish v1.1.0 composite
.github/workflows/lint.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
.github/workflows/tests.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • codecov/codecov-action v1 composite