{"id":13816668,"url":"https://github.com/ciscorn/starlette-graphene3","last_synced_at":"2025-04-06T07:14:08.087Z","repository":{"id":37847324,"uuid":"275708591","full_name":"ciscorn/starlette-graphene3","owner":"ciscorn","description":"An ASGI app for using Graphene v3 with Starlette / FastAPI","archived":false,"fork":false,"pushed_at":"2023-09-11T14:10:51.000Z","size":123,"stargazers_count":105,"open_issues_count":14,"forks_count":15,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-30T05:08:28.386Z","etag":null,"topics":["asgi","fastapi","graphene","graphql","python","python3","starlette"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ciscorn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-06-29T02:11:54.000Z","updated_at":"2025-03-05T09:36:05.000Z","dependencies_parsed_at":"2024-06-18T18:30:46.010Z","dependency_job_id":"67468e7a-4913-4631-8c7f-7a47fef7c198","html_url":"https://github.com/ciscorn/starlette-graphene3","commit_stats":{"total_commits":45,"total_committers":8,"mean_commits":5.625,"dds":"0.28888888888888886","last_synced_commit":"60def85f0919afc6ceb30d68c9a06071a2875613"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ciscorn%2Fstarlette-graphene3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ciscorn%2Fstarlette-graphene3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ciscorn%2Fstarlette-graphene3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ciscorn%2Fstarlette-graphene3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ciscorn","download_url":"https://codeload.github.com/ciscorn/starlette-graphene3/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247445680,"owners_count":20939961,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asgi","fastapi","graphene","graphql","python","python3","starlette"],"created_at":"2024-08-04T05:00:49.127Z","updated_at":"2025-04-06T07:14:08.069Z","avatar_url":"https://github.com/ciscorn.png","language":"Python","funding_links":[],"categories":["Topics Index"],"sub_categories":["Commonly Useful Knowledge"],"readme":"# starlette-graphene3\n\nA simple ASGI app for using [Graphene](https://github.com/graphql-python/graphene) v3 with [Starlette](https://github.com/encode/starlette) / [FastAPI](https://github.com/tiangolo/fastapi).\n\n![Test](https://github.com/ciscorn/starlette-graphene3/actions/workflows/test.yml/badge.svg?branch=master)\n[![codecov](https://codecov.io/gh/ciscorn/starlette-graphene3/branch/master/graph/badge.svg)](https://codecov.io/gh/ciscorn/starlette-graphene3)\n[![pypi package](https://img.shields.io/pypi/v/starlette-graphene3?color=%2334D058\u0026label=pypi%20package)](https://pypi.org/project/starlette-graphene3)\n\nIt supports:\n\n- Queries and Mutations (over HTTP or WebSocket)\n- Subscriptions (over WebSocket)\n- File uploading (https://github.com/jaydenseric/graphql-multipart-request-spec)\n- GraphiQL / GraphQL Playground\n\nFile uploading requires `python-multipart` to be installed.\n## Alternatives\n\n- [strawberry](https://github.com/strawberry-graphql/strawberry)\n- [ariadne](https://github.com/mirumee/ariadne)\n- [tartiflette](https://github.com/tartiflette/tartiflette) ([tartiflette-asgi](https://github.com/tartiflette/tartiflette-asgi))\n\n\n## Installation\n\n```bash\npip3 install -U starlette-graphene3\n```\n\n\n## Example\n\n```python\nimport asyncio\n\nimport graphene\nfrom graphene_file_upload.scalars import Upload\n\nfrom starlette.applications import Starlette\nfrom starlette_graphene3 import GraphQLApp, make_graphiql_handler\n\n\nclass User(graphene.ObjectType):\n    id = graphene.ID()\n    name = graphene.String()\n\n\nclass Query(graphene.ObjectType):\n    me = graphene.Field(User)\n\n    def resolve_me(root, info):\n        return {\"id\": \"john\", \"name\": \"John\"}\n\n\nclass FileUploadMutation(graphene.Mutation):\n    class Arguments:\n        file = Upload(required=True)\n\n    ok = graphene.Boolean()\n\n    def mutate(self, info, file, **kwargs):\n        return FileUploadMutation(ok=True)\n\n\nclass Mutation(graphene.ObjectType):\n    upload_file = FileUploadMutation.Field()\n\n\nclass Subscription(graphene.ObjectType):\n    count = graphene.Int(upto=graphene.Int())\n\n    async def subscribe_count(root, info, upto=3):\n        for i in range(upto):\n            yield i\n            await asyncio.sleep(1)\n\n\napp = Starlette()\nschema = graphene.Schema(query=Query, mutation=Mutation, subscription=Subscription)\n\napp.mount(\"/\", GraphQLApp(schema, on_get=make_graphiql_handler()))  # Graphiql IDE\n\n# app.mount(\"/\", GraphQLApp(schema, on_get=make_playground_handler()))  # Playground IDE\n# app.mount(\"/\", GraphQLApp(schema)) # no IDE\n```\n\n## GraphQLApp\n\n`GraphQLApp(schema, [options...])`\n\n```python\nclass GraphQLApp:\n    def __init__(\n        self,\n        schema: graphene.Schema,  # Requied\n        *,\n        # Optional keyword parameters\n        on_get: Optional[\n            Callable[[Request], Union[Response, Awaitable[Response]]]\n        ] = None,  # optional HTTP handler for GET requests\n        context_value: ContextValue = None,\n        root_value: RootValue = None,\n        middleware: Optional[Middleware] = None,\n        error_formatter: Callable[[GraphQLError], Dict[str, Any]] = format_error,\n        logger_name: Optional[str] = None,\n        playground: bool = False,  # deprecating\n        execution_context_class: Optional[Type[ExecutionContext]] = None,\n    ):\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fciscorn%2Fstarlette-graphene3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fciscorn%2Fstarlette-graphene3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fciscorn%2Fstarlette-graphene3/lists"}