From 50203c42e51d820d7ea88d7faa019484c049c1e3 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Wed, 21 Sep 2022 15:17:01 +0300 Subject: [PATCH] Increase the upper boundary of the multidict dependency allowing v6 The `multidict` dependency used to be `multidict >=4.5, < 7.0` in `aiohttp` v3.8.1, but was pinned down to `multidict >=4.5, < 6.0` in `aiohttp` v3.8.2 (https://github.com/aio-libs/aiohttp/pull/6550) in an attempt to help avoid new errors. However, https://github.com/python/bedevere/ uses `multidict==6.0.2` so the requirements resolution fails with `aiohttp==3.8.2`: ```console ERROR: Cannot install -r requirements.txt (line 1) and multidict==6.0.2 because these package versions have conflicting dependencies. The conflict is caused by: The user requested multidict==6.0.2 aiohttp 3.8.2 depends on multidict<6.0 and >=4.5 To fix this you could try to: 1. loosen the range of package versions you've specified 2. remove package versions to allow pip attempt to solve the dependency conflict ``` https://github.com/hugovk/bedevere/actions/runs/3095794573/jobs/5010600772 This patch makes it possible to have `multidict` v6 installed in the same env as `aiohttp` v3.8.3, as with `aiohttp` v3.8.1. Partially related to closed https://github.com/aio-libs/aiohttp/issues/6600 and merged https://github.com/aio-libs/aiohttp/pull/6550. PR #6950 Co-Authored-By: Sviatoslav Sydorenko --- CHANGES/6950.bugfix | 7 +++++++ aiohttp/web_ws.py | 4 ++-- setup.cfg | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 CHANGES/6950.bugfix diff --git a/CHANGES/6950.bugfix b/CHANGES/6950.bugfix new file mode 100644 index 00000000000..02fcdb6312c --- /dev/null +++ b/CHANGES/6950.bugfix @@ -0,0 +1,7 @@ +Increased the upper boundary of the :doc:`multidict:index` dependency +to allow for the version 6 -- by :user:`hugovk`. + +It used to be limited below version 7 in :doc:`aiohttp ` v3.8.1 but +was lowered in v3.8.2 via :pr:`6550` and never brought back, causing +problems with dependency pins when upgrading. :doc:`aiohttp ` v3.8.3 +fixes that by recovering the original boundary of ``< 7``. diff --git a/aiohttp/web_ws.py b/aiohttp/web_ws.py index c3ddff7173f..0d32a218b52 100644 --- a/aiohttp/web_ws.py +++ b/aiohttp/web_ws.py @@ -196,9 +196,9 @@ def _handshake( accept_val = base64.b64encode( hashlib.sha1(key.encode() + WS_KEY).digest() ).decode() - response_headers = CIMultiDict( # type: ignore[var-annotated] + response_headers = CIMultiDict( { - hdrs.UPGRADE: "websocket", # type: ignore[arg-type] + hdrs.UPGRADE: "websocket", hdrs.CONNECTION: "upgrade", hdrs.SEC_WEBSOCKET_ACCEPT: accept_val, } diff --git a/setup.cfg b/setup.cfg index 4a6e3175964..cd279a1fc90 100644 --- a/setup.cfg +++ b/setup.cfg @@ -50,7 +50,7 @@ include_package_data = True install_requires = attrs >= 17.3.0 charset-normalizer >=2.0, < 3.0 - multidict >=4.5, < 6.0 + multidict >=4.5, < 7.0 async_timeout >= 4.0.0a3, < 5.0 asynctest == 0.13.0; python_version<"3.8" yarl >= 1.0, < 2.0