Describe the bug
The folowing fix #12452
introduced a required field called stream_writer in the __init__ method of the public class aiohttp.client_reqrep.ClientResponse:
https://github.com/aio-libs/aiohttp/blob/master/aiohttp/client_reqrep.py#L219-L234
However, this breaking change has led to a bump of the minor package version: 3.13.5 => 3.14.0
This results in a lot of CI breaks accross many repos where the aiohttp bump happend automatically by dependabot to close security issue.
Is it possible to make a patch release 3.14.1 where stream_writer is an optional argument to preserve backward compatbility?
To Reproduce
Install aiohttp==3.14.0 and aioresponses==0.7.8, write a simple mock test, observe the failure:
# We need to initialize headers manually
_headers = CIMultiDict({hdrs.CONTENT_TYPE: content_type})
if headers:
_headers.update(headers)
raw_headers = self._build_raw_headers(_headers)
> resp = response_class(method, url, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E TypeError: ClientResponse.__init__() missing 1 required keyword-only argument: 'stream_writer'
.nox/test/lib/python3.11/site-packages/aioresponses/core.py:172: TypeError
pnuckowski/aioresponses#289
Expected behavior
Bump from aiohttp==3.13.5 to aiohttp==3.14.0 must not break dependant project/packages.
Logs/tracebacks
# We need to initialize headers manually
_headers = CIMultiDict({hdrs.CONTENT_TYPE: content_type})
if headers:
_headers.update(headers)
raw_headers = self._build_raw_headers(_headers)
> resp = response_class(method, url, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E TypeError: ClientResponse.__init__() missing 1 required keyword-only argument: 'stream_writer'
.nox/test/lib/python3.11/site-packages/aioresponses/core.py:172: TypeError
Python Version
$ python --version
Python 3.11.13
aiohttp Version
$ python -m pip show aiohttp
Name: aiohttp
Version: 3.14.0
Summary: Async http client/server framework (asyncio)
Home-page: https://github.com/aio-libs/aiohttp
Author:
Author-email:
License: Apache-2.0 AND MIT
Location: /Users/anton_dubovik/Code/GitHub/ai-dial-adapter-dial/.venv/lib/python3.11/site-packages
Requires: aiohappyeyeballs, aiosignal, attrs, frozenlist, multidict, propcache, typing_extensions, yarl
Required-by: aioresponses
multidict Version
$ python -m pip show multidict
Name: multidict
Version: 6.0.4
Summary: multidict implementation
Home-page: https://github.com/aio-libs/multidict
Author: Andrew Svetlov
Author-email: andrew.svetlov@gmail.com
License: Apache 2
Location: /Users/anton_dubovik/Code/GitHub/ai-dial-adapter-dial/.venv/lib/python3.11/site-packages
Requires:
Required-by: aiohttp, yarl
propcache Version
$ python -m pip show propcache
Name: propcache
Version: 0.2.0
Summary: Accelerated property cache
Home-page: https://github.com/aio-libs/propcache
Author: Andrew Svetlov
Author-email: andrew.svetlov@gmail.com
License: Apache-2.0
Location: /Users/anton_dubovik/Code/GitHub/ai-dial-adapter-dial/.venv/lib/python3.11/site-packages
Requires:
Required-by: aiohttp, yarl
yarl Version
$ python -m pip show yarl
Name: yarl
Version: 1.17.2
Summary: Yet another URL library
Home-page: https://github.com/aio-libs/yarl
Author: Andrew Svetlov
Author-email: andrew.svetlov@gmail.com
License: Apache-2.0
Location: /Users/anton_dubovik/Code/GitHub/ai-dial-adapter-dial/.venv/lib/python3.11/site-packages
Requires: idna, multidict, propcache
Required-by: aiohttp
OS
macOS
Related component
Client
Additional context
No response
Code of Conduct
Describe the bug
The folowing fix #12452
introduced a required field called
stream_writerin the__init__method of the public classaiohttp.client_reqrep.ClientResponse:https://github.com/aio-libs/aiohttp/blob/master/aiohttp/client_reqrep.py#L219-L234
However, this breaking change has led to a bump of the minor package version: 3.13.5 => 3.14.0
This results in a lot of CI breaks accross many repos where the
aiohttpbump happend automatically bydependabotto close security issue.Is it possible to make a patch release
3.14.1wherestream_writeris an optional argument to preserve backward compatbility?To Reproduce
Install
aiohttp==3.14.0andaioresponses==0.7.8, write a simple mock test, observe the failure:pnuckowski/aioresponses#289
Expected behavior
Bump from
aiohttp==3.13.5toaiohttp==3.14.0must not break dependant project/packages.Logs/tracebacks
# We need to initialize headers manually _headers = CIMultiDict({hdrs.CONTENT_TYPE: content_type}) if headers: _headers.update(headers) raw_headers = self._build_raw_headers(_headers) > resp = response_class(method, url, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ E TypeError: ClientResponse.__init__() missing 1 required keyword-only argument: 'stream_writer' .nox/test/lib/python3.11/site-packages/aioresponses/core.py:172: TypeErrorPython Version
aiohttp Version
multidict Version
propcache Version
yarl Version
OS
macOS
Related component
Client
Additional context
No response
Code of Conduct
TLDR: Try migrating to aiointercept
ClientResponseis exported, so the class is public, but its constructor is not. The docs are explicit that "User never creates the instance ofClientResponseclass but gets it from API calls."aioresponsesbreaks because it calls__init__directly, which the docs say not to do. By replicating our constructor signature, it ties itself to an internal that we change as needed, so it breaks on nearly every minor bump.I've sent fixes upstream before (e.g. pnuckowski/aioresponses@e909123), but I'm not going to keep doing that, for a few reasons: