Registry / web-framework / strawberry-graphql

strawberry-graphql

JSON →
library0.324.0pypypi✓ verified 23d ago

Strawberry GraphQL is a modern Python library for creating GraphQL APIs that leverages type annotations and dataclasses. It follows a code-first philosophy, providing type safety, async/await support, and first-class integrations with popular web frameworks like FastAPI and Django. It aims to stay close to the GraphQL specification while offering a developer-friendly experience. Currently at version 0.314.3, it has an active development cycle with frequent releases. [1, 3, 4, 7, 12, 14, 15, 20]

pip install strawberry-graphql
INSTALL
IMPORT
SIG · STRAWBERRY-GRAPHQL
S
strawberry-graphql
web-frameworkpythonv0.324.0
Install
4.5s avg
Import
725ms
Disk
74MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.324.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.761s · 73.9MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 4.5s · import 0.689s · 74MB
74MB installed
● package 74MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

strawberry
import strawberry
import strawberry @strawberry.type
Schema
from strawberry import Schema
type
from strawberry import type

This quickstart demonstrates how to define a simple GraphQL schema with a `User` type and a `Query` field that returns a hardcoded user. It then instantiates a `strawberry.Schema` and explains how to run it using Strawberry's built-in development server and CLI. [3, 4]

import strawberry @strawberry.type class User: name: str age: int @strawberry.type class Query: @strawberry.field def user(self) -> User: return User(name="Patrick", age=100) schema = strawberry.Schema(query=Query) # To run this example locally: # 1. Install with `pip install "strawberry-graphql[cli]"` # 2. Save the code above as `app.py` # 3. Run `strawberry dev app` in your terminal. # 4. Access the GraphiQL interface at http://0.0.0.0:8000/graphql in your browser.
strawberry --version
Debug
Known issues
breakingIn `v0.243.0`, support for GraphQL multipart file uploads was disabled by default, requiring explicit opt-in. Additionally, Django CSRF protection became enabled by default for Strawberry Django views, requiring the `csrf_exempt` decorator if previous behavior is desired. [2]
fix
For multipart uploads, explicitly set `multipart_uploads_enabled=True` in your view configuration. For Django CSRF, add `@csrf_exempt` to your `GraphQLView.as_view()` in `urls.py` if you need to disable it. [2]
affects: >=0.243.0
breakingIn `v0.268.0`, the generated GraphQL schema type for `GlobalID` (when using `relay.Node`) was changed to `ID`. While runtime behavior is unaffected, schema introspection will now report `ID` instead of `GlobalID`. [6]
fix
Update any client-side code or tools that expect the `GlobalID` type in the schema to now expect `ID`. If legacy behavior is required, set `config=StrawberryConfig(relay_use_legacy_global_id=True)` when initializing the schema. [6]
affects: >=0.268.0
deprecatedIn `v0.213.0`, the `graphiql` parameter used in HTTP integration views (e.g., `GraphQLView` for FastAPI, Flask, Django) was deprecated and replaced by `graphql_ide`. [11]
fix
Replace `graphiql=True` with `graphql_ide='graphiql'` (or `'apollo-sandbox'`, `'vega'`) in your view configuration. Example: `GraphQLView.as_view(schema=schema, graphql_ide='graphiql')`. [11]
affects: >=0.213.0
breakingThe `types` parameter in `strawberry.union()` was deprecated in `v0.191.0` and completely removed in `v0.312.0`. [5]
fix
Migrate to using Python's native `|` operator for unions (e.g., `str | int`) or `typing.Union` (e.g., `typing.Union[str, int]`). A codemod is available: `strawberry upgrade annotated-union <path>`. [5]
affects: >=0.191.0
gotchaThe `strawberry.ext.mypy_plugin` has seen significant changes across versions. It was removed in `v0.269.0` (as it was no longer needed due to `@dataclass_transform`) but partially restored in `v0.310.2` to support experimental Pydantic types. Relying on its specific behavior or even its presence can be inconsistent. [5]
fix
Review your `mypy.ini` configuration. If you're not using experimental Pydantic types, you might be able to remove `strawberry.ext.mypy_plugin`. If you are, ensure you're on a compatible version and understand its current limitations. Pydantic users primarily need `pydantic.mypy_plugin`. [5]
affects: >=0.269.0
Upgrade
Version history
0.324.0latest on PyPI · released Aug 10, 2026
Audit
Dependencies
pythonrequiredRequired Python version.
fastapioptionalOptional integration for FastAPI web framework.
djangooptionalOptional integration for Django web framework.
uvicornoptionalASGI server often used for development or production with framework integrations.
Agent activity
14 hits · last 30 days
node
10
Meta
1
Amazon
1
OpenAI (training)
1
Resources