{"id":9793,"library":"graphql-server","title":"GraphQL Server for Python","description":"graphql-server is a Python library that provides integrations for setting up GraphQL servers in various web frameworks such as Flask, Starlette, Django, and Sanic. It currently includes version 3.0.0, which acts as a meta-package bundling core server logic and framework-specific adapters. Releases are made as needed, often in conjunction with updates to its underlying `graphql-core` and framework integration packages.","status":"active","version":"3.0.0","language":"python","source_language":"en","source_url":"https://github.com/graphql-python/graphql-server","tags":["graphql","server","api","http","framework-integration","flask","starlette","django"],"install":[{"cmd":"pip install graphql-server","lang":"bash","label":"Install all framework integrations"},{"cmd":"pip install graphql-server-starlette  # Or -flask, -django, etc.","lang":"bash","label":"Install specific framework integration"}],"dependencies":[{"reason":"Provides the core GraphQL execution logic.","package":"graphql-core","optional":false},{"reason":"Commonly used for building GraphQL schemas, though not a strict dependency of graphql-server itself.","package":"graphene","optional":true},{"reason":"Required for `graphql-server-starlette` integration.","package":"starlette","optional":true},{"reason":"Required for `graphql-server-flask` integration.","package":"flask","optional":true}],"imports":[{"wrong":"from graphql_server import GraphQLRouter","symbol":"GraphQLRouter","correct":"from graphql_server import GraphQLRouter"}],"quickstart":{"code":"import graphene\nfrom starlette.applications import Starlette\nfrom starlette.responses import JSONResponse\nfrom starlette.routing import Route\nfrom graphql_server.starlette import GraphQLRouter\n\n# 1. Define your GraphQL schema using Graphene\nclass Query(graphene.ObjectType):\n    hello = graphene.String(name=graphene.String(default_value=\"World\"))\n\n    def resolve_hello(self, info, name):\n        return f\"Hello, {name}!\"\n\nschema = graphene.Schema(query=Query)\n\n# 2. Integrate with Starlette using GraphQLRouter\nasync def homepage(request):\n    return JSONResponse({\"message\": \"Visit /graphql for the API or /graphql-playground for the UI.\"}) \n\nroutes = [\n    Route(\"/\", homepage),\n    Route(\"/graphql\", GraphQLRouter(schema)),\n    Route(\"/graphql-playground\", GraphQLRouter(schema, playground=True))\n]\n\napp = Starlette(routes=routes)\n\n# To run this app, save it as `app.py` and execute:\n# uvicorn app:app --reload\n# Then visit http://127.0.0.1:8000/graphql-playground in your browser.","lang":"python","description":"This quickstart demonstrates setting up a basic GraphQL server with Starlette and `graphql-server-starlette`. It defines a simple schema using `graphene`, then exposes it via `GraphQLRouter` at `/graphql` and a GraphQL Playground UI at `/graphql-playground`. You'll need `starlette`, `uvicorn`, `graphene`, and `graphql-server` installed."},"warnings":[{"fix":"Update your import statements to point to the correct framework-specific submodule, such as `graphql_server.flask`, `graphql_server.starlette`, or `graphql_server.django`.","message":"Version 3.x of `graphql-server` is a meta-package; direct imports like `from graphql_server import GraphQLView` are no longer valid. Instead, you must import from framework-specific submodules (e.g., `from graphql_server.flask import GraphQLView`).","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"For smaller deployments or to manage dependencies more precisely, install only the specific framework integration package you intend to use (e.g., `pip install graphql-server-starlette`).","message":"Installing `graphql-server` installs all framework integrations by default. If you only need one (e.g., for Flask), it's more efficient to install the specific package (e.g., `pip install graphql-server-flask`).","severity":"gotcha","affected_versions":">=3.0.0"},{"fix":"Always define a valid `graphene.Schema` object or similar schema representation and pass it to your `GraphQLView` or `GraphQLRouter` instance. Check `graphql-core` and `graphene` documentation for schema building best practices.","message":"GraphQL Server for Python relies on `graphql-core` for the underlying GraphQL implementation and `graphene` (or similar) for schema definition. Ensure these dependencies are correctly installed and your schema is properly constructed.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"search_vec":"'3.0.0':35 'act':37 'adapt':51 'api':74 'bundl':43 'conjunct':59 'core':44,67 'current':32 'django':28,81 'flask':26,79 'framework':23,49,69,77 'framework-integr':76 'framework-specif':48 'graphql':1,6,18,66,72 'graphql-cor':65 'graphql-serv':5 'http':75 'includ':33 'integr':14,70,78 'librari':11 'logic':46 'made':54 'meta':41 'meta-packag':40 'need':56 'often':57 'packag':42,71 'provid':13 'python':4,10 'releas':52 'sanic':30 'server':2,7,19,45,73 'set':16 'specif':50 'starlett':27,80 'under':64 'updat':61 'various':21 'version':34 'web':22","created_at":"2026-04-17T01:20:45.033185+00:00","updated_at":"2026-04-17T01:20:45.033185+00:00","problems":{"verify_error":"Traceback (most recent call last):\n  File \"<string>\", line 1, in <module>\nImportError: cannot import name 'GraphQLRouter' from 'graphql_server' (/tmp/tmpkih3anwk/venv/lib/python3.12/site-packages/graphql_server/__init__.py)"},"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"3.0.0","cli_name":"","cli_version":null,"type":"library","homepage":"https://graphql-server.org/","github":"https://github.com/graphql-python/graphql-server","docs":null,"changelog":"https://github.com/graphql-python/graphql-server/changelog","pypi":"https://pypi.org/project/graphql-server/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["web-framework","serialization","http-networking"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"import_fail","verified_at":"2026-07-03","last_verified":"2026-07-03","next_check":"2026-07-10","install_tag":null}}