# 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'}
```
Raw data
{
"_id": null,
"home_page": "https://gitlab.com/parob/graphql-api",
"name": "graphql-api",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "GraphQL,GraphQL-API,GraphQLAPI,Server",
"author": "Robert Parker",
"author_email": "rob@parob.com",
"download_url": "https://files.pythonhosted.org/packages/0c/e6/7c1c27179eea4e4666962d6af560d22bb357d4054f36a63909d19ab4cab3/graphql-api-1.3.12.tar.gz",
"platform": null,
"description": "# GraphQL-API\nFramework for building a GraphQL API with Python\n\n[![coverage report](https://gitlab.com/parob/graphql-api/badges/master/coverage.svg)](https://gitlab.com/parob/graphql-api/commits/master)\n\n[![pipeline status](https://gitlab.com/parob/graphql-api/badges/master/pipeline.svg)](https://gitlab.com/parob/graphql-api/commits/master)\n\n\n\n## Installation\n\n##### Pip\n```\npip install graphql-api\n```\n\n## Run the Unit Tests\nTo run the tests.\n```\npip install pipenv\npipenv install --dev\npipenv run python -m pytest tests --cov=graphql_api\n```\n\n## Docs\n\nThe documentation is public, and is generated using Sphinx.\n\n[GraphQL-API Documentation](http://parob.gitlab.io/graphql-api/)\n\n##### Build documentation\nTo build a local static HTML version of the documentation.\n```\npip install pipenv\npipenv install sphinx\npipenv run sphinx-build docs ./public -b html\n```\n\n## Simple Example\n``` python\nfrom graphql_api import GraphQLAPI\n\napi = GraphQLAPI()\n\n@api.type(root=True)\nclass MathService:\n\n @api.field\n def is_odd(self, number: int) -> str:\n return \"No\" if (num % 2) else \"Yes\"\n\n\nquery = '''\n query {\n isOdd(number: 5)\n }\n'''\n\nresult = api.executor().execute(query)\n\nprint(result.data)\n```\n\n``` text\n$ python example.py\n>>> {'isOdd': 'No'}\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A framework for building Python GraphQL APIs.",
"version": "1.3.12",
"project_urls": {
"Download": "https://gitlab.com/parob/graphql/-/archive/v1.3.12/graphql-api-v1.3.12.tar.gz",
"Homepage": "https://gitlab.com/parob/graphql-api"
},
"split_keywords": [
"graphql",
"graphql-api",
"graphqlapi",
"server"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "0ce67c1c27179eea4e4666962d6af560d22bb357d4054f36a63909d19ab4cab3",
"md5": "867888056b5506aa147bfa33259f5442",
"sha256": "e5d05da45a3b609ee553ed05f8f8544b174d9f3862bdb0df18acbabd0937d60b"
},
"downloads": -1,
"filename": "graphql-api-1.3.12.tar.gz",
"has_sig": false,
"md5_digest": "867888056b5506aa147bfa33259f5442",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 38385,
"upload_time": "2023-06-14T09:48:55",
"upload_time_iso_8601": "2023-06-14T09:48:55.340390Z",
"url": "https://files.pythonhosted.org/packages/0c/e6/7c1c27179eea4e4666962d6af560d22bb357d4054f36a63909d19ab4cab3/graphql-api-1.3.12.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-06-14 09:48:55",
"github": false,
"gitlab": true,
"bitbucket": false,
"codeberg": false,
"gitlab_user": "parob",
"gitlab_project": "graphql-api",
"lcname": "graphql-api"
}