starlette-graphene


Namestarlette-graphene JSON
Version 0.3.0 PyPI version JSON
download
home_pagehttps://github.com/bigbag/starlette-graphene
SummaryHelper for add support for graphene in starlette
upload_time2023-08-03 11:46:09
maintainerPavel Liashkov
docs_urlNone
authorPavel Liashkov
requires_python>=3.7
licenseApache License, Version 2.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            # starlette-graphene

[![CI](https://github.com/bigbag/starlette-graphene/workflows/CI/badge.svg)](https://github.com/bigbag/starlette-graphene/actions?query=workflow%3ACI)
[![codecov](https://codecov.io/gh/bigbag/starlette-graphene/branch/main/graph/badge.svg?token=FQTY888XG1)](https://codecov.io/gh/bigbag/starlette-graphene)
[![pypi](https://img.shields.io/pypi/v/starlette-graphene.svg)](https://pypi.python.org/pypi/starlette-graphene)
[![downloads](https://img.shields.io/pypi/dm/starlette-graphene.svg)](https://pypistats.org/packages/starlette-graphene)
[![versions](https://img.shields.io/pypi/pyversions/starlette-graphene.svg)](https://github.com/bigbag/starlette-graphene)
[![license](https://img.shields.io/github/license/bigbag/starlette-graphene.svg)](https://github.com/bigbag/starlette-graphene/blob/master/LICENSE)


**starlette-graphene** is a helper for add support for graphene in starlette.


## Installation

starlette-graphene is available on PyPI.
Use pip to install:

    $ pip install starlette-graphene

## Basic Usage

```py
import uvicorn
from graphene import types as grt
from starlette.applications import Starlette

from starlette_graphene import GraphQLApp


class Account(grt.ObjectType):
    account = grt.Int(required=True)


class AccountFilter(grt.InputObjectType):
    accounts = grt.List(grt.Int)


class Query(grt.ObjectType):
    course_list = None
    accounts = grt.Field(
        grt.List(Account),
        filters=AccountFilter(),
    )

    async def resolve_accounts(
        self,
        info,
        filters: AccountFilter,
    ):

        return [Account(account=1212), Account(account=43434)]


def get_graphql_app() -> GraphQLApp:
    return GraphQLApp(schema=grt.Schema(query=Query))


def init_app():
    app_ = Starlette()
    app_.mount("/graphql/", get_graphql_app())
    return app_


app = init_app()

if __name__ == "__main__":
    uvicorn.run(app=app)
```

## License

starlette-graphene is developed and distributed under the Apache 2.0 license.

## Reporting a Security Vulnerability

See our [security policy](https://github.com/bigbag/starlette-graphene/security/policy).

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/bigbag/starlette-graphene",
    "name": "starlette-graphene",
    "maintainer": "Pavel Liashkov",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "pavel.liashkov@protonmail.com",
    "keywords": "",
    "author": "Pavel Liashkov",
    "author_email": "pavel.liashkov@protonmail.com",
    "download_url": "https://files.pythonhosted.org/packages/c9/66/7136ca01b0c83492add06462fa23cbc91ece147e654901608d1747dc0ed5/starlette-graphene-0.3.0.tar.gz",
    "platform": "POSIX",
    "description": "# starlette-graphene\n\n[![CI](https://github.com/bigbag/starlette-graphene/workflows/CI/badge.svg)](https://github.com/bigbag/starlette-graphene/actions?query=workflow%3ACI)\n[![codecov](https://codecov.io/gh/bigbag/starlette-graphene/branch/main/graph/badge.svg?token=FQTY888XG1)](https://codecov.io/gh/bigbag/starlette-graphene)\n[![pypi](https://img.shields.io/pypi/v/starlette-graphene.svg)](https://pypi.python.org/pypi/starlette-graphene)\n[![downloads](https://img.shields.io/pypi/dm/starlette-graphene.svg)](https://pypistats.org/packages/starlette-graphene)\n[![versions](https://img.shields.io/pypi/pyversions/starlette-graphene.svg)](https://github.com/bigbag/starlette-graphene)\n[![license](https://img.shields.io/github/license/bigbag/starlette-graphene.svg)](https://github.com/bigbag/starlette-graphene/blob/master/LICENSE)\n\n\n**starlette-graphene** is a helper for add support for graphene in starlette.\n\n\n## Installation\n\nstarlette-graphene is available on PyPI.\nUse pip to install:\n\n    $ pip install starlette-graphene\n\n## Basic Usage\n\n```py\nimport uvicorn\nfrom graphene import types as grt\nfrom starlette.applications import Starlette\n\nfrom starlette_graphene import GraphQLApp\n\n\nclass Account(grt.ObjectType):\n    account = grt.Int(required=True)\n\n\nclass AccountFilter(grt.InputObjectType):\n    accounts = grt.List(grt.Int)\n\n\nclass Query(grt.ObjectType):\n    course_list = None\n    accounts = grt.Field(\n        grt.List(Account),\n        filters=AccountFilter(),\n    )\n\n    async def resolve_accounts(\n        self,\n        info,\n        filters: AccountFilter,\n    ):\n\n        return [Account(account=1212), Account(account=43434)]\n\n\ndef get_graphql_app() -> GraphQLApp:\n    return GraphQLApp(schema=grt.Schema(query=Query))\n\n\ndef init_app():\n    app_ = Starlette()\n    app_.mount(\"/graphql/\", get_graphql_app())\n    return app_\n\n\napp = init_app()\n\nif __name__ == \"__main__\":\n    uvicorn.run(app=app)\n```\n\n## License\n\nstarlette-graphene is developed and distributed under the Apache 2.0 license.\n\n## Reporting a Security Vulnerability\n\nSee our [security policy](https://github.com/bigbag/starlette-graphene/security/policy).\n",
    "bugtrack_url": null,
    "license": "Apache License, Version 2.0",
    "summary": "Helper for add support for graphene in starlette",
    "version": "0.3.0",
    "project_urls": {
        "Download": "https://pypi.python.org/pypi/starlette-graphene",
        "Homepage": "https://github.com/bigbag/starlette-graphene"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7c7597e9edad1832896ed52ac6a74861ee3d6954c0070337ba08e58b8a52ebed",
                "md5": "af3128c51580e8be8d85f07bf4236b99",
                "sha256": "779cb1b78c30fc1b0cbd20aa7b62d501eacd28aa13efc7a5f681811ee72a60dc"
            },
            "downloads": -1,
            "filename": "starlette_graphene-0.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "af3128c51580e8be8d85f07bf4236b99",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 11191,
            "upload_time": "2023-08-03T11:46:07",
            "upload_time_iso_8601": "2023-08-03T11:46:07.541672Z",
            "url": "https://files.pythonhosted.org/packages/7c/75/97e9edad1832896ed52ac6a74861ee3d6954c0070337ba08e58b8a52ebed/starlette_graphene-0.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c9667136ca01b0c83492add06462fa23cbc91ece147e654901608d1747dc0ed5",
                "md5": "c1106ad6bc165e37968b3dc828324a35",
                "sha256": "17c1eac3a5d0973a730807c31f8bc8a002f2eb4f1ca090f84a9d77c0fd205f4b"
            },
            "downloads": -1,
            "filename": "starlette-graphene-0.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "c1106ad6bc165e37968b3dc828324a35",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 10192,
            "upload_time": "2023-08-03T11:46:09",
            "upload_time_iso_8601": "2023-08-03T11:46:09.072844Z",
            "url": "https://files.pythonhosted.org/packages/c9/66/7136ca01b0c83492add06462fa23cbc91ece147e654901608d1747dc0ed5/starlette-graphene-0.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-03 11:46:09",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "bigbag",
    "github_project": "starlette-graphene",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "lcname": "starlette-graphene"
}
        
Elapsed time: 0.11090s