From 2c09b6bde0ee662ed7d864e055d18173baf173c0 Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Mon, 5 Aug 2024 09:06:39 +0200 Subject: [PATCH 1/4] Fix typing problems pyre has with aiohttp 3.10.1. --- src/antsibull_core/utils/http.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/antsibull_core/utils/http.py b/src/antsibull_core/utils/http.py index def0816..7470870 100644 --- a/src/antsibull_core/utils/http.py +++ b/src/antsibull_core/utils/http.py @@ -61,7 +61,7 @@ async def __aenter__(self) -> aiohttp.ClientResponse: flog.debug("Execute {0}", self.call_string) wait_factor: float = 5 try: - response = await self.aio_session.get( + response = await self.aio_session.get( # pyre-ignore[16] *self.args, **self.kwargs, timeout=20 ) status_code = response.status From 9ddc743127ba1a9927236766945b94a2641a46e1 Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Mon, 5 Aug 2024 09:08:16 +0200 Subject: [PATCH 2/4] Use ClientTimeout for timeout. --- changelogs/fragments/163-aiohttp-timeout.yml | 3 +++ src/antsibull_core/utils/http.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/163-aiohttp-timeout.yml diff --git a/changelogs/fragments/163-aiohttp-timeout.yml b/changelogs/fragments/163-aiohttp-timeout.yml new file mode 100644 index 0000000..bccbaa3 --- /dev/null +++ b/changelogs/fragments/163-aiohttp-timeout.yml @@ -0,0 +1,3 @@ +bugfixes: + - "Adjust the aiohttp retry GET mananger to use ``ClientTimeout`` instead of a ``float``, since that will be removed in aiohttp 4.0.0 + (https://github.com/ansible-community/antsibull-core/pull/163)." diff --git a/src/antsibull_core/utils/http.py b/src/antsibull_core/utils/http.py index 7470870..17b53a8 100644 --- a/src/antsibull_core/utils/http.py +++ b/src/antsibull_core/utils/http.py @@ -62,7 +62,7 @@ async def __aenter__(self) -> aiohttp.ClientResponse: wait_factor: float = 5 try: response = await self.aio_session.get( # pyre-ignore[16] - *self.args, **self.kwargs, timeout=20 + *self.args, **self.kwargs, timeout=aiohttp.ClientTimeout(total=20) ) status_code = response.status flog.debug(f"Status code {status_code}") From 911b760c7720651b3c19145d0bdab6cdb157249a Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Mon, 5 Aug 2024 09:16:46 +0200 Subject: [PATCH 3/4] Fix aiohttp dependency. --- changelogs/fragments/163-aiohttp-timeout.yml | 2 ++ pyproject.toml | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/changelogs/fragments/163-aiohttp-timeout.yml b/changelogs/fragments/163-aiohttp-timeout.yml index bccbaa3..0b506df 100644 --- a/changelogs/fragments/163-aiohttp-timeout.yml +++ b/changelogs/fragments/163-aiohttp-timeout.yml @@ -1,3 +1,5 @@ bugfixes: - "Adjust the aiohttp retry GET mananger to use ``ClientTimeout`` instead of a ``float``, since that will be removed in aiohttp 4.0.0 (https://github.com/ansible-community/antsibull-core/pull/163)." + - "Bump asyncio requirement to >= 3.3.0 instead of 3.0.0. Version 3.0.0 likely never worked with the retry code that + has been in here basically since he beginning (https://github.com/ansible-community/antsibull-core/pull/163)." diff --git a/pyproject.toml b/pyproject.toml index fecd5de..1b03dea 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,7 +29,7 @@ classifiers = [ requires-python = ">=3.9" dependencies = [ "aiofiles", - "aiohttp >= 3.0.0", + "aiohttp >= 3.3.0", "build", # major/minor was introduced here "packaging >= 20.0", From dd8aa93f44e0d152e1aadf63b26e9b7aa71a3dea Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Mon, 5 Aug 2024 09:19:42 +0200 Subject: [PATCH 4/4] Restrict aiohttp version for antsibull compatibility check to make pyre happy. --- .github/workflows/antsibull.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/antsibull.yml b/.github/workflows/antsibull.yml index 13d74c3..0e5c45a 100644 --- a/.github/workflows/antsibull.yml +++ b/.github/workflows/antsibull.yml @@ -52,6 +52,12 @@ jobs: sed -e 's/pyre-check/pyre-check <= 0.9.20,/' -i pyproject.toml working-directory: antsibull + - name: Patch our pyproject.toml + # Necessary for pyre... + run: | + sed -e 's/aiohttp/aiohttp < 3.10.0,/' -i pyproject.toml + working-directory: antsibull-core + - name: Set up Python 3.12 id: python uses: actions/setup-python@v5