From 0c885da53fdf56d7a2570b35fa415351464aa32b Mon Sep 17 00:00:00 2001 From: Derek Schrock Date: Sun, 24 Aug 2025 20:27:38 -0400 Subject: [PATCH] feat(graphql): update to gql 4.0.0 BREAKING CHANGE: GraphQL.execute() no longer accepts graphql.Source --- .pre-commit-config.yaml | 4 ++-- gitlab/client.py | 7 ++----- pyproject.toml | 2 +- requirements.txt | 2 +- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 714fdfb98..b9c06a408 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -25,7 +25,7 @@ repos: - id: pylint additional_dependencies: - argcomplete==2.0.0 - - gql==3.5.0 + - gql==4.0.0 - httpx==0.27.2 - pytest==7.4.2 - requests==2.28.1 @@ -37,7 +37,7 @@ repos: - id: mypy args: [] additional_dependencies: - - gql==3.5.0 + - gql==4.0.0 - httpx==0.27.2 - jinja2==3.1.2 - pytest==7.4.2 diff --git a/gitlab/client.py b/gitlab/client.py index 37dd4c2e6..a3cf1f31a 100644 --- a/gitlab/client.py +++ b/gitlab/client.py @@ -18,7 +18,6 @@ try: import gql import gql.transport.exceptions - import graphql import httpx from ._backends.graphql import GitlabAsyncTransport, GitlabTransport @@ -1350,7 +1349,7 @@ def __enter__(self) -> GraphQL: def __exit__(self, *args: Any) -> None: self._http_client.close() - def execute(self, request: str | graphql.Source, *args: Any, **kwargs: Any) -> Any: + def execute(self, request: str, *args: Any, **kwargs: Any) -> Any: parsed_document = self._gql(request) retry = utils.Retry( max_retries=self._max_retries, @@ -1420,9 +1419,7 @@ async def __aenter__(self) -> AsyncGraphQL: async def __aexit__(self, *args: Any) -> None: await self._http_client.aclose() - async def execute( - self, request: str | graphql.Source, *args: Any, **kwargs: Any - ) -> Any: + async def execute(self, request: str, *args: Any, **kwargs: Any) -> Any: parsed_document = self._gql(request) retry = utils.Retry( max_retries=self._max_retries, diff --git a/pyproject.toml b/pyproject.toml index 7b8510b94..45e8c36f8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -43,7 +43,7 @@ dynamic = ["version"] [project.optional-dependencies] autocompletion = ["argcomplete>=1.10.0,<3"] yaml = ["PyYaml>=6.0.1"] -graphql = ["gql[httpx]>=3.5.0,<4"] +graphql = ["gql[httpx]>=3.5.0,<5"] [project.scripts] gitlab = "gitlab.cli:main" diff --git a/requirements.txt b/requirements.txt index 6930e5d2c..d51e14533 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -gql==3.5.3 +gql==4.0.0 httpx==0.28.1 requests==2.32.5 requests-toolbelt==1.0.0