All Projects → graphql-python → gql-next

graphql-python / gql-next

Licence: other
A Python GraphQL Client library providing ability to validate and make type-safe GraphQL calls

Programming Languages

python
139335 projects - #7 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to gql-next

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 (-71.62%)
Mutual labels:  graphene
fittrak
A data-driven workout tracking tool for the quantified-self 💪 🤓
Stars: ✭ 19 (-74.32%)
Mutual labels:  graphene
fastapi-debug-toolbar
A debug toolbar for FastAPI.
Stars: ✭ 90 (+21.62%)
Mutual labels:  graphene
fastql
⚙️ Full stack, Modern Web Application Generator. ✨ Using FastAPI, GraphQL, PostgreSQL as database, Docker, automatic HTTPS and more. 🔖
Stars: ✭ 80 (+8.11%)
Mutual labels:  graphene
gxchain-wallet
GXC Wallet for mobile
Stars: ✭ 69 (-6.76%)
Mutual labels:  graphene
Ditch
Create and broadcast transactions to Graphene-based blockchains
Stars: ✭ 32 (-56.76%)
Mutual labels:  graphene
graphene-elastic
Graphene Elasticsearch/OpenSearch (DSL) integration
Stars: ✭ 68 (-8.11%)
Mutual labels:  graphene
jakartaee-faces-sample
Jakarta EE 10 Faces Example
Stars: ✭ 20 (-72.97%)
Mutual labels:  graphene
django-model-mutations
Graphene Django mutations for Django models made easier
Stars: ✭ 23 (-68.92%)
Mutual labels:  graphene
Graphene
GraphQL framework for Python
Stars: ✭ 6,964 (+9310.81%)
Mutual labels:  graphene
sanic-graphql-example
Sanic using Graphsql + SQLAlchemy example
Stars: ✭ 21 (-71.62%)
Mutual labels:  graphene
graphenize
A cli tool to auto-generate Graphene model from json data
Stars: ✭ 12 (-83.78%)
Mutual labels:  graphene
starlette-graphene3
An ASGI app for using Graphene v3 with Starlette / FastAPI
Stars: ✭ 52 (-29.73%)
Mutual labels:  graphene
flask-graphql-neo4j
A simple flask API to test-drive GraphQL and Neo4j
Stars: ✭ 74 (+0%)
Mutual labels:  graphene
graphene-sqlalchemy-filter
Filters for Graphene SQLAlchemy integration
Stars: ✭ 117 (+58.11%)
Mutual labels:  graphene
wagtail-graphql
App to automatically add GraphQL support to a Wagtail website
Stars: ✭ 37 (-50%)
Mutual labels:  graphene
graphql-pynamodb
Graphene PynamoDB Integration
Stars: ✭ 63 (-14.86%)
Mutual labels:  graphene
graphene django crud
Turns the django ORM into a graphql API
Stars: ✭ 23 (-68.92%)
Mutual labels:  graphene
gtk-rs-core
Rust bindings for GNOME libraries
Stars: ✭ 179 (+141.89%)
Mutual labels:  graphene
Graphene Django
Integrate GraphQL into your Django project.
Stars: ✭ 3,738 (+4951.35%)
Mutual labels:  graphene

DEPRECATION NOTICE: this package is deprecated in favor of the new changes made in gql over at https://github.com/graphql-python/gql

GQL: Python GraphQL Client Library

Build Status Coverage Status

Introduction

GQL is a GraphQL Client Python library intended to help Python application make GraphQL API call while enjoying the advantages that come with GraphQL.

  • Strongly Typed response objects (dynamically created in build time to match your query)
  • Query Validation that checks your code's queries against the GraphQL server's schema.

Installation

Simply install from PyPi:

pip install gql-next

Then go to your project folder and run gql init

Quick Start

gql works by parsing query files (**/*.graphql by default) into their own Python module where an class, named after the operation defined in the file, allows you to make that query and get a typed response.

For example, given the following file get_film.graphql file:

query GetFilm($id: ID!) {
  film(id: $id) {
    title
    director
  }
}

A get_film.py will be created defining a GetFilm class:

# AUTOGENERATED file. Do not Change!
from typing import Any, Callable, Mapping, List
from enum import Enum
from dataclasses import dataclass
from dataclasses_json import dataclass_json
from gql.clients import Client, AsyncIOClient


@dataclass_json
@dataclass
class GetFilm:
    @dataclass_json
    @dataclass
    class GetFilmData:
        @dataclass_json
        @dataclass
        class Film:
            title: str
            director: str
        film: Film = None

    data: GetFilmData = None
    errors: Any = None

    @classmethod
    def execute(cls, id: str, on_before_callback: Callable[[Mapping[str, str], Mapping[str, str]], None] = None) -> GetFilm:
        ...

    @classmethod
    async def execute_async(cls, id: str, on_before_callback: Callable[[Mapping[str, str], Mapping[str, str]], None] = None) -> GetFilm:
        ...

Allowing you to make the GraphQL query:

from .get_film import GetFilm

result = GetFilm.execute('meaning_of_life')
film = result.data.film

Important notes:

  • Operations defined in graphql query must be named so that we can name the relevant Python Class which you can then import in your code

How it works

The gql client

gql init

Initializes a project to use GQL as client - writes a .gql.json configuration file.

gql run

Run through your project's files and compile GraphQL queries into into Python types.

gql watch

Useful during development. Listen to file changes in your project's folder and continuously builds GraphQL queries as they change. This allows you to:

  • Immediately verify query changes you make are valid.
  • Enjoy your IDE's autocomplete features on GraphQL auto-generated objects while developing as watch will auto-update them as you change queries.

Sponsors

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].