Skip to content

Commit

Permalink
Drop support for Python 3.5 (#777)
Browse files Browse the repository at this point in the history
  • Loading branch information
and-semakin authored Aug 2, 2021
1 parent d08a9b8 commit da58cd2
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 69 deletions.
7 changes: 1 addition & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 2 additions & 8 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <http://magic.io/blog/asyncpg-1m-rows-from-postgres-to-python/>`_.

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.

Expand Down
37 changes: 0 additions & 37 deletions asyncpg/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions asyncpg/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import collections.abc
import functools
import itertools
import os
import sys
import time
import traceback
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
3 changes: 0 additions & 3 deletions asyncpg/cursor.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import collections

from . import compat
from . import connresource
from . import exceptions

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -206,7 +204,6 @@ def __init__(
self._prefetch = prefetch
self._timeout = timeout

@compat.aiter_compat
@connresource.guarded
def __aiter__(self):
return self
Expand Down
2 changes: 1 addition & 1 deletion asyncpg/pgproto
Submodule pgproto updated 5 files
+2 −0 buffer.pxd
+10 −0 buffer.pyx
+1 −6 codecs/datetime.pyx
+6 −1 pgproto.pyi
+9 −26 types.py
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 3 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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',
Expand All @@ -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='[email protected]',
Expand Down
5 changes: 0 additions & 5 deletions tests/test_copy.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

import asyncpg
from asyncpg import _testbase as tb
from asyncpg import compat


class TestCopyFrom(tb.ConnectedTestCase):
Expand Down Expand Up @@ -467,7 +466,6 @@ class _Source:
def __init__(self):
self.rowcount = 0

@compat.aiter_compat
def __aiter__(self):
return self

Expand Down Expand Up @@ -507,7 +505,6 @@ class _Source:
def __init__(self):
self.rowcount = 0

@compat.aiter_compat
def __aiter__(self):
return self

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

@compat.aiter_compat
def __aiter__(self):
return self

Expand Down Expand Up @@ -564,7 +560,6 @@ def __init__(self, loop):
self.rowcount = 0
self.loop = loop

@compat.aiter_compat
def __aiter__(self):
return self

Expand Down

0 comments on commit da58cd2

Please sign in to comment.