All Projects → ciscorn → starlette-graphene3

ciscorn / starlette-graphene3

Licence: MIT License
An ASGI app for using Graphene v3 with Starlette / FastAPI

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to starlette-graphene3

fastapi-zeit-now
A simple example of deploying FastAPI as a Zeit Serverless Function
Stars: ✭ 24 (-53.85%)
Mutual labels:  asgi, starlette, fastapi
msgpack-asgi
Drop-in MessagePack support for ASGI applications and frameworks
Stars: ✭ 100 (+92.31%)
Mutual labels:  asgi, starlette, fastapi
arel
Lightweight browser hot reload for Python ASGI web apps
Stars: ✭ 69 (+32.69%)
Mutual labels:  asgi, starlette, fastapi
serverless-mangum-examples
Example ASGI applications and Serverless Framework configurations using Mangum
Stars: ✭ 26 (-50%)
Mutual labels:  asgi, starlette, fastapi
inboard
🚢 Docker images and utilities to power your Python APIs and help you ship faster. With support for Uvicorn, Gunicorn, Starlette, and FastAPI.
Stars: ✭ 106 (+103.85%)
Mutual labels:  asgi, starlette, fastapi
morelia server
Server for MoreliaTalk network
Stars: ✭ 25 (-51.92%)
Mutual labels:  starlette, fastapi
CourseCake
By serving course 📚 data that is more "edible" 🍰 for developers, we hope CourseCake offers a smooth approach to build useful tools for students.
Stars: ✭ 21 (-59.62%)
Mutual labels:  graphene, fastapi
fastql
⚙️ Full stack, Modern Web Application Generator. ✨ Using FastAPI, GraphQL, PostgreSQL as database, Docker, automatic HTTPS and more. 🔖
Stars: ✭ 80 (+53.85%)
Mutual labels:  graphene, fastapi
starlite
Light, Flexible and Extensible ASGI API framework
Stars: ✭ 1,525 (+2832.69%)
Mutual labels:  asgi, starlette
fastapi-azure-auth
Easy and secure implementation of Azure AD for your FastAPI APIs 🔒 B2C, single- and multi-tenant support.
Stars: ✭ 174 (+234.62%)
Mutual labels:  asgi, fastapi
spectree
API spec validator and OpenAPI document generator for Python web frameworks.
Stars: ✭ 190 (+265.38%)
Mutual labels:  asgi, starlette
fastapi-tdd-docker
Test-Driven Development with FastAPI and Docker
Stars: ✭ 89 (+71.15%)
Mutual labels:  starlette, fastapi
fastapi-websocket-broadcast
Websocket 'broadcast' demo using FastAPI/Starlette
Stars: ✭ 106 (+103.85%)
Mutual labels:  starlette, fastapi
starlette-opentracing
Opentracing support for Starlette and FastApi
Stars: ✭ 62 (+19.23%)
Mutual labels:  starlette, fastapi
TikTokDownloader PyWebIO
🚀「Douyin_TikTok_Download_API」是一个开箱即用的高性能异步抖音|TikTok数据爬取工具,支持API调用,在线批量解析及下载。
Stars: ✭ 919 (+1667.31%)
Mutual labels:  asgi, fastapi
webargs-starlette
Declarative request parsing and validation for Starlette with webargs
Stars: ✭ 36 (-30.77%)
Mutual labels:  asgi, starlette
fastapi-project
FastAPI application without global variables(almost) =)
Stars: ✭ 26 (-50%)
Mutual labels:  asgi, fastapi
async-asgi-testclient
A framework-agnostic library for testing ASGI web applications
Stars: ✭ 123 (+136.54%)
Mutual labels:  asgi, starlette
fastapi-users
Ready-to-use and customizable users management for FastAPI
Stars: ✭ 1,920 (+3592.31%)
Mutual labels:  starlette, fastapi
starlette-discord
"Login with Discord" support for Starlette and FastAPI
Stars: ✭ 15 (-71.15%)
Mutual labels:  starlette, fastapi

starlette-graphene3

A simple ASGI app for using Graphene v3 with Starlette / FastAPI.

Test codecov pypi package

It supports:

Alternatives

Installation

pip3 install -U starlette-graphene3

Example

import asyncio

import graphene
from graphene_file_upload.scalars import Upload

from starlette.applications import Starlette
from starlette_graphene3 import GraphQLApp, make_graphiql_handler


class User(graphene.ObjectType):
    id = graphene.ID()
    name = graphene.String()


class Query(graphene.ObjectType):
    me = graphene.Field(User)

    def resolve_me(root, info):
        return {"id": "john", "name": "John"}


class FileUploadMutation(graphene.Mutation):
    class Arguments:
        file = Upload(required=True)

    ok = graphene.Boolean()

    def mutate(self, info, file, **kwargs):
        return FileUploadMutation(ok=True)


class Mutation(graphene.ObjectType):
    upload_file = FileUploadMutation.Field()


class Subscription(graphene.ObjectType):
    count = graphene.Int(upto=graphene.Int())

    async def subscribe_count(root, info, upto=3):
        for i in range(upto):
            yield i
            await asyncio.sleep(1)


app = Starlette()
schema = graphene.Schema(query=Query, mutation=Mutation, subscription=Subscription)

app.mount("/", GraphQLApp(schema, on_get=make_graphiql_handler()))  # Graphiql IDE

# app.mount("/", GraphQLApp(schema, on_get=make_playground_handler()))  # Playground IDE
# app.mount("/", GraphQLApp(schema)) # no IDE

GraphQLApp

GraphQLApp(schema, [options...])

class GraphQLApp:
    def __init__(
        self,
        schema: graphene.Schema,  # Requied
        *,
        # Optional keyword parameters
        on_get: Optional[
            Callable[[Request], Union[Response, Awaitable[Response]]]
        ] = None,  # optional HTTP handler for GET requests
        context_value: ContextValue = None,
        root_value: RootValue = None,
        middleware: Optional[Middleware] = None,
        error_formatter: Callable[[GraphQLError], Dict[str, Any]] = format_error,
        logger_name: Optional[str] = None,
        playground: bool = False,  # deprecating
        execution_context_class: Optional[Type[ExecutionContext]] = None,
    ):
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].