Metadata-Version: 2.2
Name: gqlmod
Version: 0.6.2
Summary: GraphQL Query Modules
Author: Jamie Bliss
Author-email: jamie@ivyleav.es
License: LGPL
Project-URL: Tip Jar, https://ko-fi.com/astraluma
Project-URL: Source Code, https://github.com/gqlmod/gqlmod
Project-URL: Documentation, https://gqlmod.readthedocs.io/
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)
Classifier: Operating System :: OS Independent
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: graphql-core>=3.0a0
Requires-Dist: import-x
Requires-Dist: astor
Requires-Dist: setuptools
Requires-Dist: click
Provides-Extra: aiohttp
Requires-Dist: aiohttp; extra == "aiohttp"

Importable GraphQL modules
==========================

[![Documentation Status](https://readthedocs.org/projects/gqlmod/badge/?version=master)](https://gqlmod.readthedocs.io/)

`gqlmod` allows you to keep your GraphQL queries in `.gql` files and import them
as modules.

* Validation of queries at import time
* Validation of queries against the schema

Usage
-----

Install both `gqlmod` and any providers you need. (The `starwars` provider ships
with `gqlmod`, so you can begin playing with it immediately.)

Define a `.gql` file with your queries and mutations, like so:

```graphql
#~starwars~

query HeroForEpisode($ep: Episode!) {
  hero(episode: $ep) {
    name
    ... on Droid {
      primaryFunction
    }
    ... on Human {
      homePlanet
    }
  }
}
```

And then you can just import it and use it:

```python
import gqlmod  # noqa
from mygql import HeroForEpisode

print(HeroForEpisode(ep='JEDI'))
```


Why
---

So why use this?

* Strong validation as soon as possible (when the modules are imported)
* All the work is done at warmup, not when the query is made
* I think not mixing languages produces cleaner code?
