Skip to content

Commit

Permalink
Drop python 3.7 support (#902)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pliner authored Aug 30, 2023
1 parent 7ae1a58 commit 7b01833
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 38 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 1 addition & 12 deletions aiopg/utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import asyncio
import sys
from types import TracebackType
from typing import (
Any,
Expand All @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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``

Expand Down
19 changes: 0 additions & 19 deletions docs/run_loop.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
3 changes: 0 additions & 3 deletions tests/test_connection.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import asyncio
import gc
import socket
import sys
import time
from unittest import mock

Expand All @@ -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):
Expand Down

0 comments on commit 7b01833

Please sign in to comment.