NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
PyPI · #1573 most downloaded on PyPI
A library for creating GraphQL APIs
Last release today
04 Oct 2026
Ships fairly regularly
a new release about every 3 weeks
Nearly every release is documented
notes for 60 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
8 years old
1125 releases · first in 2019
This release fixes a bug in the annotation parser that prevents using strict typinh for Optional arguments which have their default set to UNSET.
This release fixes a bug in the annotation parser that prevents using strict typinh for Optional arguments which have their default set to UNSET.
Contributed by Sarah Henkens PR #1467
This release adds support for mypy 0.920.
This release adds support for mypy 0.920.
Contributed by Yossi Rozantsev PR #1503
This releases fixes a bug with the opentracing extension where the tracer wasn’t replacing the field name correctly.
One column per quarter.
This releases fixes a bug with the opentracing extension where the tracer wasn’t replacing the field name correctly.
This release modifies the internal utility function await_maybe towards updating mypy to 0.920.
This release modifies the internal utility function await_maybe towards updating mypy to 0.920.
Contributed by Yossi Rozantsev PR #1505
Change context_getter in strawberry.fastapi.GraphQLRouter to merge, rather than overwrite, default and custom getters.
Change context_getter in strawberry.fastapi.GraphQLRouter to merge, rather than overwrite, default and custom getters.
This mean now you can always access the request instance from info.context , even when using a custom context getter.
Contributed by Tommy Smith PR #1494
This release changes when we fetch the event loop in dataloaders to prevent using the wrong event loop in some occasions.
This release changes when we fetch the event loop in dataloaders to prevent using the wrong event loop in some occasions.
Contributed by Patrick Arminio PR #1498
This release fixes an issue that prevented from lazily importing enum types using LazyType.
This release fixes an issue that prevented from lazily importing enum types using LazyType.
Contributed by Patrick Arminio PR #1501
Nothing published for this version
This release allows running strawberry as a script, for example, you can start the debug server with the following command:
This release allows running strawberry as a script, for example, you can start the debug server with the following command:
Terminal window
python -m strawberry server schema
Contributed by YogiLiu PR #1481
This release adds support for uvicorn 0.16
This release adds support for uvicorn 0.16
Contributed by dependabot PR #1487
This fixes the previous release that introduced a direct dependency on Django.
This fixes the previous release that introduced a direct dependency on Django.
Contributed by Guillaume Andreu Sabater PR #1489
This release adds support for Django 4.0
This release adds support for Django 4.0
Contributed by Guillaume Andreu Sabater PR #1484
This release operation_type to the ExecutionContext type that is available in extensions. It also gets the operation_name from the query if one isn’t
This release operation_type to the ExecutionContext type that is available in extensions. It also gets the operation_name from the query if one isn’t provided by the client.
Contributed by Jonathan Kim PR #1286
This release adds support for passing json_encoder and json_dumps_params to Django JsonResponse via a view.
This release adds support for passing json_encoder and json_dumps_params to Django JsonResponse via a view.
from json import JSONEncoder
from django.urls import path
from strawberry.django.views import AsyncGraphQLView
from .schema import schema
.as_viewurlpatterns = [
path(
"graphql" ,
AsyncGraphQLView.as_view(
schema =schema,
json_encoder =JSONEncoder,
json_dumps_params ={ "separators" : ( "," , ":" )},
),
),
]
class CustomAsyncGraphQLView ( AsyncGraphQLView ):
json_encoder = JSONEncoder
json_dumps_params = { "separators" : ( "," , ":" )}
Contributed by Illia Volochii PR #1472
Fix cross-module type resolving for fields and resolvers
Fix cross-module type resolving for fields and resolvers
The following two issues are now fixed:
A field with a generic (typeless) resolver looks up the type relative to the resolver and not the class the field is defined in. (#1448)
When inheriting fields from another class the origin of the fields are set to the inheriting class and not the class the field is defined in.
Both these issues could lead to a rather undescriptive error message:
TypeError: (…) fields cannot be resolved. Unexpected type ‘None’
Contributed by Michael P. Jung PR #1449
This releases fixes an issue where you were not allowed to return a non-strawberry type for fields that return an interface. Now this works as long as
This releases fixes an issue where you were not allowed to return a non-strawberry type for fields that return an interface. Now this works as long as each type implementing the interface implements an is_type_of classmethod. Previous automatic duck typing on types that implement an interface now requires explicit resolution using this classmethod.
Contributed by Etty PR #1299
This release adds a GraphQLTestClient . It hides the http request’s details and asserts that there are no errors in the response (you can always disab
This release adds a GraphQLTestClient . It hides the http request’s details and asserts that there are no errors in the response (you can always disable this behavior by passing asserts_errors=False ). This makes it easier to test queries and makes your tests cleaner.
If you are using pytest you can add a fixture in conftest.py
import pytest
from django.test.client import Client
from strawberry.django.test import GraphQLTestClient
@pytest.fixture
def graphql_client ():
yield GraphQLTestClient(Client())
And use it everywere in your test methods
def test_strawberry ( graphql_client ):
query = """
query Hi($name: String!) {
hi(name: $name)
}
"""
result = graphql_client.query(query, variables ={ "name" : "Marcotte" })
assert result.data == { "hi" : "Hi Marcotte!" }
It can be used to test the file uploads as well
from django.core.files.uploadedfile import SimpleUploadedFile
def test_upload ( graphql_client ):
f = SimpleUploadedFile( "file.txt" , b "strawberry" )
query = """
mutation($textFile: Upload!) {
readText(textFile: $textFile)
}
"""
response = graphql_client.query(
query =query,
variables ={ "textFile" : None },
files ={ "textFile" : f},
)
assert response.data[ "readText" ] == "strawberry"
Contributed by Etty PR #1225
This release fixes an issue that prevented using enums as arguments for generic types inside unions.
This release fixes an issue that prevented using enums as arguments for generic types inside unions.
Contributed by Patrick Arminio PR #1463
This release fixes the message of InvalidFieldArgument to properly show the field’s name in the error message.
This release fixes the message of InvalidFieldArgument to properly show the field’s name in the error message.
Contributed by Etty PR #1322
This release fixes an issue that prevented using classmethod s and staticmethod s as resolvers
This release fixes an issue that prevented using classmethod s and staticmethod s as resolvers
import strawberry
@strawberry.type
class Query :
@strawberry.field
@ staticmethod
def static_text () -> str :
return "Strawberry"
@strawberry.field
@ classmethod
def class_name ( cls ) -> str :
return cls . name
Contributed by Illia Volochii PR #1430
This release improves type checking support for strawberry.union and now allows to use unions without any type issue, like so:
This release improves type checking support for strawberry.union and now allows to use unions without any type issue, like so:
@strawberry.type
class User :
name: str
@strawberry.type
class Error :
message: str
UserOrError = strawberry.union( "UserOrError" , (User, Error))
x: UserOrError = User( name = "Patrick" )
Contributed by Patrick Arminio PR #1438
Fix init of Strawberry types from pydantic by skipping fields that have resolvers.
Fix init of Strawberry types from pydantic by skipping fields that have resolvers.
Contributed by Nina PR #1451
This release fixes an issubclass test failing for Literal s in the experimental pydantic integration.
This release fixes an issubclass test failing for Literal s in the experimental pydantic integration.
Contributed by Nina PR #1445
This release changes how strawberry.Private is implemented to improve support for type checkers.
This release changes how strawberry.Private is implemented to improve support for type checkers.
Contributed by Patrick Arminio PR #1437
This release adds support for AWS Chalice. A framework for deploying serverless applications using AWS.
This release adds support for AWS Chalice. A framework for deploying serverless applications using AWS.
A view for aws chalice has been added to the strawberry codebase. This view embedded in a chalice app allows anyone to get a GraphQL API working and hosted on AWS in minutes using a serverless architecture.
Contributed by Mark Sheehan PR #923
This release fixes the naming generation of generics when passing a generic type to another generic, like so:
This release fixes the naming generation of generics when passing a generic type to another generic, like so:
@strawberry.type
class Edge (Generic[T]):
node: T
@strawberry.type
class Connection (Generic[T]):
edges: List[T]
Connection[Edge[ int ]]
Contributed by Patrick Arminio PR #1436
This releases updates the typing_extension dependency to latest version.
This releases updates the typing_extension dependency to latest version.
Contributed by dependabot PR #1417
This release renames an internal exception from NotAnEnum to ObjectIsNotAnEnumError .
This release renames an internal exception from NotAnEnum to ObjectIsNotAnEnumError .
Contributed by Patrick Arminio PR #1317
This release changes how we handle GraphQL names. It also introduces a new configuration option called name_converter . This option allows you to spec
This release changes how we handle GraphQL names. It also introduces a new configuration option called name_converter . This option allows you to specify a custom NameConverter to be used when generating GraphQL names.
This is currently not documented because the API will change slightly in future as we are working on renaming internal types.
This release also fixes an issue when creating concrete types from generic when passing list objects.
Contributed by Patrick Arminio PR #1394
This release fixes our MyPy plugin and re-adds support for typechecking classes created with the apollo federation decorator.
This release fixes our MyPy plugin and re-adds support for typechecking classes created with the apollo federation decorator.
Contributed by Patrick Arminio PR #1414
Add on_executing_* hooks to extensions to allow you to override the execution phase of a GraphQL operation.
Add on_executing_* hooks to extensions to allow you to override the execution phase of a GraphQL operation.
Contributed by Jonathan Kim PR #1400
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
This release fixes an issue with schema directives not being printed correctly.
This release fixes an issue with schema directives not being printed correctly.
Contributed by Patrick Arminio PR #1376
This release introduces initial support for schema directives and updates the federation support to use that.
This release introduces initial support for schema directives and updates the federation support to use that.
Full support will be implemented in future releases.
Contributed by Patrick Arminio PR #815
Field definition uses output of default_factory as the GraphQL default_value .
Field definition uses output of default_factory as the GraphQL default_value .
a_field: list[ str ] = strawberry.field( default_factory = list )
aField : [ String !]! = []
Contributed by A. Coady PR #1371
This release fixed the typing support for Pyright.
This release fixed the typing support for Pyright.
Contributed by Patrick Arminio PR #1363
This release adds an extra dependency for FastAPI to prevent it being downloaded even when not needed.
This release adds an extra dependency for FastAPI to prevent it being downloaded even when not needed.
To install Strawberry with FastAPI support you can do:
pip install 'strawberry-graphql[fastapi]'
Contributed by Patrick Arminio PR #1366
This release fixes the merge_types type signature.
This release fixes the merge_types type signature.
Contributed by Guillaume Andreu Sabater PR #1348
This release adds support for FastAPI integration using APIRouter.
This release adds support for FastAPI integration using APIRouter.
import strawberry
from fastapi import FastAPI
from strawberry.fastapi import GraphQLRouter
@strawberry.type
class Query :
@strawberry.field
def hello ( self ) -> str :
return "Hello World"
schema = strawberry.Schema(Query)
graphql_app = GraphQLRouter(schema)
app = FastAPI()
app.include_router(graphql_app, prefix = "/graphql" )
Contributed by Jiří Bireš PR #1291
Improve help texts for CLI to work better on ZSH.
Improve help texts for CLI to work better on ZSH.
Contributed by Magnus Markling PR #1360
Errors encountered in subscriptions will now be logged to the strawberry.execution logger as errors encountered in Queries and Mutations are. <3
Errors encountered in subscriptions will now be logged to the strawberry.execution logger as errors encountered in Queries and Mutations are. <3
Contributed by Michael Ossareh PR #1316
Add logic to convert arguments of type LazyType.
Add logic to convert arguments of type LazyType.
Contributed by Luke Murray PR #1350
This release fixes a bug where passing scalars in the scalar_overrides parameter wasn’t being applied consistently.
This release fixes a bug where passing scalars in the scalar_overrides parameter wasn’t being applied consistently.
Contributed by Jonathan Kim PR #1212
Pydantic fields’ description are now copied to the GraphQL schema
Pydantic fields’ description are now copied to the GraphQL schema
import pydantic
import strawberry
class UserModel ( pydantic . BaseModel ):
age: str = pydantic.Field(..., description = "Description" )
@strawberry.experimental.pydantic.type (UserModel)
class User :
age: strawberry.auto
type User {
"""Description"""
age: String!
}
Contributed by Guillaume Andreu Sabater PR #1332
We now run our tests against Windows during CI!
We now run our tests against Windows during CI!
Contributed by Michael Ossareh PR #1321
Add a shortcut to merge queries, mutations. E.g.:
Add a shortcut to merge queries, mutations. E.g.:
import strawberry
from strawberry.tools import merge_types
@strawberry.type
class QueryA : ...
@strawberry.type
class QueryB : ...
ComboQuery = merge_types( "ComboQuery" , (QueryB, QueryA))
schema = strawberry.Schema( query =ComboQuery)
Contributed by Alexandru Mărășteanu PR #1273
Makes the GraphQLSchema instance accessible from resolvers via the info parameter.
Makes the GraphQLSchema instance accessible from resolvers via the info parameter.
Contributed by Aryan Iyappan PR #1311
Fix bug where errors thrown in the on_parse_* extension hooks were being swallowed instead of being propagated.
Fix bug where errors thrown in the on_parse_* extension hooks were being swallowed instead of being propagated.
Contributed by Jonathan Kim PR #1324
Adds support for the auto type annotation described in #1192 to the Pydantic integration, which allows a user to define the list of fields without hav
Adds support for the auto type annotation described in #1192 to the Pydantic integration, which allows a user to define the list of fields without having to re-specify the type themselves. This gives better editor and type checker support. If you want to expose every field you can instead pass all_fields=True to the decorators and leave the body empty.
import pydantic
import strawberry
from strawberry.experimental.pydantic import auto
class User ( pydantic . BaseModel ):
age: int
password: str
@strawberry.experimental.pydantic.type (User)
class UserType :
age: auto
password: auto
Contributed by Matt Allen PR #1280
Nothing published for this version
This release adds a safety check on strawberry.type , strawberry.input and strawberry.interface decorators. When you try to use them with an object th
This release adds a safety check on strawberry.type , strawberry.input and strawberry.interface decorators. When you try to use them with an object that is not a class, you will get a nice error message: strawberry.type can only be used with classes
Contributed by dependabot PR #1278
Add Starlette to the integrations section on the documentation.
Add Starlette to the integrations section on the documentation.
Contributed by Marcelo Trylesinski PR #1287
This release add support for the upcoming python 3.10 and it adds support for the new union syntax, allowing to declare unions like this:
This release add support for the upcoming python 3.10 and it adds support for the new union syntax, allowing to declare unions like this:
import strawberry
@strawberry.type
class User :
name: str
@strawberry.type
class Error :
code: str
@strawberry.type
class Query :
find_user: User | Error
Contributed by Patrick Arminio PR #719
This release adds support for the graphql-transport-ws GraphQL over WebSocket protocol. Previously Strawberry only supported the legacy graphql-ws pro
This release adds support for the graphql-transport-ws GraphQL over WebSocket protocol. Previously Strawberry only supported the legacy graphql-ws protocol.
Developers can decide which protocols they want to accept. The following example shows how to do so using the ASGI integration. By default, both protocols are accepted. Take a look at our GraphQL subscription documentation to learn more.
from strawberry.asgi import GraphQL
from strawberry.subscriptions import GRAPHQL_TRANSPORT_WS_PROTOCOL
from api.schema import schema
app = GraphQL(schema, subscription_protocols =[GRAPHQL_TRANSPORT_WS_PROTOCOL])
Contributed by Jonathan Ehwald PR #1256
Nests the resolver under the correct span; prior to this change your span would have looked something like:
Nests the resolver under the correct span; prior to this change your span would have looked something like:
GraphQL Query
GraphQL Parsing
GraphQL Validation
my_resolver
my_span_of_interest #1
my_sub_span_of_interest #2
After this change you’ll have:
GraphQL Query
GraphQL Parsing
GraphQL Validation
GraphQL Resolving: my_resolver
my_span_of_interest #1
my_sub_span_of_interest #2
Contributed by Michael Ossareh PR #1281
Your coding agent can read these notes before it upgrades. Set up the MCP server →