python-strawberry-graphql
Port variant v12
Summary Library for creating GraphQL APIs (3.12)
Package version 0.260.2
Homepage https://strawberry.rocks/
Keywords python
Maintainer Python Automaton
License Not yet specified
Other variants v13
Ravenports Buildsheet | History
Ravensource Port Directory | History
Last modified 15 FEB 2025, 04:25:08 UTC
Port created 14 JAN 2025, 19:34:39 UTC
Subpackage Descriptions
single [image] # Strawberry GraphQL > Python GraphQL library based on dataclasses [CircleCI] [Discord] [PyPI] ## Installation ( Quick Start ) The quick start method provides a server and CLI to get going quickly. Install with: ```shell pip install "strawberry-graphql[debug-server]" ``` ## Getting Started Create a file called `app.py` with the following code: ```python 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) ``` This will create a GraphQL schema defining a `User` type and a single query field `user` that will return a hardcoded user. To run the debug server run the following command: `shell strawberry server app ` Open the debug server by clicking on the following link: [http://0.0.0.0:8000/graphql] This will open GraphiQL where you can test the API. ### Type-checking Strawberry comes with a [mypy] plugin that enables statically type-checking your GraphQL schema. To enable it, add the following lines to your `mypy.ini` configuration: ```ini [mypy] plugins = strawberry.ext.mypy_plugin ``` [mypy]: http://www.mypy-lang.org/ ### Django Integration A Django view is provided for adding a GraphQL endpoint to your application. 1. Add the app to your `INSTALLED_APPS`. ```python INSTALLED_APPS = [ ..., # your other apps "strawberry.django", ] ``` 2. Add the view to your `urls.py` file. ```python from strawberry.django.views import GraphQLView from .schema import schema urlpatterns = [ ..., path("graphql", GraphQLView.as_view(schema=schema)), ] ``` ## WebSockets To support graphql Subscriptions over WebSockets you need to provide a WebSocket enabled server. The debug server can be made to support WebSockets with
Configuration Switches (platform-specific settings discarded)
PY312 ON Build using Python 3.12 PY313 OFF Build using Python 3.13
Package Dependencies by Type
Build (only) python312:dev:std
python-pip:single:v12
autoselect-python:single:std
Build and Runtime python312:primary:std
Runtime (only) python-graphql-core:single:v12
python-python-dateutil:single:v12
python-typing-extensions:single:v12
Download groups
main mirror://PYPIWHL/42/e6/b82332702f1c1ff31eadaf980a6f5dddd83aaf40fd481fd3519e9024389e
Distribution File Information
b3eb30bb1318b3a2d4405c100618b36e082899309fea8550029ef530d56c1276 295820 python-src/strawberry_graphql-0.260.2-py3-none-any.whl
Ports that require python-strawberry-graphql:v12
NetBox:std Flexible IPAM and DCIM tool with plugin support
python-strawberry-graphql-django:v12 Strawberry GraphQL Django extension (3.12)