From b049de3dbf38613db5cf730db12b3302e0e0d426 Mon Sep 17 00:00:00 2001 From: Andrew Svetlov Date: Sun, 23 Jan 2022 13:53:26 +0200 Subject: [PATCH 1/4] Drop Python 3.6 support --- .github/workflows/ci.yml | 4 +-- setup.py | 7 +--- yarl/_url.py | 71 ++++++++++++---------------------------- 3 files changed, 24 insertions(+), 58 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index af8061f7..7529f09b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,7 +4,7 @@ on: push: branches: - master - - ?.?* # matches to backport branches, e.g. 3.6 + - ?.?* # matches to backport branches, e.g. 3.9 tags: [ 'v*' ] pull_request: branches: @@ -68,7 +68,7 @@ jobs: needs: lint strategy: matrix: - pyver: ['3.6', '3.7', '3.8', '3.9', '3.10'] + pyver: ['3.7', '3.8', '3.9', '3.10'] no-extensions: ['', 'Y'] os: [ubuntu, macos, windows] exclude: diff --git a/setup.py b/setup.py index c53d3395..6a376613 100644 --- a/setup.py +++ b/setup.py @@ -5,10 +5,6 @@ from setuptools import Extension, setup -if sys.version_info < (3, 5): - raise RuntimeError("yarl 1.4+ requires Python 3.5+") - - NO_EXTENSIONS = bool(os.environ.get("YARL_NO_EXTENSIONS")) # type: bool if sys.implementation.name != "cpython": @@ -53,7 +49,6 @@ def read(name): "Intended Audience :: Developers", "Programming Language :: Python", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", @@ -66,7 +61,7 @@ def read(name): license="Apache 2", packages=["yarl"], install_requires=install_requires, - python_requires=">=3.6", + python_requires=">=3.7", include_package_data=True, exclude_package_data={"": ["*.c"]}, ) diff --git a/yarl/_url.py b/yarl/_url.py index c913676e..5985c3ae 100644 --- a/yarl/_url.py +++ b/yarl/_url.py @@ -1,6 +1,5 @@ import functools import math -import sys import warnings from collections.abc import Mapping, Sequence from ipaddress import ip_address @@ -706,55 +705,27 @@ def _normalize_path(cls, path): return "/".join(resolved_path) - if sys.version_info >= (3, 7): - - @classmethod - def _encode_host(cls, host, human=False): - try: - ip, sep, zone = host.partition("%") - ip = ip_address(ip) - except ValueError: - host = host.lower() - # IDNA encoding is slow, - # skip it for ASCII-only strings - # Don't move the check into _idna_encode() helper - # to reduce the cache size - if human or host.isascii(): - return host - host = _idna_encode(host) - else: - host = ip.compressed - if sep: - host += "%" + zone - if ip.version == 6: - host = "[" + host + "]" - return host - - else: - # work around for missing str.isascii() in Python <= 3.6 - @classmethod - def _encode_host(cls, host, human=False): - try: - ip, sep, zone = host.partition("%") - ip = ip_address(ip) - except ValueError: - host = host.lower() - if human: - return host - - for char in host: - if char > "\x7f": - break - else: - return host - host = _idna_encode(host) - else: - host = ip.compressed - if sep: - host += "%" + zone - if ip.version == 6: - host = "[" + host + "]" - return host + @classmethod + def _encode_host(cls, host, human=False): + try: + ip, sep, zone = host.partition("%") + ip = ip_address(ip) + except ValueError: + host = host.lower() + # IDNA encoding is slow, + # skip it for ASCII-only strings + # Don't move the check into _idna_encode() helper + # to reduce the cache size + if human or host.isascii(): + return host + host = _idna_encode(host) + else: + host = ip.compressed + if sep: + host += "%" + zone + if ip.version == 6: + host = "[" + host + "]" + return host @classmethod def _make_netloc( From 0eaa9b29dd95b96d485a2f7377ac67adadab8a54 Mon Sep 17 00:00:00 2001 From: Andrew Svetlov Date: Sun, 23 Jan 2022 13:54:24 +0200 Subject: [PATCH 2/4] Add changelog --- CHANGES/672.removal | 1 + 1 file changed, 1 insertion(+) create mode 100644 CHANGES/672.removal diff --git a/CHANGES/672.removal b/CHANGES/672.removal new file mode 100644 index 00000000..825500d6 --- /dev/null +++ b/CHANGES/672.removal @@ -0,0 +1 @@ +Dropped Python 3.6 support. From aa399a3c46668e608c39a85dc4cd316e3926280a Mon Sep 17 00:00:00 2001 From: Andrew Svetlov Date: Sun, 23 Jan 2022 14:00:42 +0200 Subject: [PATCH 3/4] Bump pypy version --- .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 7529f09b..9a4289b6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -77,7 +77,7 @@ jobs: - os: windows no-extensions: 'Y' include: - - pyver: pypy3 + - pyver: pypy-3.8 no-extensions: 'Y' os: ubuntu fail-fast: false From bd11decd51b3b3c6caf75f8b111986cd7b551621 Mon Sep 17 00:00:00 2001 From: Andrew Svetlov Date: Sun, 23 Jan 2022 14:14:54 +0200 Subject: [PATCH 4/4] Add test-summary step --- .github/workflows/ci.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9a4289b6..f1f9e6cc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -65,7 +65,6 @@ jobs: test: name: Test - needs: lint strategy: matrix: pyver: ['3.7', '3.8', '3.9', '3.10'] @@ -131,10 +130,21 @@ jobs: flags: unit fail_ci_if_error: false + test-summary: + name: Tests status + if: always() + runs-on: ubuntu-latest + needs: [lint, test] + steps: + - name: Decide whether the needed jobs succeeded or failed + uses: re-actors/alls-green@release/v1 + with: + jobs: ${{ toJSON(needs) }} + pre-deploy: name: Pre-Deploy runs-on: ubuntu-latest - needs: test + needs: test-summary # Run only on pushing a tag if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') steps: