diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6a578425..7ed44af1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -72,15 +72,10 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - python-version: [3.5, 3.6, 3.7, 3.8, 3.9] + python-version: [3.6, 3.7, 3.8, 3.9] os: [ubuntu-20.04, macos-latest, windows-latest] arch: [x86_64] exclude: - # Python 3.5 is unable to properly - # find the recent VS tooling - # https://bugs.python.org/issue30389 - - os: windows-latest - python-version: 3.5 - os: windows-latest arch: aarch64 - os: macos-latest diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 469af2b2..e55e282b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -17,14 +17,8 @@ jobs: # job. strategy: matrix: - python-version: [3.5, 3.6, 3.7, 3.8, 3.9] - os: [ubuntu-latest, macos-latest, windows-latest] - exclude: - # Python 3.5 is unable to properly - # find the recent VS tooling - # https://bugs.python.org/issue30389 - - os: windows-latest - python-version: 3.5 + python-version: [3.6, 3.7, 3.8, 3.9] + os: [ubuntu-latest, macos-latest, windows-latest] runs-on: ${{ matrix.os }} diff --git a/README.rst b/README.rst index 4ee68b4d..2f5da7a4 100644 --- a/README.rst +++ b/README.rst @@ -13,7 +13,7 @@ of PostgreSQL server binary protocol for use with Python's ``asyncio`` framework. You can read more about asyncpg in an introductory `blog post `_. -asyncpg requires Python 3.5 or later and is supported for PostgreSQL +asyncpg requires Python 3.6 or later and is supported for PostgreSQL versions 9.5 to 13. Older PostgreSQL versions or other databases implementing the PostgreSQL protocol *may* work, but are not being actively tested. diff --git a/asyncpg/compat.py b/asyncpg/compat.py index 6dbce3c9..348b8caa 100644 --- a/asyncpg/compat.py +++ b/asyncpg/compat.py @@ -6,52 +6,15 @@ import asyncio -import functools -import os import pathlib import platform import sys -PY_36 = sys.version_info >= (3, 6) PY_37 = sys.version_info >= (3, 7) SYSTEM = platform.uname().system -if sys.version_info < (3, 5, 2): - def aiter_compat(func): - @functools.wraps(func) - async def wrapper(self): - return func(self) - return wrapper -else: - def aiter_compat(func): - return func - - -if PY_36: - fspath = os.fspath -else: - def fspath(path): - fsp = getattr(path, '__fspath__', None) - if fsp is not None and callable(fsp): - path = fsp() - if not isinstance(path, (str, bytes)): - raise TypeError( - 'expected {}() to return str or bytes, not {}'.format( - fsp.__qualname__, type(path).__name__ - )) - return path - elif isinstance(path, (str, bytes)): - return path - else: - raise TypeError( - 'expected str, bytes or path-like object, not {}'.format( - type(path).__name__ - ) - ) - - if SYSTEM == 'Windows': import ctypes.wintypes diff --git a/asyncpg/connection.py b/asyncpg/connection.py index 3f678d16..4a656124 100644 --- a/asyncpg/connection.py +++ b/asyncpg/connection.py @@ -11,6 +11,7 @@ import collections.abc import functools import itertools +import os import sys import time import traceback @@ -957,7 +958,7 @@ def _format_copy_opts(self, *, format=None, oids=None, freeze=None, async def _copy_out(self, copy_stmt, output, timeout): try: - path = compat.fspath(output) + path = os.fspath(output) except TypeError: # output is not a path-like object path = None @@ -996,7 +997,7 @@ async def _writer(data): async def _copy_in(self, copy_stmt, source, timeout): try: - path = compat.fspath(source) + path = os.fspath(source) except TypeError: # source is not a path-like object path = None @@ -1027,7 +1028,6 @@ async def _copy_in(self, copy_stmt, source, timeout): if f is not None: # Copying from a file-like object. class _Reader: - @compat.aiter_compat def __aiter__(self): return self diff --git a/asyncpg/cursor.py b/asyncpg/cursor.py index 978824c3..7ec159ba 100644 --- a/asyncpg/cursor.py +++ b/asyncpg/cursor.py @@ -7,7 +7,6 @@ import collections -from . import compat from . import connresource from . import exceptions @@ -48,7 +47,6 @@ def __init__( if state is not None: state.attach() - @compat.aiter_compat @connresource.guarded def __aiter__(self): prefetch = 50 if self._prefetch is None else self._prefetch @@ -206,7 +204,6 @@ def __init__( self._prefetch = prefetch self._timeout = timeout - @compat.aiter_compat @connresource.guarded def __aiter__(self): return self diff --git a/asyncpg/pgproto b/asyncpg/pgproto index 126bcd24..719c7c76 160000 --- a/asyncpg/pgproto +++ b/asyncpg/pgproto @@ -1 +1 @@ -Subproject commit 126bcd24bd3c59d581613dae026e2721efbedf16 +Subproject commit 719c7c76ee92988f094c447bae18b47ab04a2185 diff --git a/docs/index.rst b/docs/index.rst index 77bf19f3..57031b03 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -14,7 +14,7 @@ PostgreSQL and Python/asyncio. asyncpg is an efficient, clean implementation of PostgreSQL server binary protocol for use with Python's ``asyncio`` framework. -**asyncpg** requires Python 3.5 or later and is supported for PostgreSQL +**asyncpg** requires Python 3.6 or later and is supported for PostgreSQL versions 9.5 to 13. Contents diff --git a/setup.py b/setup.py index b2fc8f33..606620cd 100644 --- a/setup.py +++ b/setup.py @@ -7,8 +7,8 @@ import sys -if sys.version_info < (3, 5): - raise RuntimeError('asyncpg requires Python 3.5 or greater') +if sys.version_info < (3, 6): + raise RuntimeError('asyncpg requires Python 3.6 or greater') import os import os.path @@ -259,7 +259,6 @@ def finalize_options(self): 'Operating System :: MacOS :: MacOS X', 'Operating System :: Microsoft :: Windows', 'Programming Language :: Python :: 3 :: Only', - 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', @@ -268,7 +267,7 @@ def finalize_options(self): 'Topic :: Database :: Front-Ends', ], platforms=['macOS', 'POSIX', 'Windows'], - python_requires='>=3.5.0', + python_requires='>=3.6.0', zip_safe=False, author='MagicStack Inc', author_email='hello@magic.io', diff --git a/tests/test_copy.py b/tests/test_copy.py index dd01153f..dcac96ac 100644 --- a/tests/test_copy.py +++ b/tests/test_copy.py @@ -13,7 +13,6 @@ import asyncpg from asyncpg import _testbase as tb -from asyncpg import compat class TestCopyFrom(tb.ConnectedTestCase): @@ -467,7 +466,6 @@ class _Source: def __init__(self): self.rowcount = 0 - @compat.aiter_compat def __aiter__(self): return self @@ -507,7 +505,6 @@ class _Source: def __init__(self): self.rowcount = 0 - @compat.aiter_compat def __aiter__(self): return self @@ -533,7 +530,6 @@ class _Source: def __init__(self): self.rowcount = 0 - @compat.aiter_compat def __aiter__(self): return self @@ -564,7 +560,6 @@ def __init__(self, loop): self.rowcount = 0 self.loop = loop - @compat.aiter_compat def __aiter__(self): return self