Repository navigation
feat(graphql): add async client - #3045
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3045 +/- ##
==========================================
+ Coverage 96.62% 96.64% +0.01%
==========================================
Files 95 95
Lines 6106 6142 +36
==========================================
+ Hits 5900 5936 +36
Misses 206 206
Flags with carried forward coverage won't be shown. Click here to find out more.
|
36321b6 to
582ac12
Compare
|
@JohnVillalovos @max-wittig this should be ready now. I opted for two separate clients rather than a The diffs are super weird on GitHub, might be easier to check locally. |
582ac12 to
1795fcf
Compare
|
|
||
|
|
||
| class GraphQL: | ||
| class _BaseGrapQL: |
There was a problem hiding this comment.
| class _BaseGrapQL: | |
| class _BaseGraphQL: |
|
|
||
| opts = self._get_client_opts() | ||
| self._http_client = client or httpx.Client(**opts) | ||
| class GraphQL(_BaseGrapQL): |
There was a problem hiding this comment.
| class GraphQL(_BaseGrapQL): | |
| class GraphQL(_BaseGraphQL): |
| return result | ||
|
|
||
|
|
||
| class AsyncGraphQL(_BaseGrapQL): |
There was a problem hiding this comment.
| class AsyncGraphQL(_BaseGrapQL): | |
| class AsyncGraphQL(_BaseGraphQL): |
|
|
||
|
|
||
| @pytest.fixture(scope="module") | ||
| def api_url(): |
There was a problem hiding this comment.
| def api_url(): | |
| def api_url() -> str: |
1795fcf to
6b5632f
Compare
|
Thanks @max-wittig should be ready now 🙇 |
6b5632f to
0307df3
Compare
0307df3 to
ad75cab
Compare
|
Hey folks, I have installed v5.1.0 and could not find the async client, so it must be not released yet. |
|
Hi @roma-glushko the next release is auto-scheduled for the 28th. If there's demand though we can trigger it before. |
|
@nejch I would love to give it a try, so if it's not too much trouble to release sooner I would really appreciate that (at least a prerelease version if the pipeline you have supports that). Otherwise, I can try to temporary pull it from the main branch. |
|
This is now released. There's a bit of blocking code in there for the retry logic AFAIK, so let us know if it doesn't work as expected. |
|
@nejch Hey Nejc, this is awesome! Thank you for releasing it soo fast (it's version 5.2.0 in case anyone else is curious).
Okay, that's good to know 👁️ I think this is fine for now. Do you guys have any plans to address that part? |
|
@roma-glushko for sure if we get any feedback from users as you most likely have more uses for this than ourselves at the moment :) It was mostly so we could reuse some sync/async client code. |
Users have been asking for years for some kind of async support. This is pretty easy to do with the GraphQL client as we're only talking to a single endpoint so it's a good start.
Changes
Adds
AsyncGraphQLand a private base client for common graphql logic.Related to #1357
Related to #1025
Documentation and testing
Please consider whether this PR needs documentation and tests. This is not required, but highly appreciated: