All Projects → strawberry-graphql → Strawberry

strawberry-graphql / Strawberry

Licence: mit
A new GraphQL library for Python 🍓

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Strawberry

Graphql2rest
GraphQL to REST converter: automatically generate a RESTful API from your existing GraphQL API
Stars: ✭ 181 (-79.69%)
Mutual labels:  graphql, graphql-server, graphql-schema
36 Graphql Concepts
📜 36 concepts every GraphQL developer should know.
Stars: ✭ 209 (-76.54%)
Mutual labels:  graphql, graphql-server, graphql-schema
Hotchocolate
Welcome to the home of the Hot Chocolate GraphQL server for .NET, the Strawberry Shake GraphQL client for .NET and Banana Cake Pop the awesome Monaco based GraphQL IDE.
Stars: ✭ 3,009 (+237.71%)
Mutual labels:  graphql, graphql-server, graphql-schema
Go Proto Gql
Protobuff plugins for generating graphql schema and golang to graphql bindings. Also supports a graphql gateway (Alpha)
Stars: ✭ 127 (-85.75%)
Mutual labels:  graphql, graphql-server, graphql-schema
Typegql
Create GraphQL schema with TypeScript classes.
Stars: ✭ 415 (-53.42%)
Mutual labels:  graphql, graphql-server, graphql-schema
Saleor
A modular, high performance, headless e-commerce platform built with Python, GraphQL, Django, and React.
Stars: ✭ 14,720 (+1552.08%)
Mutual labels:  graphql, hacktoberfest, django
Djangochannelsgraphqlws
Django Channels based WebSocket GraphQL server with Graphene-like subscriptions
Stars: ✭ 203 (-77.22%)
Mutual labels:  graphql, graphql-server, django
Graphql Transform Schema
Transform, filter & alias resolvers of a GraphQL schema
Stars: ✭ 84 (-90.57%)
Mutual labels:  graphql, graphql-server, graphql-schema
Parse Server
API server module for Node/Express
Stars: ✭ 19,165 (+2050.95%)
Mutual labels:  graphql, graphql-server, hacktoberfest
Altair
✨⚡️ A beautiful feature-rich GraphQL Client for all platforms.
Stars: ✭ 3,827 (+329.52%)
Mutual labels:  graphql, graphql-server, hacktoberfest
Graphql Live Query
Realtime GraphQL Live Queries with JavaScript
Stars: ✭ 112 (-87.43%)
Mutual labels:  graphql, hacktoberfest, graphql-schema
Cookiecutter Django Vue
Cookiecutter Django Vue is a template for Django-Vue projects.
Stars: ✭ 462 (-48.15%)
Mutual labels:  graphql, hacktoberfest, django
Graphql Log
Add logging to your GraphQL resolvers so you know what's going on in your app.
Stars: ✭ 94 (-89.45%)
Mutual labels:  graphql, graphql-server, graphql-schema
Apollo Server
🌍  Spec-compliant and production ready JavaScript GraphQL server that lets you develop in a schema-first way. Built for Express, Connect, Hapi, Koa, and more.
Stars: ✭ 12,145 (+1263.08%)
Mutual labels:  graphql, graphql-server, graphql-schema
Ariadne
Ariadne is a Python library for implementing GraphQL servers using schema-first approach.
Stars: ✭ 1,274 (+42.99%)
Mutual labels:  graphql, graphql-server, django
Gramps Legacy
The core data source combination engine of GrAMPS.
Stars: ✭ 198 (-77.78%)
Mutual labels:  graphql, graphql-server, graphql-schema
Fullstack Graphql
🌈 Simple Fullstack GraphQL Application. API built with Express + GraphQL + Sequelize (supports MySQL, Postgres, Sqlite and MSSQL). WebApp built with React + Redux to access the API. Written in ES6 using Babel + Webpack.
Stars: ✭ 955 (+7.18%)
Mutual labels:  graphql, graphql-server, graphql-schema
Sql To Graphql Schema Generator
⚛️ Generate GraphQL Scheme Online From SQL Query - https://sql-to-graphql.now.sh/
Stars: ✭ 32 (-96.41%)
Mutual labels:  graphql, hacktoberfest, graphql-schema
Wp Graphql
🚀 GraphQL API for WordPress
Stars: ✭ 3,097 (+247.59%)
Mutual labels:  graphql, graphql-server, hacktoberfest
Graphql Engine
Blazing fast, instant realtime GraphQL APIs on your DB with fine grained access control, also trigger webhooks on database events.
Stars: ✭ 24,845 (+2688.44%)
Mutual labels:  graphql, graphql-server, hacktoberfest

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:

pip install strawberry-graphql[debug-server]

Getting Started

Create a file called app.py with the following code:

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:

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:

[mypy]
plugins = strawberry.ext.mypy_plugin

Django Integration

A Django view is provided for adding a GraphQL endpoint to your application.

  1. Add the app to your INSTALLED_APPS.
INSTALLED_APPS = [
    ...
    'strawberry.django',
]
  1. Add the view to your urls.py file.
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 these commands:

pip install strawberry-graphql[debug-server]
pip install uvicorn[standard]

Contributing

We use poetry to manage dependencies, to get started follow these steps:

git clone https://github.com/strawberry-graphql/strawberry
cd strawberry
poetry install
poetry run pytest

This will install all the dependencies (including dev ones) and run the tests.

Pre commit

We have a configuration for pre-commit, to add the hook run the following command:

pre-commit install

Links

Licensing

The code in this project is licensed under MIT license. See LICENSE for more information.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].