Skip to content

GraphQL-python-archive/graphql-env

Repository files navigation

GraphQL-Env Build Status PyPI version Coverage Status

GraphQL-Env provides a GraphQL environment with pluggable query optimizers (backends) for Python GraphQL servers.

Installation

For instaling GraphQL-Env, just run this command in your shell

pip install graphql-env

Examples

Here is one example for you to get started:

from graphql_env import GraphQLEnv

# schema = graphene.Schema(...)

graphql_env = GraphQLEnv(
    schema=schema,
)

my_query = graphql_env.document_from_string('{ hello }')
result = my_query.execute()

Usage with Quiver Cloud

Quiver is a JIT compiler for GraphQL queries. It helps to improve serialization time by a factor of 5~10x.

Here is an example usage for Quiver:

from graphql_env import GraphQLEnv
from graphql_env.backend.quiver_cloud import GraphQLQuiverCloudBackend

# schema = graphene.Schema(...)

graphql_env = GraphQLEnv(
    schema=schema,
    backend=GraphQLQuiverCloudBackend(
        'http://******@api.graphql-quiver.com'
    )
)

my_query = graphql_env.document_from_string('{ hello }')
result = my_query.execute()

Note: Quiver Cloud uses requests under the hood. Systems like Google App Engine will need a monkeypatch to requests in order to work properly.

Contributing

After cloning this repo, ensure dependencies are installed by running:

pip install -e ".[test]"

After developing, the full test suite can be evaluated by running:

py.test graphql_env --cov=graphql_env --benchmark-skip # Use -v -s for verbose mode

You can also run the benchmarks with:

py.test graphql_env --benchmark-only

Documentation

The documentation is generated using the excellent Sphinx and a custom theme.

The documentation dependencies are installed by running:

cd docs
pip install -r requirements.txt

Then to produce a HTML version of the documentation:

make html

About

[DEPRECATED] The package for setting up a GraphQL Environment with custom backends

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy