Skip to content

Commit ee5ad26

Browse files
authored
Drop support of Python 3.7 and update CI (#578)
* Drop support of Python 3.7 * Upgrade and pin action revisions in CI * Exclude C files in wheel dist
1 parent 0e9ff6c commit ee5ad26

14 files changed

+31
-137
lines changed

.github/workflows/release.yml

+15-18
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: ubuntu-latest
1515
steps:
1616
- name: Validate release PR
17-
uses: edgedb/action-release/validate-pr@master
17+
uses: edgedb/action-release/validate-pr@bae6b9134e872166b43d218dd79397c851c41c9a
1818
id: checkver
1919
with:
2020
require_team: Release Managers
@@ -37,7 +37,7 @@ jobs:
3737
mkdir -p dist/
3838
echo "${VERSION}" > dist/VERSION
3939
40-
- uses: actions/upload-artifact@v3
40+
- uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
4141
with:
4242
name: dist
4343
path: dist/
@@ -50,12 +50,12 @@ jobs:
5050
PIP_DISABLE_PIP_VERSION_CHECK: 1
5151

5252
steps:
53-
- uses: actions/checkout@v3
53+
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
5454
with:
5555
fetch-depth: 50
5656
submodules: true
5757

58-
- uses: actions/setup-python@v4
58+
- uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1
5959
with:
6060
python-version: 3.x
6161

@@ -64,7 +64,7 @@ jobs:
6464
python -m pip install --upgrade setuptools wheel pip
6565
python setup.py sdist
6666
67-
- uses: actions/upload-artifact@v3
67+
- uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
6868
with:
6969
name: dist
7070
path: dist/*.tar.*
@@ -76,16 +76,13 @@ jobs:
7676
fail-fast: false
7777
matrix:
7878
os: [ubuntu-latest, macos-latest]
79-
cibw_python: ["cp37-*", "cp38-*", "cp39-*", "cp310-*", "cp311-*", "cp312-*"]
79+
cibw_python: ["cp38-*", "cp39-*", "cp310-*", "cp311-*", "cp312-*"]
8080
cibw_arch: ["x86_64", "aarch64", "universal2"]
8181
exclude:
8282
- os: ubuntu-latest
8383
cibw_arch: universal2
8484
- os: macos-latest
8585
cibw_arch: aarch64
86-
- os: macos-latest
87-
cibw_python: "cp37-*"
88-
cibw_arch: universal2
8986

9087
defaults:
9188
run:
@@ -95,14 +92,14 @@ jobs:
9592
PIP_DISABLE_PIP_VERSION_CHECK: 1
9693

9794
steps:
98-
- uses: actions/checkout@v3
95+
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
9996
with:
10097
fetch-depth: 50
10198
submodules: true
10299

103100
- name: Set up QEMU
104101
if: matrix.os == 'ubuntu-latest' && matrix.cibw_arch == 'aarch64'
105-
uses: docker/setup-qemu-action@v1
102+
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0
106103
with:
107104
platforms: arm64
108105

@@ -111,14 +108,14 @@ jobs:
111108
run: |
112109
brew install gnu-sed libtool autoconf automake
113110
114-
- uses: pypa/[email protected]
111+
- uses: pypa/cibuildwheel@fff9ec32ed25a9c576750c91e06b410ed0c15db7 # v2.16.2
115112
env:
116113
CIBW_BUILD_VERBOSITY: 1
117114
CIBW_BUILD: ${{ matrix.cibw_python }}
118115
CIBW_ARCHS: ${{ matrix.cibw_arch }}
119116
CIBW_TEST_SKIP: "*universal2:arm64"
120117

121-
- uses: actions/upload-artifact@v3
118+
- uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
122119
with:
123120
name: dist
124121
path: wheelhouse/*.whl
@@ -128,12 +125,12 @@ jobs:
128125
runs-on: ubuntu-latest
129126

130127
steps:
131-
- uses: actions/checkout@v3
128+
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
132129
with:
133130
fetch-depth: 5
134131
submodules: false
135132

136-
- uses: actions/download-artifact@v3
133+
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
137134
with:
138135
name: dist
139136
path: dist/
@@ -142,11 +139,11 @@ jobs:
142139
id: relver
143140
run: |
144141
set -e
145-
echo ::set-output name=version::$(cat dist/VERSION)
142+
echo version=$(cat dist/VERSION) >> $GITHUB_OUTPUT
146143
rm dist/VERSION
147144
148145
- name: Merge and tag the PR
149-
uses: edgedb/action-release/merge@master
146+
uses: edgedb/action-release/merge@bae6b9134e872166b43d218dd79397c851c41c9a
150147
with:
151148
github_token: ${{ secrets.RELEASE_BOT_GITHUB_TOKEN }}
152149
ssh_key: ${{ secrets.RELEASE_BOT_SSH_KEY }}
@@ -169,7 +166,7 @@ jobs:
169166
ls -al dist/
170167
171168
- name: Upload to PyPI
172-
uses: pypa/gh-action-pypi-publish@master
169+
uses: pypa/gh-action-pypi-publish@b7f401de30cb6434a1e19f805ff006643653240e # v1.8.10
173170
with:
174171
user: __token__
175172
password: ${{ secrets.PYPI_TOKEN }}

.github/workflows/tests.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,20 @@ jobs:
1414
runs-on: ${{ matrix.os }}
1515
strategy:
1616
matrix:
17-
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
17+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
1818
os: [ubuntu-latest, macos-latest]
1919

2020
env:
2121
PIP_DISABLE_PIP_VERSION_CHECK: 1
2222

2323
steps:
24-
- uses: actions/checkout@v3
24+
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
2525
with:
2626
fetch-depth: 50
2727
submodules: true
2828

2929
- name: Check if release PR.
30-
uses: edgedb/action-release/validate-pr@master
30+
uses: edgedb/action-release/validate-pr@bae6b9134e872166b43d218dd79397c851c41c9a
3131
id: release
3232
with:
3333
github_token: ${{ secrets.RELEASE_BOT_GITHUB_TOKEN }}
@@ -37,7 +37,7 @@ jobs:
3737
__version__\s*=\s*(?:['"])([[:PEP440:]])(?:['"])
3838
3939
- name: Set up Python ${{ matrix.python-version }}
40-
uses: actions/setup-python@v4
40+
uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1
4141
if: steps.release.outputs.version == 0
4242
with:
4343
python-version: ${{ matrix.python-version }}

README.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ about it.
3939
Installation
4040
------------
4141

42-
uvloop requires Python 3.7 or greater and is available on PyPI.
42+
uvloop requires Python 3.8 or greater and is available on PyPI.
4343
Use pip to install it::
4444

4545
$ pip install uvloop
@@ -96,7 +96,7 @@ snippet can be used:
9696
Building From Source
9797
--------------------
9898

99-
To build uvloop, you'll need Python 3.7 or greater:
99+
To build uvloop, you'll need Python 3.8 or greater:
100100

101101
1. Clone the repository:
102102

docs/dev/index.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ from the `libuv` Github repository.
2828
Build
2929
-----
3030

31-
To build `uvloop`, you'll need ``Cython`` and Python 3.7.
31+
To build `uvloop`, you'll need ``Cython`` and Python 3.8.
3232

3333
.. note::
3434

docs/user/index.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ uvloop.
88
Installation
99
------------
1010

11-
`uvloop` is available from PyPI. It requires Python 3.7.
11+
`uvloop` is available from PyPI. It requires Python 3.8.
1212

1313
Use pip to install it.
1414

pyproject.toml

+4-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "uvloop"
33
description = "Fast implementation of asyncio event loop on top of libuv"
44
authors = [{name = "Yury Selivanov", email = "[email protected]"}]
5-
requires-python = '>=3.7.0'
5+
requires-python = '>=3.8.0'
66
readme = "README.rst"
77
license = {text = "MIT License"}
88
dynamic = ["version"]
@@ -19,7 +19,6 @@ classifiers = [
1919
"Operating System :: POSIX",
2020
"Operating System :: MacOS :: MacOS X",
2121
"Programming Language :: Python :: 3 :: Only",
22-
"Programming Language :: Python :: 3.7",
2322
"Programming Language :: Python :: 3.8",
2423
"Programming Language :: Python :: 3.9",
2524
"Programming Language :: Python :: 3.10",
@@ -64,6 +63,9 @@ build-backend = "setuptools.build_meta"
6463
zip-safe = false
6564
packages = ["uvloop"]
6665

66+
[tool.setuptools.exclude-package-data]
67+
"*" = ["*.c", "*.h"]
68+
6769
[tool.cibuildwheel]
6870
build-frontend = "build"
6971
test-extras = "test"

setup.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import sys
22

33
vi = sys.version_info
4-
if vi < (3, 7):
5-
raise RuntimeError('uvloop requires Python 3.7 or greater')
4+
if vi < (3, 8):
5+
raise RuntimeError('uvloop requires Python 3.8 or greater')
66

77
if sys.platform in ('win32', 'cygwin', 'cli'):
88
raise RuntimeError('uvloop does not support Windows at the moment')

tests/test_base.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -561,9 +561,6 @@ async def coro():
561561
self.loop.run_until_complete(task)
562562

563563
def test_set_task_name(self):
564-
if self.implementation == 'asyncio' and sys.version_info < (3, 8, 0):
565-
raise unittest.SkipTest('unsupported task name')
566-
567564
self.loop._process_events = mock.Mock()
568565

569566
result = None
@@ -586,8 +583,7 @@ async def coro():
586583
self.assertIsNone(self.loop.get_task_factory())
587584
task = self.loop.create_task(coro(), name="mytask")
588585
self.assertFalse(isinstance(task, MyTask))
589-
if sys.version_info >= (3, 8, 0):
590-
self.assertEqual(task.get_name(), "mytask")
586+
self.assertEqual(task.get_name(), "mytask")
591587
self.loop.run_until_complete(task)
592588

593589
self.loop.set_task_factory(factory)

tests/test_process.py

-3
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,6 @@ async def test():
166166

167167
self.loop.run_until_complete(test())
168168

169-
@unittest.skipIf(sys.version_info < (3, 8, 0),
170-
"3.5 to 3.7 does not support path-like objects "
171-
"in the asyncio subprocess API")
172169
def test_process_executable_2(self):
173170
async def test():
174171
proc = await asyncio.create_subprocess_exec(

tests/test_signals.py

-19
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
import subprocess
44
import sys
55
import time
6-
import unittest
7-
import uvloop
86

97
from uvloop import _testbase as tb
108

@@ -395,23 +393,6 @@ def test_signals_no_SIGCHLD(self):
395393

396394
self.loop.add_signal_handler(signal.SIGCHLD, lambda *a: None)
397395

398-
@unittest.skipIf(sys.version_info[:3] >= (3, 8, 0),
399-
'in 3.8 a ThreadedChildWatcher is used '
400-
'(does not rely on SIGCHLD)')
401-
def test_asyncio_add_watcher_SIGCHLD_nop(self):
402-
asyncio.set_event_loop_policy(asyncio.DefaultEventLoopPolicy())
403-
asyncio.get_event_loop_policy().get_child_watcher()
404-
405-
try:
406-
loop = uvloop.new_event_loop()
407-
with self.assertWarnsRegex(
408-
RuntimeWarning,
409-
"asyncio is trying to install its ChildWatcher"):
410-
asyncio.set_event_loop(loop)
411-
finally:
412-
asyncio.set_event_loop(None)
413-
loop.close()
414-
415396

416397
class Test_AIO_Signals(_TestSignal, tb.AIOTestCase):
417398
NEW_LOOP = 'asyncio.new_event_loop()'

tests/test_sockets.py

-30
Original file line numberDiff line numberDiff line change
@@ -20,36 +20,6 @@ async def recv_all(self, sock, nbytes):
2020
buf += await self.loop.sock_recv(sock, nbytes - len(buf))
2121
return buf
2222

23-
def test_socket_connect_recv_send(self):
24-
if sys.version_info[:3] >= (3, 8, 0):
25-
# @asyncio.coroutine is deprecated in 3.8
26-
raise unittest.SkipTest()
27-
28-
def srv_gen(sock):
29-
sock.send(b'helo')
30-
data = sock.recv_all(4 * _SIZE)
31-
self.assertEqual(data, b'ehlo' * _SIZE)
32-
sock.send(b'O')
33-
sock.send(b'K')
34-
35-
# We use @asyncio.coroutine & `yield from` to test
36-
# the compatibility of Cython's 'async def' coroutines.
37-
@asyncio.coroutine
38-
def client(sock, addr):
39-
yield from self.loop.sock_connect(sock, addr)
40-
data = yield from self.recv_all(sock, 4)
41-
self.assertEqual(data, b'helo')
42-
yield from self.loop.sock_sendall(sock, b'ehlo' * _SIZE)
43-
data = yield from self.recv_all(sock, 2)
44-
self.assertEqual(data, b'OK')
45-
46-
with self.tcp_server(srv_gen) as srv:
47-
48-
sock = socket.socket()
49-
with sock:
50-
sock.setblocking(False)
51-
self.loop.run_until_complete(client(sock, srv.addr))
52-
5323
def test_socket_accept_recv_send(self):
5424
async def server():
5525
sock = socket.socket()

tests/test_tcp.py

-43
Original file line numberDiff line numberDiff line change
@@ -1063,49 +1063,6 @@ async def run():
10631063

10641064
self.loop.run_until_complete(run())
10651065

1066-
@unittest.skipIf(sys.version_info[:3] >= (3, 8, 0),
1067-
"3.8 has a different method of GCing unclosed streams")
1068-
def test_tcp_handle_unclosed_gc(self):
1069-
fut = self.loop.create_future()
1070-
1071-
async def server(reader, writer):
1072-
writer.transport.abort()
1073-
fut.set_result(True)
1074-
1075-
async def run():
1076-
addr = srv.sockets[0].getsockname()
1077-
await asyncio.open_connection(*addr)
1078-
await fut
1079-
srv.close()
1080-
await srv.wait_closed()
1081-
1082-
srv = self.loop.run_until_complete(asyncio.start_server(
1083-
server,
1084-
'127.0.0.1', 0,
1085-
family=socket.AF_INET))
1086-
1087-
if self.loop.get_debug():
1088-
rx = r'unclosed resource <TCP.*; ' \
1089-
r'object created at(.|\n)*test_tcp_handle_unclosed_gc'
1090-
else:
1091-
rx = r'unclosed resource <TCP.*'
1092-
1093-
with self.assertWarnsRegex(ResourceWarning, rx):
1094-
self.loop.create_task(run())
1095-
self.loop.run_until_complete(srv.wait_closed())
1096-
self.loop.run_until_complete(asyncio.sleep(0.1))
1097-
1098-
srv = None
1099-
gc.collect()
1100-
gc.collect()
1101-
gc.collect()
1102-
1103-
self.loop.run_until_complete(asyncio.sleep(0.1))
1104-
1105-
# Since one TCPTransport handle wasn't closed correctly,
1106-
# we need to disable this check:
1107-
self.skip_unclosed_handles_check()
1108-
11091066
def test_tcp_handle_abort_in_connection_made(self):
11101067
async def server(reader, writer):
11111068
try:

0 commit comments

Comments
 (0)