Skip to content

Commit da58cd2

Browse files
authored
Drop support for Python 3.5 (#777)
1 parent d08a9b8 commit da58cd2

File tree

10 files changed

+12
-69
lines changed

10 files changed

+12
-69
lines changed

.github/workflows/release.yml

+1-6
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,10 @@ jobs:
7272
runs-on: ${{ matrix.os }}
7373
strategy:
7474
matrix:
75-
python-version: [3.5, 3.6, 3.7, 3.8, 3.9]
75+
python-version: [3.6, 3.7, 3.8, 3.9]
7676
os: [ubuntu-20.04, macos-latest, windows-latest]
7777
arch: [x86_64]
7878
exclude:
79-
# Python 3.5 is unable to properly
80-
# find the recent VS tooling
81-
# https://bugs.python.org/issue30389
82-
- os: windows-latest
83-
python-version: 3.5
8479
- os: windows-latest
8580
arch: aarch64
8681
- os: macos-latest

.github/workflows/tests.yml

+2-8
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,8 @@ jobs:
1717
# job.
1818
strategy:
1919
matrix:
20-
python-version: [3.5, 3.6, 3.7, 3.8, 3.9]
21-
os: [ubuntu-latest, macos-latest, windows-latest]
22-
exclude:
23-
# Python 3.5 is unable to properly
24-
# find the recent VS tooling
25-
# https://bugs.python.org/issue30389
26-
- os: windows-latest
27-
python-version: 3.5
20+
python-version: [3.6, 3.7, 3.8, 3.9]
21+
os: [ubuntu-latest, macos-latest, windows-latest]
2822

2923
runs-on: ${{ matrix.os }}
3024

README.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ of PostgreSQL server binary protocol for use with Python's ``asyncio``
1313
framework. You can read more about asyncpg in an introductory
1414
`blog post <http://magic.io/blog/asyncpg-1m-rows-from-postgres-to-python/>`_.
1515

16-
asyncpg requires Python 3.5 or later and is supported for PostgreSQL
16+
asyncpg requires Python 3.6 or later and is supported for PostgreSQL
1717
versions 9.5 to 13. Older PostgreSQL versions or other databases implementing
1818
the PostgreSQL protocol *may* work, but are not being actively tested.
1919

asyncpg/compat.py

-37
Original file line numberDiff line numberDiff line change
@@ -6,52 +6,15 @@
66

77

88
import asyncio
9-
import functools
10-
import os
119
import pathlib
1210
import platform
1311
import sys
1412

1513

16-
PY_36 = sys.version_info >= (3, 6)
1714
PY_37 = sys.version_info >= (3, 7)
1815
SYSTEM = platform.uname().system
1916

2017

21-
if sys.version_info < (3, 5, 2):
22-
def aiter_compat(func):
23-
@functools.wraps(func)
24-
async def wrapper(self):
25-
return func(self)
26-
return wrapper
27-
else:
28-
def aiter_compat(func):
29-
return func
30-
31-
32-
if PY_36:
33-
fspath = os.fspath
34-
else:
35-
def fspath(path):
36-
fsp = getattr(path, '__fspath__', None)
37-
if fsp is not None and callable(fsp):
38-
path = fsp()
39-
if not isinstance(path, (str, bytes)):
40-
raise TypeError(
41-
'expected {}() to return str or bytes, not {}'.format(
42-
fsp.__qualname__, type(path).__name__
43-
))
44-
return path
45-
elif isinstance(path, (str, bytes)):
46-
return path
47-
else:
48-
raise TypeError(
49-
'expected str, bytes or path-like object, not {}'.format(
50-
type(path).__name__
51-
)
52-
)
53-
54-
5518
if SYSTEM == 'Windows':
5619
import ctypes.wintypes
5720

asyncpg/connection.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import collections.abc
1212
import functools
1313
import itertools
14+
import os
1415
import sys
1516
import time
1617
import traceback
@@ -957,7 +958,7 @@ def _format_copy_opts(self, *, format=None, oids=None, freeze=None,
957958

958959
async def _copy_out(self, copy_stmt, output, timeout):
959960
try:
960-
path = compat.fspath(output)
961+
path = os.fspath(output)
961962
except TypeError:
962963
# output is not a path-like object
963964
path = None
@@ -996,7 +997,7 @@ async def _writer(data):
996997

997998
async def _copy_in(self, copy_stmt, source, timeout):
998999
try:
999-
path = compat.fspath(source)
1000+
path = os.fspath(source)
10001001
except TypeError:
10011002
# source is not a path-like object
10021003
path = None
@@ -1027,7 +1028,6 @@ async def _copy_in(self, copy_stmt, source, timeout):
10271028
if f is not None:
10281029
# Copying from a file-like object.
10291030
class _Reader:
1030-
@compat.aiter_compat
10311031
def __aiter__(self):
10321032
return self
10331033

asyncpg/cursor.py

-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
import collections
99

10-
from . import compat
1110
from . import connresource
1211
from . import exceptions
1312

@@ -48,7 +47,6 @@ def __init__(
4847
if state is not None:
4948
state.attach()
5049

51-
@compat.aiter_compat
5250
@connresource.guarded
5351
def __aiter__(self):
5452
prefetch = 50 if self._prefetch is None else self._prefetch
@@ -206,7 +204,6 @@ def __init__(
206204
self._prefetch = prefetch
207205
self._timeout = timeout
208206

209-
@compat.aiter_compat
210207
@connresource.guarded
211208
def __aiter__(self):
212209
return self

docs/index.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ PostgreSQL and Python/asyncio. asyncpg is an efficient, clean implementation
1414
of PostgreSQL server binary protocol for use with Python's ``asyncio``
1515
framework.
1616

17-
**asyncpg** requires Python 3.5 or later and is supported for PostgreSQL
17+
**asyncpg** requires Python 3.6 or later and is supported for PostgreSQL
1818
versions 9.5 to 13.
1919

2020
Contents

setup.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
import sys
99

10-
if sys.version_info < (3, 5):
11-
raise RuntimeError('asyncpg requires Python 3.5 or greater')
10+
if sys.version_info < (3, 6):
11+
raise RuntimeError('asyncpg requires Python 3.6 or greater')
1212

1313
import os
1414
import os.path
@@ -259,7 +259,6 @@ def finalize_options(self):
259259
'Operating System :: MacOS :: MacOS X',
260260
'Operating System :: Microsoft :: Windows',
261261
'Programming Language :: Python :: 3 :: Only',
262-
'Programming Language :: Python :: 3.5',
263262
'Programming Language :: Python :: 3.6',
264263
'Programming Language :: Python :: 3.7',
265264
'Programming Language :: Python :: 3.8',
@@ -268,7 +267,7 @@ def finalize_options(self):
268267
'Topic :: Database :: Front-Ends',
269268
],
270269
platforms=['macOS', 'POSIX', 'Windows'],
271-
python_requires='>=3.5.0',
270+
python_requires='>=3.6.0',
272271
zip_safe=False,
273272
author='MagicStack Inc',
274273
author_email='hello@magic.io',

tests/test_copy.py

-5
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
import asyncpg
1515
from asyncpg import _testbase as tb
16-
from asyncpg import compat
1716

1817

1918
class TestCopyFrom(tb.ConnectedTestCase):
@@ -467,7 +466,6 @@ class _Source:
467466
def __init__(self):
468467
self.rowcount = 0
469468

470-
@compat.aiter_compat
471469
def __aiter__(self):
472470
return self
473471

@@ -507,7 +505,6 @@ class _Source:
507505
def __init__(self):
508506
self.rowcount = 0
509507

510-
@compat.aiter_compat
511508
def __aiter__(self):
512509
return self
513510

@@ -533,7 +530,6 @@ class _Source:
533530
def __init__(self):
534531
self.rowcount = 0
535532

536-
@compat.aiter_compat
537533
def __aiter__(self):
538534
return self
539535

@@ -564,7 +560,6 @@ def __init__(self, loop):
564560
self.rowcount = 0
565561
self.loop = loop
566562

567-
@compat.aiter_compat
568563
def __aiter__(self):
569564
return self
570565

0 commit comments

Comments
 (0)