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 adds the py.typed file for better mypy support.
This release adds the py.typed file for better mypy support.
This release fixes another issue with extending types.
This release fixes another issue with extending types.
This releases fixes an issue when extending types, now fields should work as they were working before even when extending an existing type.
This releases fixes an issue when extending types, now fields should work as they were working before even when extending an existing type.
One column per quarter.
Improves tooling by adding flake8-eradicate to flake8 pre-commit hook..
Improves tooling by adding flake8-eradicate to flake8 pre-commit hook..
Previously, strawberry.field had redundant arguments for the resolver, one for when strawberry.field was used as a decorator, and one for when it was
Previously, strawberry.field had redundant arguments for the resolver, one for when strawberry.field was used as a decorator, and one for when it was used as a function. These are now combined into a single argument.
The f argument of strawberry.field no longer exists. This is a backwards-incompatible change, but should not affect many users. The f argument was the first argument for strawberry.field and its use was only documented without the keyword. The fix is very straight-forward: replace any f= kwarg with resolver= .
@strawberry.type
class Query :
my_int: int = strawberry.field( f = lambda : 5 )
my_int: int = strawberry.field( resolver = lambda : 5 )
@strawberry.field
def my_float ( self ) -> float :
return 5.5
Other (minor) breaking changes
MissingArgumentsAnnotationsError ’s message now uses the original Python field name instead of the GraphQL field name. The error can only be thrown while instantiating a strawberry.field, so the Python field name should be more helpful.
As a result, strawberry.arguments.get_arguments_from_resolver() now only takes one field — the resolver Callable.
MissingFieldAnnotationError is now thrown when a strawberry.field is not type-annotated but also has no resolver to determine its type
This release fixes the Flask view that was returning 400 when there were errors in the GraphQL results. Now it always returns 200.
This release fixes the Flask view that was returning 400 when there were errors in the GraphQL results. Now it always returns 200.
Add process_result to views for Django, Flask and ASGI. They can be overridden to provide a custom response and also to process results and errors.
Add process_result to views for Django, Flask and ASGI. They can be overridden to provide a custom response and also to process results and errors.
It also removes request from Flask view’s get_root_value and get_context since request in Flask is a global.
Django example:
views.py
from django.http import HttpRequest
from strawberry.django.views import GraphQLView as BaseGraphQLView
from strawberry.http import GraphQLHTTPResponse
from strawberry.types import ExecutionResult
class GraphQLView ( BaseGraphQLView ):
def process_result (
self , request : HttpRequest, result : ExecutionResult
) -> GraphQLHTTPResponse:
return { "data" : result.data, "errors" : result.errors or []}
Flask example:
views.py
from strawberry.flask.views import GraphQLView as BaseGraphQLView
from strawberry.http import GraphQLHTTPResponse
from strawberry.types import ExecutionResult
class GraphQLView ( BaseGraphQLView ):
def process_result ( self , result : ExecutionResult) -> GraphQLHTTPResponse:
return { "data" : result.data, "errors" : result.errors or []}
ASGI example:
from strawberry.asgi import GraphQL as BaseGraphQL
from strawberry.http import GraphQLHTTPResponse
from strawberry.types import ExecutionResult
from starlette.requests import Request
from .schema import schema
class GraphQL ( BaseGraphQLView ):
async def process_result (
self , request : Request, result : ExecutionResult
) -> GraphQLHTTPResponse:
return { "data" : result.data, "errors" : result.errors or []}
This releases fixes the check for unset values.
This releases fixes the check for unset values.
Add functions get_root_value and get_context to views for Django, Flask and ASGI. They can be overridden to provide custom values per request.
Add functions get_root_value and get_context to views for Django, Flask and ASGI. They can be overridden to provide custom values per request.
Django example:
views.py
from strawberry.django.views import GraphQLView as BaseGraphQLView
class GraphQLView ( BaseGraphQLView ):
def get_context ( self , request ):
return {
"request" : request,
"custom_context_value" : "Hi!" ,
}
def get_root_value ( self , request ):
return {
"custom_root_value" : "🍓" ,
}
from django.urls import path
from .views import GraphQLView
from .schema import schema
urlpatterns = [
path( "graphql/" , GraphQLView.as_view( schema =schema)),
]
Flask example:
views.py
from strawberry.flask.views import GraphQLView as BaseGraphQLView
class GraphQLView ( BaseGraphQLView ):
def get_context ( self , request ):
return {
"request" : request,
"custom_context_value" : "Hi!" ,
}
def get_root_value ( self , request ):
return {
"custom_root_value" : "🍓" ,
}
from flask import Flask
from .views import GraphQLView
from .schema import schema
app = Flask( name )
app.add_url_rule(
"/graphql" ,
view_func =GraphQLView.as_view( "graphql_view" , schema =schema),
)
ASGI example:
app.py
from strawberry.asgi import GraphQL as BaseGraphQL
from .schema import schema
class GraphQL ( BaseGraphQLView ):
async def get_context ( self , request ):
return {
"request" : request,
"custom_context_value" : "Hi!" ,
}
async def get_root_value ( self , request ):
return {
"custom_root_value" : "🍓" ,
}
app = GraphQL(schema)
Support for default_value on inputs.
Support for default_value on inputs.
Usage:
class MyInput :
s: Optional[ str ] = None
i: int = 0
input MyInput {
s : String = null
i : Int ! = 0
}
This release adds support for file uploads within Django.
This release adds support for file uploads within Django.
We follow the following spec: https://github.com/jaydenseric/graphql-multipart-request-spec
Example:
import strawberry
from strawberry.file_uploads import Upload
@strawberry.type
class Mutation :
@strawberry.mutation
def read_text ( self , text_file : Upload) -> str :
return text_file.read().decode()
Fix issue when reusing an interface
Fix issue when reusing an interface
Fix issue when using generic types with federation
Fix issue when using generic types with federation
Add support for using lazy types inside generics.
Add support for using lazy types inside generics.
This releae add support for UUID as field types. They will be represented as GraphQL ID in the GraphQL schema.
This releae add support for UUID as field types. They will be represented as GraphQL ID in the GraphQL schema.
This release fixes support for PEP-563, now you can safely use from __future__ import annotations , like the following example:
This release fixes support for PEP-563, now you can safely use from future import annotations , like the following example:
from future import annotations
@strawberry.type
class Query :
me: MyType = strawberry.field( name = "myself" )
@strawberry.type
class MyType :
id : strawberry.ID
There are some internal breaking changes, so if you encounter any issue let us know and well try to help with the migration.
This releases brings a much needed internal refactor of how we generate GraphQL types from class definitions. Hopefully this will make easier to extend Strawberry in future.
There are some internal breaking changes, so if you encounter any issue let us know and well try to help with the migration.
In addition to the internal refactor we also fixed some bugs and improved the public api for the schema class. Now you can run queries directly on the schema by running schema.execute , schema.execute_sync and schema.subscribe on your schema.
Add websocket object to the subscription context.
Add websocket object to the subscription context.
This PR fixes a bug when declaring multiple non-named union types
This PR fixes a bug when declaring multiple non-named union types
Optimized signature reflection and added benchmarks.
Optimized signature reflection and added benchmarks.
This release fixes an issue when using named union types in generic types, for example using an optional union. This is now properly supported:
This release fixes an issue when using named union types in generic types, for example using an optional union. This is now properly supported:
@strawberry.type
class A :
a: int
@strawberry.type
class B :
b: int
Result = strawberry.union( "Result" , (A, B))
@strawberry.type
class Query :
ab: Optional[Result] = None
Fix typo in Decimal description
Fix typo in Decimal description
This release adds support for decimal type, example:
This release adds support for decimal type, example:
@strawberry.type
class Query :
@strawberry.field
def example_decimal ( self ) -> Decimal:
return Decimal( "3.14159" )
This release disables subscription in GraphiQL where it is not supported.
This release disables subscription in GraphiQL where it is not supported.
Fixes a bug when using unions and lists together
Fixes a bug when using unions and lists together
Argument conversion doesn’t populate missing args with defaults.
Argument conversion doesn’t populate missing args with defaults.
@strawberry.field
def hello ( self , null_or_unset : Optional[ str ] = UNSET, nullable : str = None ) -> None :
pass
This releases adds experimental support for apollo federation.
This releases adds experimental support for apollo federation.
Here’s an example:
import strawberry
@strawberry.federation.type ( extend = True , keys =[ "id" ])
class Campaign :
id : strawberry.ID = strawberry.federation.field( external = True )
@strawberry.field
def title ( self ) -> str :
return f "Title for {self .id } "
@ classmethod
def resolve_reference ( cls , id ):
return Campaign( id )
@strawberry.federation.type ( extend = True )
class Query :
@strawberry.field
def strawberry ( self ) -> str :
return "🍓"
schema = strawberry.federation.Schema( query =Query, types =[Campaign])
Default values make input arguments nullable when the default is None.
Default values make input arguments nullable when the default is None.
class Query :
@strawberry.field
def hello ( self , i : int = 0 , s : str = None ) -> str :
return s
type Query {
hello ( i : Int ! = 0 , s : String ): String !
}
Added sentinel value for input parameters that aren’t sent by the clients. It checks for when a field is unset.
Added sentinel value for input parameters that aren’t sent by the clients. It checks for when a field is unset.
Support for default_value on inputs and arguments.
Support for default_value on inputs and arguments.
Usage:
class MyInput :
s: Optional[ str ]
i: int = 0
input MyInput {
s : String
i : Int ! = 0
}
Improves tooling by updating pre-commit hooks and adding pre-commit to pyproject.toml .
Improves tooling by updating pre-commit hooks and adding pre-commit to pyproject.toml .
Add support for setting root_value in asgi.
Add support for setting root_value in asgi.
Usage:
schema = strawberry.Schema( query =Query)
app = strawberry.asgi.GraphQL(schema, root_value =Query())
Fix error when a subscription accepted input arguments
Fix error when a subscription accepted input arguments
This release add supports for named unions, now you can create a new union type by writing:
This release add supports for named unions, now you can create a new union type by writing:
Result = strawberry.union( "Result" , (A, B), description = "Example Result" )
This also improves the support for Union and Generic types, as it was broken before.
This release fixes a bug introduced by 0.24.0
This release fixes a bug introduced by 0.24.0
This releases allows to use resolver without having to specify root and info arguments:
This releases allows to use resolver without having to specify root and info arguments:
def function_resolver () -> str :
return "I'm a function resolver"
def function_resolver_with_params ( x : str ) -> str :
return f "I'm { x } "
@strawberry.type
class Query :
hello: str = strawberry.field( resolver =function_resolver)
hello_with_params: str = strawberry.field( resolver =function_resolver_with_params)
@strawberry.type
class Query :
@strawberry.field
def hello ( self ) -> str :
return "I'm a function resolver"
@strawberry.field
def hello_with_params ( self , x : str ) -> str :
return f "I'm { x } "
This makes it easier to reuse existing functions and makes code cleaner when not using info or root.
This release fixes the dependency of GraphQL-core
This release fixes the dependency of GraphQL-core
This releases updates the debug server to serve the API on ’/’ as well as ‘/graphql’.
This releases updates the debug server to serve the API on ’/’ as well as ‘/graphql’.
Removes the need for duplicate graphiql template file.
Removes the need for duplicate graphiql template file.
This releases replaces the playground with GraphiQL including the GraphiQL explorer plugin.
This releases replaces the playground with GraphiQL including the GraphiQL explorer plugin.
This release adds support for generic types, allowing to reuse types, here’s an example:
This release adds support for generic types, allowing to reuse types, here’s an example:
T = typing.TypeVar( "T" )
@strawberry.type
class Edge ( typing .Generic[T]):
cursor: strawberry.ID
node: T
@strawberry.type
class Query :
@strawberry.field
def int_edge ( self , info , ** kwargs ) -> Edge[ int ]:
return Edge( cursor =strawberry.ID( "1" ), node = 1 )
Update version of graphql-core to 3.1.0b2
Update version of graphql-core to 3.1.0b2
Added a Flask view that allows you to query the schema and interact with it via GraphiQL.
Added a Flask view that allows you to query the schema and interact with it via GraphiQL.
Usage:
app.py
from strawberry.flask.views import GraphQLView
from your_project.schema import schema
app = Flask( name )
app.add_url_rule(
"/graphql" , view_func =GraphQLView.as_view( "graphql_view" , schema =schema)
)
if name == "main" :
app.run( debug = True )
Improve datetime, date and time types conversion. Removes aniso dependency and also adds support for python types, so now we can do use python datetim
Improve datetime, date and time types conversion. Removes aniso dependency and also adds support for python types, so now we can do use python datetime’s types instead of our custom scalar types.
This version adds support for Django 3.0
This version adds support for Django 3.0
- Fix autogenerated return argument bug
Fix directives bugs:
Fix autogenerated return argument bug
Fix include and skip failure bug
This release improves support for permissions (it is a breaking change). Now you will receive the source and the arguments in the has_permission metho…
This release improves support for permissions (it is a breaking change). Now you will receive the source and the arguments in the has_permission method, so you can run more complex permission checks. It also allows to use permissions on fields, here’s an example:
import strawberry
from strawberry.permission import BasePermission
class IsAdmin ( BasePermission ):
message = "You are not authorized"
def has_permission ( self , source , info ):
return source.name.lower() == "Patrick" or _is_admin(info)
@strawberry.type
class User :
name: str
email: str = strawberry.field( permission_classes =[IsAdmin])
@strawberry.type
class Query :
@strawberry.field ( permission_classes =[IsAdmin])
def user ( self , info ) -> str :
return User( name = "Patrick" , email = "example@email.com" )
This releases removes support for async resolver in django as they causes issues when accessing the databases.
This releases removes support for async resolver in django as they causes issues when accessing the databases.
This release improves support for django and asgi integration.
This release improves support for django and asgi integration.
It allows to use async resolvers when using django. It also changes the status code from 400 to 200 even if there are errors this makes it possible to still use other fields even if one raised an error.
We also moved strawberry.contrib.django to strawberry.django, so if you’re using the django view make sure you update the paths.
Fix missing support for booleans when converting arguments
Fix missing support for booleans when converting arguments
This releases fixes an issue when converting complex input types, now it should support lists of complex types properly.
This releases fixes an issue when converting complex input types, now it should support lists of complex types properly.
Set is_type_of only when the type implements an interface, this allows to return different (but compatible) types in basic cases.
Set is_type_of only when the type implements an interface, this allows to return different (but compatible) types in basic cases.
Refactored CLI folder structure, importing click commands from a subfolder. Follows click’s complex example.
Refactored CLI folder structure, importing click commands from a subfolder. Follows click’s complex example.
Add support for custom GraphQL scalars.
Add support for custom GraphQL scalars.
Tests are now run on GitHub actions on both python 3.7 and python3.8 🐍
Tests are now run on GitHub actions on both python 3.7 and python3.8 🐍
Fixed some typos in contributing.md .
Fixed some typos in contributing.md .
Fixed some typos in readme.md and contributing.md.
Fixed some typos in readme.md and contributing.md.
Minimal support for registering types without fields and abstract interface querying.
Minimal support for registering types without fields and abstract interface querying.
Grammar fixes - changed ‘corresponding tests, if tests’ to ‘corresponding tests. If tests’ and removed extraneous period from ‘Provide specific exampl
Grammar fixes - changed ‘corresponding tests, if tests’ to ‘corresponding tests. If tests’ and removed extraneous period from ‘Provide specific examples to demonstrate the steps..’. Also made ‘Enhancement’ lowercase to stay consistent with its usage in documentation and changed ‘on the Strawberry’ to ‘to Strawberry’.
Added issue template files (bug_report.md, feature_request.md, other_issues.md) and a pull request template file.
Added issue template files (bug_report.md, feature_request.md, other_issues.md) and a pull request template file.
Your coding agent can read these notes before it upgrades. Set up the MCP server →