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
Enhances strawberry.extensions.tracing.opentelemetry to include spans for the Parsing and Validation phases of request handling. These occur before yo
Enhances strawberry.extensions.tracing.opentelemetry to include spans for the Parsing and Validation phases of request handling. These occur before your resovler is called, so now you can see how much time those phases take up!
Contributed by Michael Ossareh PR #1274
Fix extensions argument type definition on strawberry.Schema
Fix extensions argument type definition on strawberry.Schema
Contributed by Guillaume Andreu Sabater PR #1276
One column per quarter.
This release introduces some brand new extensions to help improve the performance of your GraphQL server:
This release introduces some brand new extensions to help improve the performance of your GraphQL server:
ParserCache - Cache the parsing of a query in memory
ValidationCache - Cache the validation step of execution
For complicated queries these 2 extensions can improve performance by over 50%!
Example:
import strawberry
from strawberry.extensions import ParserCache, ValidationCache
schema = strawberry.Schema(
Query,
extensions =[
ParserCache(),
ValidationCache(),
],
)
This release also removes the validate_queries and validation_rules parameters on the schema.execute* methods in favour of using the DisableValidation and AddValidationRule extensions.
Contributed by Jonathan Kim PR #1196
This release adds support for Sanic v21
This release adds support for Sanic v21
Contributed by dependabot PR #1105
Fixes returning “500 Internal Server Error” responses to requests with malformed json when running with ASGI integration.
Fixes returning “500 Internal Server Error” responses to requests with malformed json when running with ASGI integration.
Contributed by Olesia Grydzhuk PR #1260
This release adds python_name to the Info type.
This release adds python_name to the Info type.
Contributed by Joe Freeman PR #1257
Fix the Pydantic conversion method for Enum values, and add a mechanism to specify an interface type when converting from Pydantic. The Pydantic inter
Fix the Pydantic conversion method for Enum values, and add a mechanism to specify an interface type when converting from Pydantic. The Pydantic interface is really a base dataclass for the subclasses to extend. When you do the conversion, you have to use strawberry.experimental.pydantic.interface to let us know that this type is an interface. You also have to use your converted interface type as the base class for the sub types as normal.
Contributed by Matt Allen PR #1241
Fixes a bug with the selected_fields property on info when an operation variable is not defined.
Fixes a bug with the selected_fields property on info when an operation variable is not defined.
Issue #1248 .
Contributed by Jonathan Kim PR #1249
Fix issues ( #1158 and #1104 ) where Generics using LazyTypes and Enums would not be properly resolved
Fix issues ( #1158 and #1104 ) where Generics using LazyTypes and Enums would not be properly resolved
These now function as expected:
T = TypeVar( "T" )
@strawberry.enum
class VehicleMake ( Enum ):
FORD = "ford"
TOYOTA = "toyota"
HONDA = "honda"
@strawberry.type
class GenericForEnum (Generic[T]):
generic_slot: T
@strawberry.type
class SomeType :
field: GenericForEnum[VehicleMake]
another_file.py
@strawberry.type
class TypeFromAnotherFile :
something: bool
this_file.py
T = TypeVar( "T" )
@strawberry.type
class GenericType (Generic[T]):
item: T
@strawberry.type
class RealType :
lazy: GenericType[LazyType[ "TypeFromAnotherFile" , "another_file.py" ]]
Contributed by ignormies PR #1235
This release adds fragment and input variable information to the selected_fields attribute on the Info object.
This release adds fragment and input variable information to the selected_fields attribute on the Info object.
Contributed by Jonathan Kim PR #1213
Fixes a bug in the Pydantic conversion code around Union values.
Fixes a bug in the Pydantic conversion code around Union values.
Contributed by Matt Allen PR #1231
Fixes a bug in the export-schema command around the handling of local modules.
Fixes a bug in the export-schema command around the handling of local modules.
Contributed by Matt Allen PR #1233
Fixes a bug in the Pydantic conversion code around complex Optional values.
Fixes a bug in the Pydantic conversion code around complex Optional values.
Contributed by Matt Allen PR #1229
This release adds a new exception called InvalidFieldArgument which is raised when a Union or Interface is used as an argument type. For example this
This release adds a new exception called InvalidFieldArgument which is raised when a Union or Interface is used as an argument type. For example this will raise an exception:
import strawberry
@strawberry.type
class Noun :
text: str
@strawberry.type
class Verb :
text: str
Word = strawberry.union( "Word" , types =(Noun, Verb))
@strawberry.field
def add_word ( word : Word) -> bool : ...
Contributed by Mohammad Hossein Yazdani PR #1222
Fix type resolution when inheriting from types from another module using deferred annotations.
Fix type resolution when inheriting from types from another module using deferred annotations.
Contributed by Daniel Bowring PR #1010
This release adds support for Pyright and Pylance, improving the integration with Visual Studio Code!
This release adds support for Pyright and Pylance, improving the integration with Visual Studio Code!
Contributed by Patrick Arminio PR #922
Change the version constraint of opentelemetry-sdk and opentelemetry-api to <2
Change the version constraint of opentelemetry-sdk and opentelemetry-api to <2
Contributed by Michael Ossareh PR #1226
This release adds support for enabling subscriptions in GraphiQL on Django by setting a flag subscriptions_enabled on the BaseView class.
This release adds support for enabling subscriptions in GraphiQL on Django by setting a flag subscriptions_enabled on the BaseView class.
from strawberry.django.views import AsyncGraphQLView
from .schema import schema
urlpatterns = [
path(
"graphql" ,
AsyncGraphQLView.as_view(
schema =schema, graphiql = True , subscriptions_enabled = True
),
)
]
Contributed by lijok PR #1215
This release fixes an issue with the MyPy plugin that prevented using TextChoices from django in strawberry.enum .
This release fixes an issue with the MyPy plugin that prevented using TextChoices from django in strawberry.enum .
Contributed by Patrick Arminio PR #1202
This release improves how we deal with custom scalars. Instead of being global they are now scoped to the schema. This allows you to have multiple sch
This release improves how we deal with custom scalars. Instead of being global they are now scoped to the schema. This allows you to have multiple schemas in the same project with different scalars.
Also you can now override the built in scalars with your own custom implementation. Out of the box Strawberry provides you with custom scalars for common Python types like datetime and Decimal . If you require a custom implementation of one of these built in scalars you can now pass a map of overrides to your schema:
from datetime import datetime, timezone
import strawberry
EpochDateTime = strawberry.scalar(
datetime,
serialize = lambda value : int (value.timestamp()),
parse_value = lambda value : datetime.fromtimestamp( int (value), timezone.utc),
)
@strawberry.type
class Query :
@strawberry.field
def current_time ( self ) -> datetime:
return datetime.now()
schema = strawberry.Schema(
Query,
scalar_overrides ={
datetime: EpochDateTime,
},
)
result = schema.execute_sync( "{ currentTime }" )
assert result.data == { "currentTime" : 1628683200 }
Contributed by Jonathan Kim PR #1147
This release allows to install Strawberry along side click version 8.
This release allows to install Strawberry along side click version 8.
Contributed by Patrick Arminio PR #1181
This release add full support for async directives and fixes and issue when using directives and async extensions.
This release add full support for async directives and fixes and issue when using directives and async extensions.
@strawberry.type
class Query :
name: str = "Banana"
@strawberry.directive (
locations =[DirectiveLocation.FIELD], description = "Make string uppercase"
)
async def uppercase ( value : str ):
return value.upper()
schema = strawberry.Schema( query =Query, directives =[uppercase])
Contributed by Patrick Arminio PR #1179
Fix issue where strawberry.Private fields on converted Pydantic types were not added to the resulting dataclass.
Fix issue where strawberry.Private fields on converted Pydantic types were not added to the resulting dataclass.
Contributed by Paul Sud PR #1173
This releases fixes a MyPy issue that prevented from using types created with create_type as base classes. This is now allowed and doesn’t throw any e
This releases fixes a MyPy issue that prevented from using types created with create_type as base classes. This is now allowed and doesn’t throw any error:
import strawberry
from strawberry.tools import create_type
@strawberry.field
def name () -> str :
return "foo"
MyType = create_type( "MyType" , [name])
class Query ( MyType ): ...
Contributed by Patrick Arminio PR #1175
This release fixes an import error when trying to import create_type without having opentelemetry installed.
This release fixes an import error when trying to import create_type without having opentelemetry installed.
Contributed by Patrick Arminio PR #1171
This release adds support for the latest version of the optional opentelemetry dependency.
This release adds support for the latest version of the optional opentelemetry dependency.
Contributed by Patrick Arminio PR #1170
This release allows background tasks to be set with the ASGI integration. Tasks can be set on the response in the context, and will then get run after
This release allows background tasks to be set with the ASGI integration. Tasks can be set on the response in the context, and will then get run after the query result is returned.
from starlette.background import BackgroundTask
@strawberry.mutation
def create_flavour ( self , info : strawberry.Info) -> str :
info.context[ "response" ].background = BackgroundTask(...)
Contributed by Joe Freeman PR #1168
This release caches attributes on the Info type which aren’t delegated to the core info object.
This release caches attributes on the Info type which aren’t delegated to the core info object.
Contributed by A. Coady PR #1167
This releases fixes an issue where you were not allowed to use duck typing and return a different type that the type declared on the field when the ty
This releases fixes an issue where you were not allowed to use duck typing and return a different type that the type declared on the field when the type was implementing an interface. Now this works as long as you return a type that has the same shape as the field type.
Contributed by Patrick Arminio PR #1150
This release improves execution performance significantly by lazy loading attributes on the Info type 🏎
This release improves execution performance significantly by lazy loading attributes on the Info type 🏎
Contributed by Jonathan Kim PR #1165
This release adds support for asynchronous hooks to the Strawberry extension-system. All available hooks can now be implemented either synchronously o
This release adds support for asynchronous hooks to the Strawberry extension-system. All available hooks can now be implemented either synchronously or asynchronously.
It’s also possible to mix both synchronous and asynchronous hooks within one extension.
from strawberry.extensions import Extension
class MyExtension ( Extension ):
async def on_request_start ( self ):
print ( "GraphQL request start" )
def on_request_end ( self ):
print ( "GraphQL request end" )
Contributed by Jonathan Ehwald PR #1142
This release refactors the reload feature of the built-in debug server. The refactor made the debug server more responsive and allowed us to remove hu
This release refactors the reload feature of the built-in debug server. The refactor made the debug server more responsive and allowed us to remove hupper from the dependencies.
Contributed by Jonathan Ehwald PR #1114
This releases pins graphql-core to only accept patch versions in order to prevent breaking changes since graphql-core doesn’t properly follow semantic…
This releases pins graphql-core to only accept patch versions in order to prevent breaking changes since graphql-core doesn’t properly follow semantic versioning.
Contributed by Jonathan Kim PR #1162
This release improves the default logging format for errors to include more information about the errors. For example it will show were an error was o
This release improves the default logging format for errors to include more information about the errors. For example it will show were an error was originated in a request:
GraphQL request:2:5
1 | query {
2 | example
| ^
3 | }
Contributed by Ivan Gonzalez PR #1152
This release adds support for asynchronous permission classes. The only difference to their synchronous counterpart is that the has_permission method
This release adds support for asynchronous permission classes. The only difference to their synchronous counterpart is that the has_permission method is asynchronous.
from strawberry.permission import BasePermission
class IsAuthenticated ( BasePermission ):
message = "User is not authenticated"
async def has_permission ( self , source , info , ** kwargs ):
return True
Contributed by Jonathan Ehwald PR #1125
Get a field resolver correctly when extending from a pydantic model
Get a field resolver correctly when extending from a pydantic model
Contributed by Jonathan Kim PR #1116
This release adds asgi as an extra dependencies group for Strawberry. Now you can install the required dependencies needed to use Strawberry with ASGI
This release adds asgi as an extra dependencies group for Strawberry. Now you can install the required dependencies needed to use Strawberry with ASGI by running:
pip install 'strawberry-graphql[asgi]'
Contributed by A. Coady PR #1036
This releases adds selected_fields on the info objects and it allows to introspect the fields that have been selected in a GraphQL operation.
This releases adds selected_fields on the info objects and it allows to introspect the fields that have been selected in a GraphQL operation.
This can become useful to run optimisation based on the queried fields.
Contributed by A. Coady PR #874
This release adds a query depth limit validation rule so that you can guard against malicious queries:
This release adds a query depth limit validation rule so that you can guard against malicious queries:
import strawberry
from strawberry.schema import default_validation_rules
from strawberry.tools import depth_limit_validator
validation_rules = default_validation_rules + [depth_limit_validator( 3 )]
result = schema.execute_sync(
"""
query MyQuery {
user {
pets {
owner {
pets {
name
}
}
}
}
}
""" ,
validation_rules =validation_rules,
)
assert len (result.errors) == 1
assert result.errors[ 0 ].message == "'MyQuery' exceeds maximum operation depth of 3"
Contributed by Jonathan Kim PR #1021
Addition of app.add_websocket_route("/subscriptions", graphql_app) to FastAPI example docs
Addition of app.add_websocket_route("/subscriptions", graphql_app) to FastAPI example docs
Contributed by Anton Melser PR #1103
This release changes how we map Pydantic fields to types to allow using older version of Pydantic.
This release changes how we map Pydantic fields to types to allow using older version of Pydantic.
Contributed by Patrick Arminio PR #1071
This release makes the strawberry server command inform the user about missing dependencies required by the builtin debug server.
This release makes the strawberry server command inform the user about missing dependencies required by the builtin debug server.
Also hupper a package only used by said command has been made optional.
Contributed by Jonathan Ehwald PR #1107
Switch CDN used to load GraphQLi dependencies from jsdelivr.com to unpkg.com
Switch CDN used to load GraphQLi dependencies from jsdelivr.com to unpkg.com
Contributed by Tim Savage PR #1096
This release adds support for disabling auto camel casing. It does so by introducing a new configuration parameter to the schema.
This release adds support for disabling auto camel casing. It does so by introducing a new configuration parameter to the schema.
You can use it like so:
@strawberry.type
class Query :
example_field: str = "Example"
schema = strawberry.Schema( query =Query, config =StrawberryConfig( auto_camel_case = False ))
Contributed by Patrick Arminio PR #798
Fix for regression when defining inherited types with explicit fields.
Fix for regression when defining inherited types with explicit fields.
Contributed by A. Coady PR #1076
This releases improves the MyPy plugin to be more forgiving of settings like follow_imports = skip which would break the type checking.
This releases improves the MyPy plugin to be more forgiving of settings like follow_imports = skip which would break the type checking.
This is a continuation of the previous release and fixes for type checking issues.
Contributed by Patrick Arminio PR #1078
This releases improves the MyPy plugin to be more forgiving of settings like follow_imports = skip which would break the type checking.
This releases improves the MyPy plugin to be more forgiving of settings like follow_imports = skip which would break the type checking.
Contributed by Patrick Arminio PR #1077
This release removes a TypeGuard import to prevent errors when using older versions of typing_extensions .
This release removes a TypeGuard import to prevent errors when using older versions of typing_extensions .
Contributed by Patrick Arminio PR #1074
This is a breaking change if you were calling the constructor for StrawberryField , StrawberryArgument , etc. and using arguments such as is_optional…
Refactor of the library’s typing internals. Previously, typing was handled individually by fields, arguments, and objects with a hodgepodge of functions to tie it together. This change creates a unified typing system that the object, fields, and arguments each hook into.
Mainly replaces the attributes that were stored on StrawberryArgument and StrawberryField with a hierarchy of StrawberryTypes.
Introduces StrawberryAnnotation , as well as StrawberryType and some subclasses, including StrawberryList , StrawberryOptional , and StrawberryTypeVar .
This is a breaking change if you were calling the constructor for StrawberryField , StrawberryArgument , etc. and using arguments such as is_optional or child .
@strawberry.field no longer takes an argument called type_ . It instead takes a StrawberryAnnotation called type_annotation .
Contributed by ignormies PR #906
This release fixes an issue with the federation printer that prevented using federation directives with types that were implementing interfaces.
This release fixes an issue with the federation printer that prevented using federation directives with types that were implementing interfaces.
This is now allowed:
@strawberry.interface
class SomeInterface :
id : strawberry.ID
@strawberry.federation.type ( keys =[ "upc" ], extend = True )
class Product ( SomeInterface ):
upc: str = strawberry.federation.field( external = True )
Contributed by Patrick Arminio PR #1068
This release changes our graphiql.html template to use a specific version of js-cookie to prevent a JavaScript error, see:
This release changes our graphiql.html template to use a specific version of js-cookie to prevent a JavaScript error, see:
https://github.com/js-cookie/js-cookie/issues/698
Contributed by 星 PR #1062
This release fixes a regression that broke strawberry-graphql-django.
This release fixes a regression that broke strawberry-graphql-django.
Field.get_results now always receives the info argument.
Contributed by Lauri Hintsala PR #1047
This release only changes some internal code to make future improvements easier.
This release only changes some internal code to make future improvements easier.
Contributed by Patrick Arminio PR #1044
Matching the behaviour of graphql-core , passing an incorrect ISO string value for a Time, Date or DateTime scalar now raises a GraphQLError instead o
Matching the behaviour of graphql-core , passing an incorrect ISO string value for a Time, Date or DateTime scalar now raises a GraphQLError instead of the original parsing error.
The GraphQLError will include the error message raised by the string parser, e.g. Value cannot represent a DateTime: "2021-13-01T09:00:00". month must be in 1..12
Fixes #1022 by making starlette an optional dependency.
Fixes #1022 by making starlette an optional dependency.
Contributed by Marcel Wiegand PR #1027
Add ability to specific the graphql name for a resolver argument. E.g.,
Add ability to specific the graphql name for a resolver argument. E.g.,
from typing import Annotated
import strawberry
@strawberry.input
class HelloInput :
name: str = "world"
@strawberry.type
class Query :
@strawberry.field
def hello (
self , input_ : Annotated[HelloInput, strawberry.argument( name = "input" )]
) -> str :
return f "Hi { input_.name } "
Contributed by Daniel Bowring PR #1024
This release fixes a bug that was preventing the use of an enum member as the default value for an argument.
This release fixes a bug that was preventing the use of an enum member as the default value for an argument.
For example:
@strawberry.enum
class IceCreamFlavour ( Enum ):
VANILLA = "vanilla"
STRAWBERRY = "strawberry"
CHOCOLATE = "chocolate"
PISTACHIO = "pistachio"
@strawberry.mutation
def create_flavour ( self , flavour : IceCreamFlavour = IceCreamFlavour.STRAWBERRY) -> str :
return f " { flavour.name } "
Contributed by Jonathan Kim PR #1015
This release reverts the changes made in v0.65.4 that caused an issue leading to circular imports when using the strawberry-graphql-django extension p
This release reverts the changes made in v0.65.4 that caused an issue leading to circular imports when using the strawberry-graphql-django extension package.
Contributed by Lauri Hintsala PR #1019
This release fixes the IDE integration where package strawberry.django could not be find by some editors like vscode.
This release fixes the IDE integration where package strawberry.django could not be find by some editors like vscode.
Contributed by Lauri Hintsala PR #994
This release fixes the ASGI subscription implementation by handling disconnecting clients properly.
This release fixes the ASGI subscription implementation by handling disconnecting clients properly.
Additionally, the ASGI implementation has been internally refactored to match the AIOHTTP implementation.
Contributed by Jonathan Ehwald PR #1002
Your coding agent can read these notes before it upgrades. Set up the MCP server →