Skip to content

Repository files navigation

GraphQL-Env Build StatusPyPI versionCoverage 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:

fromgraphql_envimportGraphQLEnv# 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:

fromgraphql_envimportGraphQLEnvfromgraphql_env.backend.quiver_cloudimportGraphQLQuiverCloudBackend# 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

Contributing

Stars

8 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages