Install & Compatibility
Where this runs
tested against v2.0.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.480s · 24.8MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 4.7s · import 0.430s · 25MB
23MB installed
● package 23MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
execute_graphql_request
✓ from graphql_server import execute_graphql_request
✗ from graphql_server import create_app
GraphQLSchema
✓ from graphql_server import GraphQLSchema
format_execution_result
✓ from graphql_server import format_execution_result
This quickstart demonstrates how to initialize a basic GraphQL application handler using `create_app`. For a fully functional server, this handler needs to be integrated with a web framework (like Flask, Django, etc.), which, for `graphql-server-core` v2.x, typically required additional framework-specific packages (e.g., `graphql-server-flask`).
from graphql import build_schema
from graphql_server_core import create_app
def resolve_hello(root, info):
return 'Hello from GraphQL-Server-Core!'
# Define your GraphQL schema
schema = build_schema('''
type Query {
hello: String
}
''')
# Attach a resolver to the 'hello' field
schema.query.set_field('hello', resolve_hello)
# Create a basic GraphQL application handler
# For actual serving, this `app` object would be integrated with a WSGI/ASGI server
# e.g., using Flask or FastAPI, which would require separate packages
app = create_app(
schema=schema,
pretty=True, # Optional: format output nicely
enable_graphiql=False # Optional: disable GraphiQL interface
)
# Example of how to simulate a request (for demonstration, not a full server)
# In a real application, a web framework would handle the request/response cycle.
# This library primarily provides the 'app' handler.
# print("App handler created, integrate with a web framework to serve.")
Debug
Known issues
breakingThe `graphql-server-core` package (v2.x) has been effectively superseded by `graphql-server` (v3.x). `graphql-server` is a refactored and consolidated library that bundles all framework integrations (Flask, Aiohttp, Sanic, etc.) directly into a single package, simplifying dependencies and usage.fixIt is highly recommended to migrate to `graphql-server` (v3.x) for new projects and consider migration for existing `graphql-server-core` projects. The import paths and API for framework integration will differ significantly. Refer to the `graphql-server` documentation.
affects: All versions of graphql-server-core (up to 2.x)
deprecatedThis `graphql-server-core` library is considered to be in maintenance mode, with active development having shifted to its successor, `graphql-server` (v3.x). While functional, it may not receive new features or extensive updates.fixPlan to use `graphql-server` (v3.x) instead, which provides a more modern and integrated solution for building GraphQL servers in Python.
affects: All versions of graphql-server-core
gotchaFor `graphql-server-core` v2.x, integrating with specific web frameworks (like Flask or Aiohttp) required installing separate companion packages (e.g., `graphql-server-flask`, `graphql-server-aiohttp`). This is unlike `graphql-server` v3.x, where framework integrations are bundled.fixIf sticking with `graphql-server-core` v2.x, ensure you install the correct framework-specific integration package for your chosen web framework (e.g., `pip install graphql-server-flask`). If migrating, note that `graphql-server` v3.x handles these integrations differently and usually doesn't require separate `graphql-server-` packages.
affects: graphql-server-core <= 2.0.0
gotcha`graphql-server-core` v2.x specifically depends on `graphql-core>=3.1,<3.2`. Incompatibilities can arise if using other versions of `graphql-core`.fixEnsure your environment has `graphql-core` installed within the specified range. If you need to use a newer `graphql-core` version (e.g., `3.2.x` or higher), you will likely need to migrate to `graphql-server` v3.x, which is built on a more recent `graphql-core` foundation.
affects: graphql-server-core <= 2.0.0
Upgrade
Version history
2.0.0latest on PyPI · released Mar 17, 2020
Audit
Dependencies
graphql-corerequiredCore GraphQL execution engine. Version 2.0.0 requires graphql-core>=3.1,<3.2.