From c7fbb3ebc70cc492e263a5d8ebff6d3818493851 Mon Sep 17 00:00:00 2001 From: Lucina Date: Fri, 15 Oct 2021 04:05:17 +0100 Subject: [PATCH 1/7] Add 3.11-dev to CI --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d7ce629d09..0cd3ab7f99 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest] - python-version: [3.8, 3.9, "3.10"] + python-version: [3.8, 3.9, "3.10", 3.11-dev] runs-on: ${{ matrix.os }} From 16f6950713d868dd14b67ecce8e64563970b2f3c Mon Sep 17 00:00:00 2001 From: Lucina Date: Fri, 15 Oct 2021 04:05:55 +0100 Subject: [PATCH 2/7] Update setup.py --- setup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index aa34e5ed3a..6ec507f638 100644 --- a/setup.py +++ b/setup.py @@ -65,7 +65,7 @@ def parse_requirements_file(path): maintainer_email=metadata.email, license=metadata.license, url=metadata.url, - python_requires=">=3.8.0,<3.11", + python_requires=">=3.8.0,<3.12", packages=setuptools.find_namespace_packages(include=["hikari*"]), entry_points={"console_scripts": ["hikari = hikari.cli:main"]}, install_requires=parse_requirements_file("requirements.txt"), @@ -94,6 +94,7 @@ def parse_requirements_file(path): "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", "Programming Language :: Python :: Implementation :: CPython", "Topic :: Communications :: Chat", "Topic :: Internet :: WWW/HTTP", From b6a5dd13dc0ba89fd86dd883f34fad8fb2085021 Mon Sep 17 00:00:00 2001 From: Lucina Date: Fri, 15 Oct 2021 04:08:12 +0100 Subject: [PATCH 3/7] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4e824c03df..49c7405a71 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ Gateway. Built on good intentions and the hope that it will be extendable and reusable, rather than an obstacle for future development. -Python 3.8, 3.9 and 3.10 are currently supported. +Python 3.8, 3.9 and 3.10 and 3.11-dev are currently supported. ## Installation From 048b87abbb25fd02dcbe1afea8f158ab2d815c2a Mon Sep 17 00:00:00 2001 From: Lucina Date: Fri, 15 Oct 2021 04:15:05 +0100 Subject: [PATCH 4/7] Add changes --- changes/847.feature.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 changes/847.feature.md diff --git a/changes/847.feature.md b/changes/847.feature.md new file mode 100644 index 0000000000..8e9e096a4f --- /dev/null +++ b/changes/847.feature.md @@ -0,0 +1 @@ +Add python 3.11-dev support. From 648cc8ab4f02f5aa5516113b5c63d8df49f1803f Mon Sep 17 00:00:00 2001 From: Faster Speeding Date: Tue, 1 Mar 2022 10:37:46 +0000 Subject: [PATCH 5/7] Styling fix --- changes/847.feature.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changes/847.feature.md b/changes/847.feature.md index 8e9e096a4f..4fc5cf4ed1 100644 --- a/changes/847.feature.md +++ b/changes/847.feature.md @@ -1 +1 @@ -Add python 3.11-dev support. +Add python 3.11-dev support. From bcbf42446b28d18cd6ebba8ff91bfa93162e5b94 Mon Sep 17 00:00:00 2001 From: davfsa Date: Wed, 21 Sep 2022 23:17:51 +0200 Subject: [PATCH 6/7] Get aiohttp speedups directly from its package --- README.md | 2 +- speedup-requirements.txt | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 49c7405a71..2c6c3c5f74 100644 --- a/README.md +++ b/README.md @@ -168,7 +168,7 @@ other internal settings in the interpreter. ### `hikari[speedups]` If you have a C compiler (Microsoft VC++ Redistributable 14.0 or newer, or a modern copy of GCC/G++, Clang, etc), you -can install Hikari using `pip install -U hikari[speedups]`. This will install `aiodns`, `cchardet`, `Brotli`, and +can install Hikari using `pip install -U hikari[speedups]`. This will install `aiohttp` with its available speedups, and `ciso8601` which will provide you with a small performance boost. ### `uvloop` diff --git a/speedup-requirements.txt b/speedup-requirements.txt index d6b31e5333..053a6a41c7 100644 --- a/speedup-requirements.txt +++ b/speedup-requirements.txt @@ -1,4 +1,2 @@ -aiodns~=3.0 -cchardet~=2.1 -Brotli~=1.0 +aiohttp[speedups]~=3.8 ciso8601~=2.2 From 35b92a18d355e821797500e74b9510830107c1f9 Mon Sep 17 00:00:00 2001 From: davfsa Date: Wed, 21 Sep 2022 23:41:44 +0200 Subject: [PATCH 7/7] Fix failing tests --- hikari/impl/interaction_server.py | 12 ++++++------ tests/hikari/impl/test_interaction_server.py | 16 ++++++++-------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/hikari/impl/interaction_server.py b/hikari/impl/interaction_server.py index 96036a094a..aac4812370 100644 --- a/hikari/impl/interaction_server.py +++ b/hikari/impl/interaction_server.py @@ -341,12 +341,12 @@ async def aiohttp_hook(self, request: aiohttp.web.Request) -> aiohttp.web.Respon return aiohttp.web.Response(status=response.status_code, headers=response.headers, body=multipart) - headers = response.headers - if response.content_type: - headers = headers or {} - headers[_CONTENT_TYPE_KEY] = response.content_type - - return aiohttp.web.Response(status=response.status_code, headers=headers, body=response.payload) + return aiohttp.web.Response( + status=response.status_code, + headers=response.headers, + body=response.payload, + content_type=response.content_type, + ) async def close(self) -> None: """Gracefully close the server and any open connections.""" diff --git a/tests/hikari/impl/test_interaction_server.py b/tests/hikari/impl/test_interaction_server.py index 648ad2e418..8650b707be 100644 --- a/tests/hikari/impl/test_interaction_server.py +++ b/tests/hikari/impl/test_interaction_server.py @@ -326,7 +326,7 @@ async def test__fetch_public_key_when_public_key_already_set( async def test_aiohttp_hook(self, mock_interaction_server: interaction_server_impl.InteractionServer): mock_interaction_server.on_interaction = mock.AsyncMock( return_value=mock.Mock( - payload=b"abody", files=[], status_code=200, headers={"header1": "ok"}, content_type="oogabooga" + payload=b"abody", files=[], status_code=200, headers={"header1": "ok"}, content_type="ooga/booga" ) ) request = mock.Mock( @@ -342,8 +342,8 @@ async def test_aiohttp_hook(self, mock_interaction_server: interaction_server_im body=b"bfddasdasd", signature=b"troekpewieojksi9", timestamp=b"123123" ) assert result.body == b"abody" - assert result.content_type == "oogabooga" - assert result.headers == {"header1": "ok", "Content-Type": "oogabooga"} + assert result.content_type == "ooga/booga" + assert result.headers == {"header1": "ok", "Content-Type": "ooga/booga"} assert result.status == 200 @pytest.mark.asyncio() @@ -351,7 +351,7 @@ async def test_aiohttp_hook_when_no_other_headers( self, mock_interaction_server: interaction_server_impl.InteractionServer ): mock_interaction_server.on_interaction = mock.AsyncMock( - return_value=mock.Mock(payload=b"abody", files=[], headers=None, status_code=200, content_type="oogabooga") + return_value=mock.Mock(payload=b"abody", files=[], headers=None, status_code=200, content_type="ooga/booga") ) request = mock.Mock( aiohttp.web.Request, @@ -366,8 +366,8 @@ async def test_aiohttp_hook_when_no_other_headers( body=b"bfddasdasd", signature=b"troekpewieojksi9", timestamp=b"123123" ) assert result.body == b"abody" - assert result.content_type == "oogabooga" - assert result.headers == {"Content-Type": "oogabooga"} + assert result.content_type == "ooga/booga" + assert result.headers == {"Content-Type": "ooga/booga"} assert result.status == 200 @pytest.mark.asyncio() @@ -378,7 +378,7 @@ async def test_aiohttp_hook_when_files(self, mock_interaction_server: interactio files=[files.Bytes("x" * 329, "meow.txt"), files.Bytes("y" * 124, "nyaa.txt")], status_code=200, headers={"header1": "ok"}, - content_type="oogabooga", + content_type="ooga/booga", ) ) request = mock.Mock( @@ -406,7 +406,7 @@ async def test_aiohttp_hook_when_files(self, mock_interaction_server: interactio boundary = result.body.boundary.encode() assert mock_writer.payload == ( - b"--" + boundary + b"""\r\nContent-Type: oogabooga\r\nContent-Disposition: form-data; name="payload_json""" + b"--" + boundary + b"""\r\nContent-Type: ooga/booga\r\nContent-Disposition: form-data; name="payload_json""" b""""\r\nContent-Length: 5\r\n\r\nabody\r\n--""" + boundary + b"""\r\nContent-Type: text/plain\r\nConten""" b"""t-Disposition: form-data; name="files[0]"; filename="meow.txt"\r\n\r\nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx""" b"""xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"""