{"library":"starlette-graphene3","title":"Starlette-Graphene3","type":"library","description":"Starlette-Graphene3 is an ASGI application for seamlessly integrating Graphene v3 with Starlette and FastAPI. It provides support for GraphQL queries, mutations, subscriptions (over WebSockets), file uploading, and includes built-in GraphiQL/GraphQL Playground interfaces. The current version is 0.6.0, and releases appear to be infrequent, primarily driven by updates to underlying dependencies like Graphene and Starlette.","language":"python","status":"active","last_verified":"Thu Apr 16","install":{"commands":["pip install starlette-graphene3","pip install 'starlette-graphene3[all]' # Includes python-multipart for file uploads","pip install uvicorn"],"cli":null},"imports":["from starlette_graphene3 import GraphQLApp","from starlette_graphene3 import make_graphiql_handler"],"auth":{"required":false,"env_vars":[]},"links":{"homepage":null,"github":"https://github.com/ciscorn/starlette-graphene3","docs":null,"changelog":null,"pypi":"https://pypi.org/project/starlette-graphene3/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null},"quickstart":{"code":"import asyncio\nimport graphene\nfrom starlette.applications import Starlette\nfrom starlette_graphene3 import GraphQLApp, make_graphiql_handler\n\nclass User(graphene.ObjectType):\n    id = graphene.ID()\n    name = graphene.String()\n\nclass Query(graphene.ObjectType):\n    me = graphene.Field(User)\n\n    def resolve_me(root, info):\n        # In a real app, this would fetch data from a database or service\n        return User(id=\"1\", name=\"Test User\")\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\napp = Starlette()\nschema = graphene.Schema(query=Query, subscription=Subscription)\n\napp.mount(\"/\", GraphQLApp(schema, on_get=make_graphiql_handler()))\n\n# To run this example, save it as `main.py` and execute:\n# uvicorn main:app --reload\n# Then open your browser to http://127.0.0.1:8000/","lang":"python","description":"This quickstart demonstrates setting up a basic Starlette application with GraphQL using `starlette-graphene3`. It defines a simple query and a subscription, then mounts the `GraphQLApp` at the root path with the GraphiQL handler enabled for an interactive interface.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}