starlette-graphene
A focused GraphQL-over-HTTP ASGI application for Graphene and Starlette.
Requirements
- Python 3.11–3.14
- Graphene 3.x
- Starlette
Install
uv add starlette-graphene graphene starlette
pip install starlette-graphene
Quick start
import graphene
from starlette.applications import Starlette
from starlette_graphene import GraphQLApp
class Query(graphene.ObjectType):
hello = graphene.String()
@staticmethod
def resolve_hello(root, info):
return "Hello, world!"
app = Starlette()
app.mount("/graphql", GraphQLApp(graphene.Schema(query=Query)))
Send a JSON operation:
curl -X POST http://127.0.0.1:8000/graphql \
-H 'content-type: application/json' \
--data '{"query":"{ hello }"}'
{"data":{"hello":"Hello, world!"}}
Context
Use context_value for a static context, or pass a sync/async callable that accepts the Starlette request connection. The callable result becomes info.context.
async def build_context(connection):
return {"request": connection}
app.mount("/graphql", GraphQLApp(schema, context_value=build_context))
HTTP behavior
The endpoint accepts JSON and raw-GraphQL POST requests, and read-only GET requests. It returns GraphQL execution errors in the response body; malformed transport input receives an HTTP 4xx response. See the HTTP API reference for the full contract.
Migration
Version 1.0 removes the embedded GraphiQL page and changes several transport behaviors. Read the 1.0 migration guide before upgrading from 0.x.
Development
uv sync --all-groups
make lint
make test
make build
make test enforces 100% branch coverage for the supported public contract.
License
starlette-graphene is distributed under the Apache License 2.0.
Metadata
Release files for starlette-graphene 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| starlette_graphene-1.0.0.tar.gz | 52.4 kB | With provenance | Details for starlette_graphene-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| starlette_graphene-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for starlette_graphene-1.0.0-py3-none-any.whl |
Total release size: 62.6 kB
Release files / starlette_graphene-1.0.0.tar.gz
| Download URL | starlette_graphene-1.0.0.tar.gz |
|---|---|
| Size | 52.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8dff2b69daadeba3456b09814c47e0d5865669cd8f52981e93db837d3926169b
|
|
BLAKE2b-256 checksum How to use checksums |
006c58233012246c98072c50a74d2f08b88c7f7c5cea885eb53627a7657b4872
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 20, 2026.
Transparency logRelease files / starlette_graphene-1.0.0-py3-none-any.whl
| Download URL | starlette_graphene-1.0.0-py3-none-any.whl |
|---|---|
| Size | 10.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1cc5d4707f7bc140ed2580f87b95df6e5e4b0fe0298eaa356fedc970daaab254
|
|
BLAKE2b-256 checksum How to use checksums |
5970e736f8f5f8cc7e5b33ecd3519f4e3d24a69d16c09d9a60ab47268440db82
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 20, 2026.
Transparency logSecurity for starlette-graphene 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for starlette_graphene-1.0.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 20, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.