NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
PyPI, #1553 most downloaded on PyPI
A library for creating GraphQL APIs
Latest stable
0.341.2
Last release 15 days ago
07 Nov 2026
Ships fairly regularly
a new release about every 1 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
1155 releases · first in 2019
Drag across the ruler to compare, or tap a release to open it.
Nothing published for this version
This release changes an internal implementation for FastAPI’s GraphQL router. This should reduce overhead when using the context, and it shouldn’t aff
This release changes an internal implementation for FastAPI’s GraphQL router. This should reduce overhead when using the context, and it shouldn’t affect your code.
Contributed by Kristján Valur Jónsson via PR #2278
This release adds support for generic in arguments, see the following example:
This release adds support for generic in arguments, see the following example:
T = TypeVar( "T" )
@strawberry.type
class Node (Generic[T]):
@strawberry.field
def data ( self , arg : T) -> T: # arg is also generic
return arg
Contributed by A. Coady via PR #2293
Your coding agent can read these notes before it upgrades. Set up the MCP server →
Allowed CustomScalar | None syntax for python >= 3.10.
Allowed CustomScalar | None syntax for python >= 3.10.
Contributed by Guillaume Andreu Sabater via PR #2279
This release fixes errors when using Union-of-lazy-types
This release fixes errors when using Union-of-lazy-types
Contributed by Paulo Costa via PR #2271
This release refactors the chalice integration in order to keep it consistent with the other integrations.
This release refactors the chalice integration in order to keep it consistent with the other integrations.
This release adds a new MaskErrors extension that can be used to hide error messages from the client to prevent exposing sensitive details. By default
This release adds a new MaskErrors extension that can be used to hide error messages from the client to prevent exposing sensitive details. By default it masks all errors raised in any field resolver.
import strawberry
from strawberry.extensions import MaskErrors
schema = strawberry.Schema(
Query,
extensions =[
MaskErrors(),
],
)
Contributed by Jonathan Kim via PR #2248
This release improves the error message that you get when trying to use an enum that hasn’t been decorated with @strawberry.enum inside a type’s field
This release improves the error message that you get when trying to use an enum that hasn’t been decorated with @strawberry.enum inside a type’s field.
Contributed by Rise Riyo via PR #2267
This release adds support for printing schema directives on an input type object, for example the following schema:
This release adds support for printing schema directives on an input type object, for example the following schema:
@strawberry.schema_directive ( locations =[Location.INPUT_FIELD_DEFINITION])
class RangeInput :
min : int
max : int
@strawberry.input
class CreateUserInput :
name: str
age: int = strawberry.field( directives =[RangeInput( min = 1 , max = 100 )])
prints the following:
directive @rangeInput ( min : Int !, max : Int !) on INPUT_FIELD_DEFINITION
input Input @sensitiveInput ( reason : "GDPR" ) {
firstName : String !
age : Int ! @rangeInput ( min : 1 , max : 100 )
}
Contributed by Etty via PR #2233
This release fixes an issue that prevented using strawberry.lazy with relative paths.
This release fixes an issue that prevented using strawberry.lazy with relative paths.
The following should work now:
@strawberry.type
class TypeA :
b: Annotated[ "TypeB" , strawberry.lazy( ".type_b" )]
Contributed by Paulo Costa via PR #2244
This release adds pyupgrade to our CI and includes some minor changes to keep our codebase modern.
This release adds pyupgrade to our CI and includes some minor changes to keep our codebase modern.
Contributed by Liel Fridman via PR #2255
This release fixes an issue that prevented using lazy types inside generic types.
This release fixes an issue that prevented using lazy types inside generic types.
The following is now allowed:
T = TypeVar( "T" )
TypeAType = Annotated[ "TypeA" , strawberry.lazy( "tests.schema.test_lazy.type_a" )]
@strawberry.type
class Edge (Generic[T]):
node: T
@strawberry.type
class Query :
users: Edge[TypeAType]
Contributed by Patrick Arminio via PR #2254
These release allow you to define a different url in the GraphQLTestClient , the default is “/graphql/”.
These release allow you to define a different url in the GraphQLTestClient , the default is “/graphql/”.
Here’s an example with Starlette client:
import pytest
from starlette.testclient import TestClient
from strawberry.asgi.test import GraphQLTestClient
@pytest.fixture
def graphql_client () -> GraphQLTestClient:
return GraphQLTestClient(
TestClient(app, base_url = "http://localhost:8000" ), url = "/api/"
)
Contributed by Etty via PR #2238
Nothing published for this version
Nothing published for this version
This release fixes a type issue when passing scalar_overrides to strawberry.Schema
This release fixes a type issue when passing scalar_overrides to strawberry.Schema
Contributed by Patrick Arminio via PR #2251
Fix support for arguments where arg.type=LazyType["EnumType"]
Fix support for arguments where arg.type=LazyType["EnumType"]
Contributed by Paulo Costa via PR #2245
Nothing published for this version
This will prevent strawberry from triggering its own warning on deprecated imports.
Updated unset import, from strawberry.arguments to strawberry.unset in codebase.
This will prevent strawberry from triggering its own warning on deprecated imports.
Contributed by dependabot via PR #2219
This release fixes the type of strawberry.federation.field, this will prevent errors from mypy and pyright when doing the following:
This release fixes the type of strawberry.federation.field, this will prevent errors from mypy and pyright when doing the following:
@strawberry.federation.type ( keys =[ "id" ])
class Location :
id : strawberry.ID
celestial_body: CelestialBody = strawberry.federation.field(
resolver =resolve_celestial_body
)
Contributed by Patrick Arminio via PR #2222
This release allows to create a federation schema without having to pass a Query type. This is useful when your schema only extends some types without
This release allows to create a federation schema without having to pass a Query type. This is useful when your schema only extends some types without adding any additional root field.
@strawberry.federation.type ( keys =[ "id" ])
class Location :
id : strawberry.ID
name: str = strawberry.federation.field( override = "start" )
schema = strawberry.federation.Schema( types =[Location])
Contributed by Patrick Arminio via PR #2220
Nothing published for this version
Nothing published for this version
This release fixes an issue with strawberry.federation.field that prevented instantiating field when passing a resolver function.
This release fixes an issue with strawberry.federation.field that prevented instantiating field when passing a resolver function.
Contributed by Patrick Arminio via PR #2218
This release fixes an issue that prevented using strawberry.field with UNSET as the default value.
This release fixes an issue that prevented using strawberry.field with UNSET as the default value.
Contributed by Patrick Arminio via PR #2128
Reduce the number of required dependencies, by marking Pygments and python-multipart as optional. These dependencies are still necessary for some func
Reduce the number of required dependencies, by marking Pygments and python-multipart as optional. These dependencies are still necessary for some functionality, and so users of that functionality need to ensure they’re installed, either explicitly or via an extra:
Pygments is still necessary when using Strawberry in debug mode, and is included in the strawberry-graphql[debug-server] extra.
python-multipart is still necessary when using strawberry.file_uploads.Upload with FastAPI or Starlette, and is included in the strawberry-graphql[fastapi] and strawberry-graphql[asgi] extras, respectively.
There is now also the strawberry-graphql[cli] extra to support commands like strawberry codegen and strawberry export-schema .
Contributed by Huon Wilson via PR #2205
Improve resolving performance by avoiding extra calls for basic fields.
Improve resolving performance by avoiding extra calls for basic fields.
This change improves performance of resolving a query by skipping Info creation and permission checking for fields that don’t have a resolver or permission classes. In local benchmarks it improves performance of large results by ~14%.
Contributed by Jonathan Kim via PR #2194
Support storing metadata in strawberry fields.
Support storing metadata in strawberry fields.
Contributed by Paulo Costa via PR #2190
Nothing published for this version
Fixes false positives with the mypy plugin. Happened when to_pydantic was called on a type that was converted pydantic with all_fields=True.
Fixes false positives with the mypy plugin. Happened when to_pydantic was called on a type that was converted pydantic with all_fields=True.
Also fixes the type signature when to_pydantic is defined by the user.
from pydantic import BaseModel
from typing import Optional
import strawberry
class MyModel ( BaseModel ):
email: str
password: Optional[ str ]
@strawberry.experimental.pydantic.input ( model =MyModel, all_fields = True )
class MyModelStrawberry : ...
MyModelStrawberry( email = "" ).to_pydantic()
Contributed by James Chua via PR #2017
This release updates the mypy plugin and the typing for Pyright to treat all strawberry fields as keyword-only arguments. This reflects a previous cha
This release updates the mypy plugin and the typing for Pyright to treat all strawberry fields as keyword-only arguments. This reflects a previous change to the Strawberry API.
Contributed by Paulo Costa via PR #2191
Bug fix: Do not force kw-only=False in fields specified with strawberry.field()
Bug fix: Do not force kw-only=False in fields specified with strawberry.field()
Contributed by Paulo Costa via PR #2189
This release fixes a small issue that might happen when uploading files and not passing the operations object.
This release fixes a small issue that might happen when uploading files and not passing the operations object.
Contributed by Patrick Arminio via PR #2192
Nothing published for this version
DeprecationWarning: Use 'content=<...>' to upload raw bytes/text content.
Fix warnings during unit tests for Sanic’s upload.
Otherwise running unit tests results in a bunch of warning like this:
DeprecationWarning: Use 'content=<...>' to upload raw bytes/text content.
Contributed by Paulo Costa via PR #2178
Nothing published for this version
This release improves the dataloader class with new features:
This release improves the dataloader class with new features:
Explicitly cache invalidation, prevents old data from being fetched after a mutation
Importing data into the cache, prevents unnecessary load calls if the data has already been fetched by other means.
Contributed by Paulo Costa via PR #2149
This release adds improved support for Pyright and Pylance, VSCode default language server for Python.
This release adds improved support for Pyright and Pylance, VSCode default language server for Python.
Using strawberry.type , strawberry.field , strawberry.input and strawberry.enum will now be correctly recognized by Pyright and Pylance and won’t show errors.
Contributed by Patrick Arminio via PR #2172
Fix invalid deprecation warning issued on arguments annotated by a subclassed strawberry.types.Info .
Fix invalid deprecation warning issued on arguments annotated by a subclassed strawberry.types.Info .
Thanks to @ThirVondukr for the bug report!
Example:
class MyInfo ( Info ):
pass
@strawberry.type
class Query :
@strawberry.field
def is_tasty ( self , info : MyInfo) -> bool :
"""Subclassed info argument no longer raises deprecation warning."""
Contributed by San Kilkis via PR #2137
This release fixes the conversion of generic aliases when using pydantic.
This release fixes the conversion of generic aliases when using pydantic.
Contributed by Silas Sewell via PR #2152
Fix version parsing issue related to dev builds of Mypy in strawberry.ext.mypy_plugin
Fix version parsing issue related to dev builds of Mypy in strawberry.ext.mypy_plugin
Contributed by San Kilkis via PR #2157
Convert Tuple and Sequence types to GraphQL list types.
Convert Tuple and Sequence types to GraphQL list types.
Example:
from collections.abc import Sequence
from typing import Tuple
@strawberry.type
class User :
pets: Sequence[Pet]
favourite_ice_cream_flavours: Tuple[IceCreamFlavour]
Contributed by Jonathan Kim via PR #2164
This release adds strawberry.lazy which allows you to define the type of the field and its path. This is useful when you want to define a field with a
This release adds strawberry.lazy which allows you to define the type of the field and its path. This is useful when you want to define a field with a type that has a circular dependency.
For example, let’s say we have a User type that has a list of Post and a Post type that has a User :
posts.py
from typing import TYPE_CHECKING, Annotated
import strawberry
if TYPE_CHECKING:
from .users import User
@strawberry.type
class Post :
title: str
author: Annotated[ "User" , strawberry.lazy( ".users" )]
users.py
from typing import TYPE_CHECKING, Annotated, List
import strawberry
if TYPE_CHECKING:
from .posts import Post
@strawberry.type
class User :
name: str
posts: List[Annotated[ "Post" , strawberry.lazy( ".posts" )]]
Contributed by Patrick Arminio via PR #2158
Nothing published for this version
⚠️ This is a breaking change! Whenever instantiating a Strawberry type make sure that you only pass values are keyword arguments:
This release changes how dataclasses are created to make use of the new kw_only argument in Python 3.10 so that fields without a default value can now follow a field with a default value. This feature is also backported to all other supported Python versions.
More info: https://docs.python.org/3/library/dataclasses.html#dataclasses.dataclass
For example:
@strawberry.type
class MyType :
a: str = "Hi"
b: int
⚠️ This is a breaking change! Whenever instantiating a Strawberry type make sure that you only pass values are keyword arguments:
MyType( "foo" , 3 )
MyType( a = "foo" , b = 3 )
Contributed by Jonathan Kim via PR #1187
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
Nothing published for this version
This release fixes a bug in the subscription clean up when subscribing using the graphql-transport-ws protocol, which could occasionally cause a ‘fina
This release fixes a bug in the subscription clean up when subscribing using the graphql-transport-ws protocol, which could occasionally cause a ‘finally’ statement within the task to not get run, leading to leaked resources.
Contributed by rjwills28 via PR #2141
This release fixes a couple of small styling issues with the GraphiQL explorer
This release fixes a couple of small styling issues with the GraphiQL explorer
Contributed by Patrick Arminio via PR #2143
Nothing published for this version
This release adds support for passing schema directives to Schema(..., types=[]) . This can be useful if using a built-inschema directive that’s not s
This release adds support for passing schema directives to Schema(..., types=[]) . This can be useful if using a built-inschema directive that’s not supported by a gateway.
For example the following:
import strawberry
from strawberry.scalars import JSON
from strawberry.schema_directive import Location
@strawberry.type
class Query :
example: JSON
@strawberry.schema_directive ( locations =[Location.SCALAR], name = "specifiedBy" )
class SpecifiedBy :
name: str
schema = strawberry.Schema( query =Query, types =[SpecifiedBy])
will print the following SDL:
directive @specifiedBy ( name : String !) on SCALAR
"""
The JSON scalar type represents JSON values as specified by ECMA-404.
"""
scalar JSON
@specifiedBy (
url : "https://ecma-international.org/wp-content/uploads/ECMA-404_2nd_edition_december_2017.pdf"
)
type Query {
example : JSON !
}
Contributed by Patrick Arminio via PR #2140
Nothing published for this version
This release fixes an issue with the updated GraphiQL interface.
This release fixes an issue with the updated GraphiQL interface.
Contributed by Doctor via PR #2138
This release updates the built-in GraphiQL version to version 2.0, which means you can now enjoy all the new features that come with the latest versio
This release updates the built-in GraphiQL version to version 2.0, which means you can now enjoy all the new features that come with the latest version!
Contributed by Matt Exact via PR #1889
Nothing published for this version
One column per quarter.