Skip to main content

pypi

  1. GraphQL

  2. Django queryset love

  3. __getattr__ abuse

  4. ???

  5. Profit!!!

What

py2graphql is a Python GraphQL client that makes GraphQL feel better to use. It almost feels like you’re using Django’s ORM.

Installation

pip install py2graphql

Example

This Python equates to the following GraphQL.

from py2graphql import Query

Query().repository(owner='juliuscaeser', name='rome').pullRequest(number=2).values('title', 'url').commits(last=250).edges.node.commit.values('id', 'message', 'messageBody')
query {
  repository(owner: "juliuscaeser", name: "rome") {
    pullRequest(number: 2) {
      title
      url
      commits(last: 250) {
        edges {
          node {
            commit {
              id
              message
              messageBody
            }
          }
        }
      }
    }
  }
}

You can even use the library to do the HTTP requests:

from py2graphql import Client

headers = {
    'Authorization': 'token MY_TOKEN',
}
Client(url=THE_URL, headers=headers).query().repository(owner='juliuscaeser', name='rome').fetch()

It also supports Mutations:

from py2graphql import Client, Query

headers = {
    'Authorization': 'token MY_TOKEN',
}
client = Client(url=THE_URL, headers=headers)
mutation = Query(name='mutation', client=client)

And multiple queries in a single request:

from py2graphql import Client, Query

headers = {
    'Authorization': 'token MY_TOKEN',
}
query = Client(url=THE_URL, headers=headers).query().repository(owner='juliuscaeser', name='rome')
query.pullRequest(number=2).values('title', 'url')
query.releases(first=10).edges.node.values('name')
query.get_graphql()
query {
  repository(owner: "juliuscaeser", name: "rome") {
     pullRequest(number: 2) {
       title
       url
     }
     releases(first: 10) {
       edges {
         node {
           name
         }
       }
     }
   }
}

As well as GraphQL errors:

from py2graphql import Client, Query

headers = {
    'Authorization': 'token MY_TOKEN',
}
result = Client(url=THE_URL, headers=headers).query().repository(owner='juliuscaeser', name='rome').fetch()
result._errors
[{'message': "Field 'repository' is missing required arguments: name", 'locations': [{'line': 7, 'column': 3}]}]

Metadata

Release files for py2graphql 0.23.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for py2graphql 0.23.0
File Size Uploaded Provenance Actions
py2graphql-0.23.0.tar.gz 7.0 kB Without provenance Details for py2graphql-0.23.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for py2graphql 0.23.0
File Interpreter ABI Platform Actions
py2graphql-0.23.0-py3-none-any.whl Python 3 none any Details for py2graphql-0.23.0-py3-none-any.whl

Total release size: 15.0 kB

Release files / py2graphql-0.23.0.tar.gz

Download URL py2graphql-0.23.0.tar.gz
Size 7.0 kB
Tags Source
SHA-256 checksum
How to use checksums
efe2daacf8db92d264aa1aac7cbc4d8112d1e21969c132422bce403c7e38e2f2
BLAKE2b-256 checksum
How to use checksums
0e29d2fbc9480f627aeff6f6d7d561f9a9acf23d57cf6e2ae74aad9496a4ae99
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.9.5 Darwin/25.0.0

Release files / py2graphql-0.23.0-py3-none-any.whl

Download URL py2graphql-0.23.0-py3-none-any.whl
Size 8.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
791887d1b151347d41cd604b8ea85750c2a2309f85bc0f164c246e962bdaaf3d
BLAKE2b-256 checksum
How to use checksums
a9b6587283535c73198a3f713a39776ea405638547593f58013caa7f608a82ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.9.5 Darwin/25.0.0

Security for py2graphql 0.23.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.23.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page