Skip to content

Commit 2830a3d

Browse files
authored
Drop Python 3.6 support (#672)
1 parent 7a7f239 commit 2830a3d

File tree

4 files changed

+38
-61
lines changed

4 files changed

+38
-61
lines changed

.github/workflows/ci.yml

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
push:
55
branches:
66
- master
7-
- ?.?* # matches to backport branches, e.g. 3.6
7+
- ?.?* # matches to backport branches, e.g. 3.9
88
tags: [ 'v*' ]
99
pull_request:
1010
branches:
@@ -65,10 +65,9 @@ jobs:
6565
6666
test:
6767
name: Test
68-
needs: lint
6968
strategy:
7069
matrix:
71-
pyver: ['3.6', '3.7', '3.8', '3.9', '3.10']
70+
pyver: ['3.7', '3.8', '3.9', '3.10']
7271
no-extensions: ['', 'Y']
7372
os: [ubuntu, macos, windows]
7473
exclude:
@@ -77,7 +76,7 @@ jobs:
7776
- os: windows
7877
no-extensions: 'Y'
7978
include:
80-
- pyver: pypy3
79+
- pyver: pypy-3.8
8180
no-extensions: 'Y'
8281
os: ubuntu
8382
fail-fast: false
@@ -131,10 +130,21 @@ jobs:
131130
flags: unit
132131
fail_ci_if_error: false
133132

133+
test-summary:
134+
name: Tests status
135+
if: always()
136+
runs-on: ubuntu-latest
137+
needs: [lint, test]
138+
steps:
139+
- name: Decide whether the needed jobs succeeded or failed
140+
uses: re-actors/alls-green@release/v1
141+
with:
142+
jobs: ${{ toJSON(needs) }}
143+
134144
pre-deploy:
135145
name: Pre-Deploy
136146
runs-on: ubuntu-latest
137-
needs: test
147+
needs: test-summary
138148
# Run only on pushing a tag
139149
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
140150
steps:

CHANGES/672.removal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Dropped Python 3.6 support.

setup.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@
55

66
from setuptools import Extension, setup
77

8-
if sys.version_info < (3, 5):
9-
raise RuntimeError("yarl 1.4+ requires Python 3.5+")
10-
11-
128
NO_EXTENSIONS = bool(os.environ.get("YARL_NO_EXTENSIONS")) # type: bool
139

1410
if sys.implementation.name != "cpython":
@@ -53,7 +49,6 @@ def read(name):
5349
"Intended Audience :: Developers",
5450
"Programming Language :: Python",
5551
"Programming Language :: Python :: 3",
56-
"Programming Language :: Python :: 3.6",
5752
"Programming Language :: Python :: 3.7",
5853
"Programming Language :: Python :: 3.8",
5954
"Programming Language :: Python :: 3.9",
@@ -66,7 +61,7 @@ def read(name):
6661
license="Apache 2",
6762
packages=["yarl"],
6863
install_requires=install_requires,
69-
python_requires=">=3.6",
64+
python_requires=">=3.7",
7065
include_package_data=True,
7166
exclude_package_data={"": ["*.c"]},
7267
)

yarl/_url.py

Lines changed: 21 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import functools
22
import math
3-
import sys
43
import warnings
54
from collections.abc import Mapping, Sequence
65
from ipaddress import ip_address
@@ -706,55 +705,27 @@ def _normalize_path(cls, path):
706705

707706
return "/".join(resolved_path)
708707

709-
if sys.version_info >= (3, 7):
710-
711-
@classmethod
712-
def _encode_host(cls, host, human=False):
713-
try:
714-
ip, sep, zone = host.partition("%")
715-
ip = ip_address(ip)
716-
except ValueError:
717-
host = host.lower()
718-
# IDNA encoding is slow,
719-
# skip it for ASCII-only strings
720-
# Don't move the check into _idna_encode() helper
721-
# to reduce the cache size
722-
if human or host.isascii():
723-
return host
724-
host = _idna_encode(host)
725-
else:
726-
host = ip.compressed
727-
if sep:
728-
host += "%" + zone
729-
if ip.version == 6:
730-
host = "[" + host + "]"
731-
return host
732-
733-
else:
734-
# work around for missing str.isascii() in Python <= 3.6
735-
@classmethod
736-
def _encode_host(cls, host, human=False):
737-
try:
738-
ip, sep, zone = host.partition("%")
739-
ip = ip_address(ip)
740-
except ValueError:
741-
host = host.lower()
742-
if human:
743-
return host
744-
745-
for char in host:
746-
if char > "\x7f":
747-
break
748-
else:
749-
return host
750-
host = _idna_encode(host)
751-
else:
752-
host = ip.compressed
753-
if sep:
754-
host += "%" + zone
755-
if ip.version == 6:
756-
host = "[" + host + "]"
757-
return host
708+
@classmethod
709+
def _encode_host(cls, host, human=False):
710+
try:
711+
ip, sep, zone = host.partition("%")
712+
ip = ip_address(ip)
713+
except ValueError:
714+
host = host.lower()
715+
# IDNA encoding is slow,
716+
# skip it for ASCII-only strings
717+
# Don't move the check into _idna_encode() helper
718+
# to reduce the cache size
719+
if human or host.isascii():
720+
return host
721+
host = _idna_encode(host)
722+
else:
723+
host = ip.compressed
724+
if sep:
725+
host += "%" + zone
726+
if ip.version == 6:
727+
host = "[" + host + "]"
728+
return host
758729

759730
@classmethod
760731
def _make_netloc(

0 commit comments

Comments
 (0)