Skip to content

Drop Python 3.5/3.6 support #383

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: [3.5, 3.6, 3.7, 3.8, 3.9]
python-version: [3.7, 3.8, 3.9]
os: [ubuntu-20.04, macos-latest]
arch: [x86_64, aarch64]
exclude:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: [3.5, 3.6, 3.7, 3.8, 3.9]
python-version: [3.7, 3.8, 3.9]
os: [ubuntu-latest, macos-latest]

steps:
Expand Down
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ about it.
Installation
------------

uvloop requires Python 3.5 or greater and is available on PyPI.
uvloop requires Python 3.7 or greater and is available on PyPI.
Use pip to install it::

$ pip install uvloop
Expand Down Expand Up @@ -72,7 +72,7 @@ manually creating an asyncio event loop:
Building From Source
--------------------

To build uvloop, you'll need Python 3.5 or greater:
To build uvloop, you'll need Python 3.7 or greater:

1. Clone the repository:

Expand Down
2 changes: 1 addition & 1 deletion docs/dev/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ from the `libuv` Github repository.
Build
-----

To build `uvloop`, you'll need ``Cython`` and Python 3.5.
To build `uvloop`, you'll need ``Cython`` and Python 3.7.

.. note::

Expand Down
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 @@ uvloop
`uvloop` is a fast, drop-in replacement of the built-in asyncio event loop.
`uvloop` is released under the MIT license.

`uvloop` and asyncio, combined with the power of async/await in Python 3.5,
`uvloop` and asyncio, combined with the power of async/await in Python 3.7,
makes it easier than ever to write high-performance networking code in Python.

`uvloop` makes asyncio fast. In fact, it is at least 2x faster than nodejs,
Expand Down
2 changes: 1 addition & 1 deletion docs/user/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ uvloop.
Installation
------------

`uvloop` is available from PyPI. It requires Python 3.5.
`uvloop` is available from PyPI. It requires Python 3.7.

Use pip to install it.

Expand Down
9 changes: 2 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import sys

vi = sys.version_info
if vi < (3, 5):
raise RuntimeError('uvloop requires Python 3.5 or greater')
if vi[:2] == (3, 6):
if vi.releaselevel == 'beta' and vi.serial < 3:
raise RuntimeError('uvloop requires Python 3.5 or 3.6b3 or greater')
if vi < (3, 7):
raise RuntimeError('uvloop requires Python 3.7 or greater')

if sys.platform in ('win32', 'cygwin', 'cli'):
raise RuntimeError('uvloop does not support Windows at the moment')
Expand Down Expand Up @@ -310,8 +307,6 @@ def build_extensions(self):
'Development Status :: 5 - Production/Stable',
'Framework :: AsyncIO',
'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',
'Programming Language :: Python :: 3.9',
Expand Down
39 changes: 10 additions & 29 deletions tests/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,9 +345,6 @@ async def foo():
self.loop.run_until_complete(foo())

def test_run_until_complete_loop_orphan_future_close_loop(self):
if self.implementation == 'asyncio' and sys.version_info < (3, 6, 2):
raise unittest.SkipTest('unfixed asyncio')

async def foo(delay):
await asyncio.sleep(delay)

Expand Down Expand Up @@ -463,9 +460,7 @@ def handler(loop, exc):

self.loop.set_debug(True)

if hasattr(self.loop, 'get_exception_handler'):
# Available since Python 3.5.2
self.assertIsNone(self.loop.get_exception_handler())
self.assertIsNone(self.loop.get_exception_handler())
self.loop.set_exception_handler(handler)
if hasattr(self.loop, 'get_exception_handler'):
self.assertIs(self.loop.get_exception_handler(), handler)
Expand Down Expand Up @@ -582,31 +577,19 @@ async def coro():
self.loop.set_task_factory(None)
self.assertIsNone(self.loop.get_task_factory())

def _compile_agen(self, src):
try:
g = {}
exec(src, globals(), g)
except SyntaxError:
# Python < 3.6
raise unittest.SkipTest()
else:
return g['waiter']

def test_shutdown_asyncgens_01(self):
finalized = list()

if not hasattr(self.loop, 'shutdown_asyncgens'):
raise unittest.SkipTest()

waiter = self._compile_agen(
'''async def waiter(timeout, finalized):
try:
await asyncio.sleep(timeout)
yield 1
finally:
await asyncio.sleep(0)
finalized.append(1)
''')
async def waiter(timeout, finalized):
try:
await asyncio.sleep(timeout)
yield 1
finally:
await asyncio.sleep(0)
finalized.append(1)

async def wait():
async for _ in waiter(1, finalized):
Expand Down Expand Up @@ -641,13 +624,12 @@ def logger(loop, context):
self.assertIn('asyncgen', context)
logged += 1

waiter = self._compile_agen('''async def waiter(timeout):
async def waiter(timeout):
try:
await asyncio.sleep(timeout)
yield 1
finally:
1 / 0
''')

async def wait():
async for _ in waiter(1):
Expand All @@ -669,10 +651,9 @@ def test_shutdown_asyncgens_03(self):
if not hasattr(self.loop, 'shutdown_asyncgens'):
raise unittest.SkipTest()

waiter = self._compile_agen('''async def waiter():
async def waiter():
yield 1
yield 2
''')

async def foo():
# We specifically want to hit _asyncgen_finalizer_hook
Expand Down
33 changes: 2 additions & 31 deletions tests/test_context.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
import asyncio
import contextvars
import decimal
import random
import sys
import unittest
import weakref

from uvloop import _testbase as tb


PY37 = sys.version_info >= (3, 7, 0)


class _ContextBaseTests:

@unittest.skipUnless(PY37, 'requires Python 3.7')
def test_task_decimal_context(self):
async def fractions(t, precision, x, y):
with decimal.localcontext() as ctx:
Expand All @@ -37,9 +32,7 @@ async def main():
self.assertEqual(str(r2[0]), '0.333333')
self.assertEqual(str(r2[1]), '0.111111')

@unittest.skipUnless(PY37, 'requires Python 3.7')
def test_task_context_1(self):
import contextvars
cvar = contextvars.ContextVar('cvar', default='nope')

async def sub():
Expand All @@ -58,9 +51,7 @@ async def main():
task = self.loop.create_task(main())
self.loop.run_until_complete(task)

@unittest.skipUnless(PY37, 'requires Python 3.7')
def test_task_context_2(self):
import contextvars
cvar = contextvars.ContextVar('cvar', default='nope')

async def main():
Expand Down Expand Up @@ -90,9 +81,7 @@ def fut_on_done(fut):

self.assertEqual(cvar.get(), 'nope')

@unittest.skipUnless(PY37, 'requires Python 3.7')
def test_task_context_3(self):
import contextvars
cvar = contextvars.ContextVar('cvar', default=-1)

# Run 100 Tasks in parallel, each modifying cvar.
Expand All @@ -115,9 +104,7 @@ async def main():

self.assertEqual(cvar.get(), -1)

@unittest.skipUnless(PY37, 'requires Python 3.7')
def test_task_context_4(self):
import contextvars
cvar = contextvars.ContextVar('cvar', default='nope')

class TrackMe:
Expand All @@ -141,23 +128,7 @@ async def main():


class Test_UV_Context(_ContextBaseTests, tb.UVTestCase):

@unittest.skipIf(PY37, 'requires Python <3.6')
def test_context_arg(self):
def cb():
pass

with self.assertRaisesRegex(NotImplementedError,
'requires Python 3.7'):
self.loop.call_soon(cb, context=1)

with self.assertRaisesRegex(NotImplementedError,
'requires Python 3.7'):
self.loop.call_soon_threadsafe(cb, context=1)

with self.assertRaisesRegex(NotImplementedError,
'requires Python 3.7'):
self.loop.call_later(0.1, cb, context=1)
pass


class Test_AIO_Context(_ContextBaseTests, tb.AIOTestCase):
Expand Down
4 changes: 0 additions & 4 deletions tests/test_sockets.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ async def recv_all(self, sock, nbytes):
return buf

def test_socket_connect_recv_send(self):
if self.is_asyncio_loop() and sys.version_info[:3] == (3, 5, 2):
# See https://github.com/python/asyncio/pull/366 for details.
raise unittest.SkipTest()

if sys.version_info[:3] >= (3, 8, 0):
# @asyncio.coroutine is deprecated in 3.8
raise unittest.SkipTest()
Expand Down
2 changes: 0 additions & 2 deletions tests/test_sourcecode.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ def find_uvloop_root():

class TestFlake8(unittest.TestCase):

@unittest.skipIf(sys.version_info < (3, 6, 0),
"flake8 under 3.5 does not recognize f-strings in *.pyx")
def test_flake8(self):
edgepath = find_uvloop_root()
config_path = os.path.join(edgepath, '.flake8')
Expand Down
Loading