awesome-python icon indicating copy to clipboard operation
awesome-python copied to clipboard

Add Ariadne GraphQL library

Open andriykohut opened this issue 4 years ago • 0 comments

What is this Python project?

Ariadne is a Python library for implementing GraphQL servers using a schema-first approach.

What's the difference between this Python project and similar ones?

Schema-first approach - unlike graphene the schema is defined explicitly and is not inferred from code, it's more light-weight and less opinionated, it has subscriptions, file uploads, tracing and other useful stuff built-in.

Example hello world app with starlette:

from ariadne import QueryType, make_executable_schema
from ariadne.asgi import GraphQL
from starlette.applications import Starlette

type_defs = """
    type Query {
        hello: String!
    }
"""

query = QueryType()


@query.field("hello")
def resolve_hello(*_):
    return "Hello world!"


# Create executable schema instance
schema = make_executable_schema(type_defs, query)

app = Starlette(debug=True)
app.mount("/graphql", GraphQL(schema, debug=True))

Here's a really nice into and justification from one of the authors: https://blog.mirumee.com/schema-first-graphql-the-road-less-travelled-cf0e50d5ccff

Anyone who agrees with this pull request could submit an Approve review to it.

andriykohut avatar Mar 06 '21 09:03 andriykohut