From a19c826f3996ea6deee317224fe61708626f9ae2 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Thu, 5 Oct 2023 14:02:20 +0300 Subject: [PATCH 1/4] Add support for Python 3.11 --- .github/workflows/release.yml | 6 +++--- .github/workflows/release_pr.yml | 4 ++-- .github/workflows/test.yml | 9 ++++++--- setup.py | 4 ++-- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index eaa6a64..18bfbba 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: Prepare tag @@ -35,7 +35,7 @@ jobs: needs: check-release-tag if: ${{ needs.check-release-tag.outputs.tag }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Prepare tag run: | export TAG=v$(awk '/VERSION =/ { gsub("'"\'"'",""); print $3 }' pusher/version.py) @@ -63,7 +63,7 @@ jobs: runs-on: ubuntu-latest needs: create-github-release steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: actions/setup-python@v4 with: python-version: '3.10' diff --git a/.github/workflows/release_pr.yml b/.github/workflows/release_pr.yml index 191cb25..83a3e30 100644 --- a/.github/workflows/release_pr.yml +++ b/.github/workflows/release_pr.yml @@ -11,13 +11,13 @@ jobs: name: Prepare release runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Get current version shell: bash run: | CURRENT_VERSION=$(awk '/VERSION =/ { gsub("'"\'"'",""); print $3 }' pusher/version.py) echo "CURRENT_VERSION=$CURRENT_VERSION" >> $GITHUB_ENV - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: repository: pusher/public_actions path: .github/actions diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5614e1b..59dd4af 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -5,22 +5,25 @@ on: push: branches: [master, main] +env: + FORCE_COLOR: 1 + jobs: test: runs-on: ubuntu-20.04 strategy: fail-fast: false matrix: - python: [2.7, 3.6, 3.7, 3.8, "3.10"] + python: ["2.7", "3.6", "3.7", "3.8", "3.10", "3.11"] name: Python ${{ matrix.python }} Test steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Setup Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python }} diff --git a/setup.py b/setup.py index eba5109..de673ef 100644 --- a/setup.py +++ b/setup.py @@ -14,8 +14,8 @@ setup( name='pusher', version=VERSION, - description='A Python library to interract with the Pusher Channels API', - long_description='A Python library to interract with the Pusher Channels API', + description='A Python library to interact with the Pusher Channels API', + long_description='A Python library to interact with the Pusher Channels API', long_description_type='text/x-rst', url='https://github.com/pusher/pusher-http-python', author='Pusher', From a5aa11a1176d25d92e9abb3f727d024a3e71d95f Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Thu, 5 Oct 2023 14:13:41 +0300 Subject: [PATCH 2/4] Bump requirements for Python 3.11 --- requirements.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/requirements.txt b/requirements.txt index 7cdd39b..be67539 100644 --- a/requirements.txt +++ b/requirements.txt @@ -17,7 +17,7 @@ requests==2.22.0; python_version < '3.10' six==1.12.0; python_version < '3.10' urllib3==1.25.9; python_version < '3.10' aiohttp==3.5.4; python_version >= '3.5' and python_version < '3.10' -aiohttp==3.8.1; python_version >= '3.10' +aiohttp==3.8.5; python_version >= '3.10' aiosignal==1.2.0; python_version >= '3.10' async-timeout==3.0.1; python_version >= '3.5' and python_version < '3.10' async-timeout==4.0.2; python_version >= '3.10' @@ -26,7 +26,7 @@ attrs==21.4.0; python_version >= '3.10' certifi==2021.10.8; python_version >= '3.10' charset-normalizer==2.0.12; python_version >= '3.10' cryptography==37.0.1; python_version >= '3.10' -frozenlist==1.3.0; python_version >= '3.10' +frozenlist==1.4.0; python_version >= '3.10' httpretty==1.1.4; python_version >= '3.10' idna-ssl==1.1.0; python_version >= '3.5' and python_version < '3.7' idna==3.3; python_version >= '3.10' @@ -42,4 +42,4 @@ tornado==5.1.1; python_version < '3.5' tornado==6.0.2; python_version >= '3.5' and python_version < '3.10' urllib3==1.26.9; python_version >= '3.10' yarl==1.3.0; python_version >= '3.5' and python_version < '3.10' -yarl==1.7.2; python_version >= '3.10' \ No newline at end of file +yarl==1.9.2; python_version >= '3.10' From 8bc2f6b3c0ce0bfb817fe6d9376cee9c53e9c0f1 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Thu, 5 Oct 2023 14:46:32 +0300 Subject: [PATCH 3/4] Replace 'yield from' with await --- pusher/aiohttp.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/pusher/aiohttp.py b/pusher/aiohttp.py index 12cd870..b5d78f1 100644 --- a/pusher/aiohttp.py +++ b/pusher/aiohttp.py @@ -20,13 +20,11 @@ def __init__(self, client): """ self.client = client - - @asyncio.coroutine - def send_request(self, request): + async def send_request(self, request): session = response = None try: session = aiohttp.ClientSession() - response = yield from session.request( + response = await session.request( request.method, "%s%s" % (request.base_url, request.path), params=request.query_params, @@ -34,10 +32,10 @@ def send_request(self, request): headers=request.headers, timeout=self.client.timeout ) - body = yield from response.text('utf-8') + body = await response.text('utf-8') return process_response(response.status, body) finally: if response is not None: response.close() if session is not None: - yield from session.close() + await session.close() From e9ad05c08b75f5179d72cc530346fd18a406be01 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Thu, 5 Oct 2023 14:46:57 +0300 Subject: [PATCH 4/4] Bump GHA and cache pip --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 59dd4af..1b0752c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -26,6 +26,7 @@ jobs: uses: actions/setup-python@v4 with: python-version: ${{ matrix.python }} + cache: pip - name: Install dependencies run: pip install -r requirements.txt