gql

A GraphQL client in Python

MIT License

Downloads
6.7M
Stars
1.5K
Committers
55

Bot releases are hidden (Show)

gql -

Published by leszekhanusz over 2 years ago

The graphql-python/gql stable version 3.0 is now finally available!

A lot of changes were made since the stable 2.x version and were available in the many pre-releases released since then. We now support async usage and subscriptions, new transports (aiohttp, websockets, phoenix channels, AWS appsync), file uploads, gql-cli script, completely revamped DSL module to compose GraphQL queries dynamically, custom scalars support... with 100% code coverage, typing hints and complete documentation.

This version needs graphql-core>=3.2.0 (#283)

Breaking changes since 2.x

  • Set use_json default True by default in requests transport (#16)
  • type_def argument in Client is now removed in favor of schema (#113) (#262)
  • The schema is now always fetched at the beginning of the first session if fetch_schema_from_transport is set to True (#167) Note that previously with 2.x versions, if the fetching of the schema failed, then the error was silently discarded. This is no more the case with 3.x versions and if you use fetch_schema_from_transport=True and there was a problem while getting the schema, then you'll get an Exception
  • Optional dependencies for transports (#158):
  • DSL module: see below
  • EDIT variable values: some users were apparently providing variable values using client.execute(query, variables) instead of client.execute(query, variable_values=variables). This no longer works in gql 3.0

New since 2.x

  • New websockets and aiohttp async transports using asyncio (#70). See async vs sync in the documentation
  • Implementation of graphql-ws protocol (#242)
  • File upload support (#145) with streaming functionalities (#174) for aiohttp or requests transport (#244)
  • gql-cli script
  • RequestHTTPTransport:
    • Support different operation names (#21)
    • Add extra_args argument to execute function (#232)
    • Update requests/urllib3 dependency and allow retries on POST requests (#249)
  • Custom Scalars input serialization in variables (#253)
  • Parse custom scalar and enums in outputs (#256)
  • Adding a new transport class to handle Phoenix channels (#100) (#228)
  • Supports AWS AppSync (#239)
  • Complete Refactor of the DSL Module (#169):
    • The DSLSchema only needs a schema, a Client is no more needed
    • New dsl_gql function to convert the DSL operations into a Document
    • This allows DSL queries to be executed in a session instead of a client (Solves #138)
    • Added typing annotations
    • Added code documentation and sphinx docs (Solves #82)
    • Supports Subscriptions
    • Fix nested input arguments
    • Allow to set the alias directly in the select method
    • Allow multiple operations in a document
    • Allow to set the operation name
    • Allow to use GraphQL keys named type (#151)
    • Add support for variable definitions (#210)
    • Implementation of fragments (#235)
    • Serialize complex arguments to literals (#255)
    • Meta fields implementation (#259)
    • Refactor select (#261)
  • Support extensions:
    • It is now possible to get the full execution result to receive the extensions field (#257)
    • Add extensions field to ExecutionResult (#190)
  • Enable mypy to discover type hints as specified in PEP 561 (#207)

Big thanks to @Cito for the graphql-core development and all the many contributors who contributed to this release!

gql -

Published by leszekhanusz almost 3 years ago

Misc

  • Bump graphql-core to 3.2.0 (#283)
  • Add type overloads for get_execution_result (#287)

Fixes

  • Update type hint to align with docs and usage (#285)

Other

  • Mark online tests as online (#288)
gql -

Published by leszekhanusz almost 3 years ago

New features

  • Supports AWS AppSync (#239)
  • It is now possible to get the full execution result to receive the extensions field (#257)
  • Add --print-schema to gql-cli to easily download a schema from a backend (#258)
  • DSL meta fields implementation (#259)
  • Enable mypy to discover type hints as specified in PEP 561 (#275)
  • gql-cli add --transport argument (#281)

Fixes

  • Invert the order of proposed subprotocols apollo and graphql-ws (#265):
    This was needed because some backends were incorrectly sending the first
    supported protocol in the list without verification
  • Fix aiohttp wait for closed ssl connections (#153):
    Should fix error "RuntimeError: Event loop is closed" when using gql-cli under windows with a https backend
  • Add skip and include directive in introspection schema (#279)

Other

  • DSL Refactor select (#261)
  • Supporting Python 3.10 without warnings (#264)
  • Update websockets to 10 for Python versions >= 3.6
  • Expand aiohttp version range (#274)
  • Documentation Adding error handling doc (#266)
  • gql-cli add signal handlers to catch ctrl-c and close cleanly (#276)
  • refactor the websockets transport with WebsocketsTransportBase (#239)

Breaking changes

  • Remove the obsolete type_def argument of Client (#262)
gql -

Published by leszekhanusz almost 3 years ago

New features

  • Custom Scalars input serialization in variables (#253)
  • DSL serialize complex arguments to literals (#255)
  • Parse custom scalar and enums in outputs (#256)

documentation is available there

gql -

Published by leszekhanusz almost 3 years ago

New features

  • Implementation of graphql-ws protocol (#242)
  • Add upload_files functionality for requests transport (#244)
  • AIOHTTPTransport ignore backend mimetype (#248)
  • Add the option to specify a filename on multipart file upload (#241)
  • DSL implementation of fragments (#235)
  • RequestsHTTPTransport add extra_args argument to execute function (#232)
  • Update typing hints of timeouts to allow passing floats (#234)
  • PhoenixChannelWebsocketsTransport: Handle Absinthe unsubscriptions (#228)

Bug fixes

  • Update requests/urllib3 dependency and allow retries on POST requests (#249)
  • Async generators always ensure that inner generator are closed properly (#230)
gql -

Published by leszekhanusz over 3 years ago

New features

  • Add Streaming functionalities to file uploads (#174)
  • Add extensions field to ExecutionResult (#190)
  • Added keep_alive_timeout argument to the websockets transport to close the connection if no keep alive are received from the backend in the specified time (#201)
  • Add support for variable definitions in dsl (#210)

Fixes

  • Fix 4xx error handling in transports (#195)

Maintenance

  • Update graphql-core version to 3.1.5 (#213)
  • Update websockets to >=9 (#214)

Documentation

  • Adding docs and test about cookies (#202)
  • add docs on how to disable the transport logs (#183)
gql -

Published by leszekhanusz almost 4 years ago

Breaking Changes

  • The schema is now always fetched at the beginning of the first session if fetch_schema_from_transport is set to True (#167)
  • Complete Refactor of the DSL Module (#169):
    • The DSLSchema only needs a schema, a Client is no more needed.
    • New dsl_gql function to convert the DSL operations into a Document
    • This allows DSL queries to be executed in a session instead of a client (Solves #138)
    • Added typing annotations
    • Added code documentation and sphinx docs (Solves #82)
    • Supports Subscriptions
    • Fix nested input arguments
    • Allow to set the alias directly in the select method
    • Allow multiple operations in a document
    • Allow to set the operation name

Maintenance

  • Update aiohttp to >= 3.7.1 (currently 3.7.3)
  • Update yarl to >= 1.6.0
gql -

Published by leszekhanusz almost 4 years ago

Breaking Changes:

  • Optional dependencies for transports (#158):
    • It is now necessary to request additional dependencies when installing gql
    • It is no more possible to import transports directly from gql (Sorry...)
    • Please check the new installation documentation

Improvements:

  • aiohttp and requests transports logging (#157)
  • Better transport exception messages (#155)

Documentation:

  • Adding IPython section (#165)
  • Adding Logging section (#157)

Maintenance:

  • Stable Python 3.9 support (#160)
  • Update aiohttp from 3.6.2 to 3.7.1 (#159)
gql -

Published by leszekhanusz about 4 years ago

Breaking changes:

  • gql-cli script
    • Now printing result as json
    • Now working with multi-lines queries, using Ctrl-D (EOF) to execute queries
    • Using --variables instead of --params

New features:

  • File upload support (#145)
  • improved gql-cli script (#148)

Bugs corrected:

  • DSL allow to use GraphQL keys named type (#151)
  • Yarl dependency restricted to <1.6
gql -

Published by leszekhanusz about 4 years ago

Another alpha release of the 3.0 branch.

Bugs corrected:

  • Fix running execute and subscribe of client in a Thread (#135)
  • Fix race condition in websocket transport close (#133)
  • DSL: Fixed bug where a nested GraphQLInputObjectType is causing infinite recursive calls (#132)
  • Raises "KeyError" when argument is invalid on DSL. (#121)

New features:

  • Adding a new transport class to handle Phoenix channels (#100)
  • add the data property in TransportQueryError (#136)

Other improvements:

  • Migrated from Travis to GitHub actions
  • Migrated from coveralls to codecov
  • New documentation generated with sphinx, hosted on readthedocs.io
gql -

Published by leszekhanusz over 4 years ago

This is the second alpha release of the "modern" 3.0 branch.

The main improvements in this version are:

  • Fix some issues with Hasura backend:
    • optional variables an operation name for aiohttp and websockets transports (#94)
    • ignoring keep-alive messages arriving before the connection_ack message (#110)
  • Using more specific exceptions (#95)
  • It is now possible to get all the returned errors in the TransportQueryError exception (#96)
  • Documentation: Improved README.md and added coding guidelines to CONTRIBUTING.md (#97 #114)
  • 100% tests coverage (#107)
  • Graceful shutdown for synchronous subscriptions (#99)
  • type_def argument in Client is now deprecated in favor of schema (#113)
gql -

Published by Cito over 4 years ago

This is the first alpha version in the "modern" branch of gql.

This branch is based on GraphQL-core 3 and supports Python 3.6+.

The main improvements in this version are:

  • Set use_json default true by default in requests transport (#16)
  • Support different operation names in requests transport (#21)
  • New websockets and http async transports using asyncio (#70)
  • Allow to pass arguments to websockets.connect (#83)
  • LocalSchemaTransport is now an AsyncTransport (#84)
  • New connect method in requests transports (#87)

Please give us your feedback so that we can publish beta and final releases soon.

gql -

Published by Cito over 4 years ago

This is the first version in the "legacy" branch of gql.

This branch is based on GraphQL-core 2 and supports Python 2.7 and 3.5+.

We recommend upgrading to Python 3 and using the modern branch starting with v3.0.0.