Metadata-Version: 2.1
Name: graphql-api
Version: 1.2.0
Summary: A framework for building Python GraphQL APIs.
Home-page: https://gitlab.com/parob/graphql-api
Author: Robert Parker
Author-email: rob@parob.com
License: MIT
Download-URL: https://gitlab.com/parob/graphql/-/archive/v1.2.0/graphql-api-v1.2.0.tar.gz
Keywords: GraphQL,GraphQL-API,GraphQLAPI,Server
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Description-Content-Type: text/markdown
Provides-Extra: dev
License-File: LICENSE

# GraphQL-API
Framework for building a GraphQL API with Python

[![coverage report](https://gitlab.com/parob/graphql-api/badges/master/coverage.svg)](https://gitlab.com/parob/graphql-api/commits/master)

[![pipeline status](https://gitlab.com/parob/graphql-api/badges/master/pipeline.svg)](https://gitlab.com/parob/graphql-api/commits/master)

## 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](http://parob.gitlab.io/graphql-api/)

##### 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
``` python
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)
```

``` text
$ python example.py
>>> {'isOdd': 'No'}
```


