Skip to main content

A framework for building Python GraphQL APIs.

Project description

GraphQL-API

Framework for building a GraphQL API with Python

coverage report

pipeline status

Installation

Pip
pip install graphql-api

Run the Unit Tests

To run the tests.

pip install pipenv
pipenv install --dev
pipenv run python -m pytest tests --cov=graphql_api

Docs

The documentation is public, and is generated using Sphinx.

GraphQL-API Documentation

Build documentation

To build a local static HTML version of the documentation.

pip install pipenv
pipenv install sphinx
pipenv run sphinx-build docs ./public -b html

Simple Example

from graphql_api import GraphQLAPI

api = GraphQLAPI()

@api.type(root=True)
class MathService:

    @api.field
    def is_odd(self, number: int) -> str:
        return "No" if (num % 2) else "Yes"


query = '''
    query {
        isOdd(number: 5)
    }
'''

result = api.executor().execute(query)

print(result.data)
$ python example.py
>>> {'isOdd': 'No'}

Project details


Download files

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

Source Distribution

graphql-api-1.3.12.tar.gz (38.4 kB view details)

Uploaded Source

File details

Details for the file graphql-api-1.3.12.tar.gz.

File metadata

  • Download URL: graphql-api-1.3.12.tar.gz
  • Upload date:
  • Size: 38.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for graphql-api-1.3.12.tar.gz
Algorithm Hash digest
SHA256 e5d05da45a3b609ee553ed05f8f8544b174d9f3862bdb0df18acbabd0937d60b
MD5 867888056b5506aa147bfa33259f5442
BLAKE2b-256 0ce67c1c27179eea4e4666962d6af560d22bb357d4054f36a63909d19ab4cab3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page