strawberry-graphql
A library for creating GraphQL APIs
What it is and what it does
Strawberry GraphQL lets you define GraphQL schemas using Python dataclasses and type annotations, eliminating the need to write separate schema definition files. You decorate Python classes with @strawberry.type and methods with @strawberry.field, then pass them to strawberry.Schema() to generate a complete GraphQL API. The library handles type validation and schema generation automatically.
It integrates with popular Python web frameworks—Django, Starlette, and others—through dedicated view classes and middleware. A built-in dev server and CLI tool let you test schemas immediately. The package depends on graphql-core for GraphQL execution, python-dateutil for date handling, typing-extensions for compatibility, packaging for version parsing, and cross-web for framework integration. Type checking is supported via a mypy plugin.
Use it for:
- Build a GraphQL API endpoint in a Django application by adding the strawberry.django app and GraphQLView to your URL routing.
- Create a type-safe GraphQL schema using Python dataclasses, with automatic validation and introspection support.
- Prototype and test a GraphQL schema locally using the strawberry dev server before deploying to production.
- Integrate GraphQL into an async web framework like Starlette or Quart for high-concurrency API serving.
- Enable static type checking of your GraphQL schema definition using the mypy plugin for early error detection.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Strawberry GraphQL is a Python library for building GraphQL APIs using Python dataclasses and type annotations, with built-in support for schema definition, dev servers, and framework integrations.
Yes. Strawberry GraphQL is actively maintained, has low install friction, carries a permissive MIT license, and is in the top 5000 PyPI packages by download volume. It is a solid choice for building GraphQL APIs in Python, especially if you prefer dataclass-based schema definition and framework integration over manual schema files. No known security vulnerabilities.
Install
strawberry-graphql on PyPI
pip
pip install strawberry-graphqluv
uv add strawberry-graphqlpoetry
poetry add strawberry-graphqlInstalling strawberry-graphql
Before you install
Low install friction with a pure-Python wheel distribution. Active maintenance with a release 4 days ago. Requires Python 3.10 or later.
License in practice
MIT license permits commercial and private use with minimal restrictions; you may use, modify, and distribute the package freely provided you include the license notice.
Quickstart
pip install strawberry-graphql
import strawberry
@strawberry.type
class Query:
@strawberry.field
def hello(self) -> str:
return "world"
schema = strawberry.Schema(query=Query)
Requires Python 3.10 or later; the CLI extra requires additional dependencies beyond the base install.
Verify before relying
- Whether the mypy plugin integration works reliably with current mypy versions
- Performance characteristics under high query load compared to other GraphQL libraries
- Maturity and stability of the Django integration layer
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (<4.0,>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 5 — graphql-core, typing-extensions, python-dateutil, packaging, cross-web |
| Maintenance | actively maintained — 4 days since the last release |
| First released | |
| Downloads | 7,728,614/month — #1,701 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: strawberry_graphql-0.324.0-py3-none-any.whl
Keywords: graphql, api, rest, starlette, async
Tags
More Libraries packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
python-dateutilProvides parsing, arithmetic, and recurrence…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
strawberry-graphql-djangoGenerates GraphQL types, queries, mutations,…
permissive · top 5,000 on PyPI
ariadneAriadne is a Python library for building…
permissive · top 5,000 on PyPI
Flask-GraphQLAdds a GraphQL endpoint to Flask applications,…
permissive · top 15,000 on PyPI
grapheneGraphene is a Python library for building…
permissive · top 1,000 on PyPI
graphql-serverGraphQL-Server provides helper functions to…
permissive · top 15,000 on PyPI
graphql-coreGraphQL-core is a Python port of the GraphQL.js…
permissive · top 1,000 on PyPI
graphene-djangoGraphene-Django bridges Django models and…
permissive · top 5,000 on PyPI
sgqlcsgqlc is a Python client library for querying…
permissive · top 5,000 on PyPI
django-graphiql-debug-toolbarIntegrates Django Debug Toolbar into the…
permissive · top 15,000 on PyPI
labelboxLabelbox is a Python SDK for interacting with…
permissive · top 15,000 on PyPI