From 7b01833100b83f65ba64a5ba877eabc369242b8b Mon Sep 17 00:00:00 2001 From: Iurii Pliner Date: Wed, 30 Aug 2023 09:12:10 +0100 Subject: [PATCH] Drop python 3.7 support (#902) --- .github/workflows/ci.yml | 2 +- aiopg/utils.py | 13 +------------ docs/index.rst | 2 +- docs/run_loop.rst | 19 ------------------- setup.py | 3 +-- tests/test_connection.py | 3 --- 6 files changed, 4 insertions(+), 38 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e50931f3..ee091080 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ jobs: name: Test on Python ${{ matrix.python }} strategy: matrix: - python: ['3.7', '3.8', '3.9', '3.10', '3.11'] + python: ['3.8', '3.9', '3.10', '3.11'] sqlalchemy: ['sqlalchemy[postgresql_psycopg2binary]>=1.4,<1.5', 'sqlalchemy[postgresql_psycopg2binary]>=2.0,<2.1'] fail-fast: false runs-on: ubuntu-latest diff --git a/aiopg/utils.py b/aiopg/utils.py index 86d66ccb..553c6a50 100644 --- a/aiopg/utils.py +++ b/aiopg/utils.py @@ -1,5 +1,4 @@ import asyncio -import sys from types import TracebackType from typing import ( Any, @@ -14,19 +13,9 @@ Union, ) -if sys.version_info >= (3, 7, 0): - __get_running_loop = asyncio.get_running_loop -else: - - def __get_running_loop() -> asyncio.AbstractEventLoop: - loop = asyncio.get_event_loop() - if not loop.is_running(): - raise RuntimeError("no running event loop") - return loop - def get_running_loop() -> asyncio.AbstractEventLoop: - return __get_running_loop() + return asyncio.get_running_loop() def create_completed_future( diff --git a/docs/index.rst b/docs/index.rst index 3be33e8a..96191c09 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -32,7 +32,7 @@ Current version is |release|. .. warning:: 1. Removing await the before :meth:`Cursor.mogrify` function - 2. Only supports ``python >= 3.7`` + 2. Only supports ``python >= 3.8`` 3. Only support syntax ``async/await`` diff --git a/docs/run_loop.rst b/docs/run_loop.rst index 31c7a7a8..985ba45b 100644 --- a/docs/run_loop.rst +++ b/docs/run_loop.rst @@ -20,22 +20,3 @@ which may be different, e.g. :func:`asyncio.set_event_loop` was not called and default loop :class:`asyncio.AbstractEventLoop` is not equal to actually executed one. - - -Implementation --------------- - -For the version below ``python3.7`` we added this implementation. - -.. code-block:: py3 - - if sys.version_info >= (3, 7, 0): - __get_running_loop = asyncio.get_running_loop - else: - def __get_running_loop() -> asyncio.AbstractEventLoop: - loop = asyncio.get_event_loop() - if not loop.is_running(): - raise RuntimeError('no running event loop') - return loop - -This allows you to get a loop :class:`asyncio.AbstractEventLoop` correctly. diff --git a/setup.py b/setup.py index 9fb659cb..2100dd89 100644 --- a/setup.py +++ b/setup.py @@ -34,7 +34,6 @@ def read_changelog(path="CHANGES.txt"): "Intended Audience :: Developers", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", @@ -58,7 +57,7 @@ def read_changelog(path="CHANGES.txt"): classifiers=classifiers, platforms=["macOS", "POSIX", "Windows"], author="Andrew Svetlov", - python_requires=">=3.7", + python_requires=">=3.8", project_urls={ "Chat: Gitter": "https://gitter.im/aio-libs/Lobby", "CI: GA": "https://github.com/aio-libs/aiopg/actions?query=workflow%3ACI", diff --git a/tests/test_connection.py b/tests/test_connection.py index 747285ad..036731a5 100755 --- a/tests/test_connection.py +++ b/tests/test_connection.py @@ -1,7 +1,6 @@ import asyncio import gc import socket -import sys import time from unittest import mock @@ -13,8 +12,6 @@ import aiopg from aiopg import DEFAULT_TIMEOUT, Connection, Cursor -PY_341 = sys.version_info >= (3, 4, 1) - @pytest.fixture def connect(make_connection):