Skip to content

Commit 3d37218

Browse files
committed
Drop py3.5
1 parent 2440c92 commit 3d37218

File tree

12 files changed

+77
-47
lines changed

12 files changed

+77
-47
lines changed

.appveyor.yml

-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ os: Visual Studio 2015
44

55
environment:
66
matrix:
7-
#- PYTHON: "C:\\Python35"
8-
#- PYTHON: "C:\\Python35-x64"
97
- PYTHON: "C:\\Python36"
108
- PYTHON: "C:\\Python36-x64"
119
- PYTHON: "C:\\Python37"

.travis.yml

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ dist: xenial
33

44
matrix:
55
include:
6-
- python: 3.5
76
- python: 3.6
87
- python: 3.7
98
- python: 3.7-dev

README.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
**trio-asyncio** is a re-implementation of the ``asyncio`` mainloop on top of
2727
Trio.
2828

29-
trio-asyncio requires at least Python 3.5.3. It is tested on recent versions of
30-
3.5, 3.6, 3.7, 3.8, and nightly.
29+
Trio-Asyncio requires at least Python 3.6. It is tested on recent versions of
30+
3.6, 3.7, 3.8, and nightly.
3131

3232
+++++++++++
3333
Rationale

docs/source/index.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ asyncio libraries such as ``home-assistant``.
5151
Helpful facts:
5252

5353
* Supported environments: Linux, MacOS, or Windows running some kind of Python
54-
3.5.3-or-better (either CPython or PyPy3 is fine). \*BSD and illumOS likely
54+
3.6-or-better (either CPython or PyPy3 is fine). \*BSD and illumOS likely
5555
work too, but are untested.
5656

5757
* Install: ``python3 -m pip install -U trio-asyncio`` (or on Windows, maybe

setup.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
code (asyncio: ~8000) but passes the complete Python 3.6 test suite with no
4444
errors.
4545
46-
``trio_asyncio`` requires Python 3.5.3 or better.
46+
``trio_asyncio`` requires Python 3.6 or better.
4747
4848
Author
4949
======
@@ -53,12 +53,12 @@
5353
"""
5454

5555
install_requires = [
56-
"trio >= 0.12.0",
57-
"async_generator >= 1.6",
56+
"trio >= 0.13.0",
5857
"outcome",
5958
]
6059
if sys.version_info < (3, 7):
6160
install_requires.append("contextvars >= 2.1")
61+
install_requires.append("async_generator >= 1.6")
6262

6363
setup(
6464
name="trio_asyncio",
@@ -74,7 +74,7 @@
7474
# This means, just install *everything* you see under trio/, even if it
7575
# doesn't look like a source file, so long as it appears in MANIFEST.in:
7676
include_package_data=True,
77-
python_requires=">=3.5.2", # temporary, for RTD
77+
python_requires=">=3.6", # temporary, for RTD
7878
keywords=["async", "io", "trio", "asyncio", "trio-asyncio"],
7979
setup_requires=['pytest-runner'],
8080
tests_require=['pytest', 'outcome'],

tests/conftest.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import asyncio
33
import trio_asyncio
44
import inspect
5-
from async_generator import async_generator, yield_
65

76
# Hacks for <3.7
87
if not hasattr(asyncio, 'run'):
@@ -45,11 +44,10 @@ def create_task(coro):
4544

4645

4746
@pytest.fixture
48-
@async_generator
4947
async def loop():
5048
async with trio_asyncio.open_loop() as loop:
5149
try:
52-
await yield_(loop)
50+
yield loop
5351
finally:
5452
await loop.stop().wait()
5553

tests/interop/test_adapter.py

+10-12
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import pytest
2-
from async_generator import async_generator, yield_
32
from trio_asyncio import aio_as_trio, trio_as_aio, allow_asyncio
43
from trio_asyncio import aio2trio, trio2aio
54
import asyncio
@@ -8,7 +7,10 @@
87
from tests import aiotest
98
import sys
109
import warnings
11-
from async_generator import asynccontextmanager
10+
try:
11+
from contextlib import asynccontextmanager
12+
except ImportError:
13+
from async_generator import asynccontextmanager
1214
from .. import utils as test_utils
1315
from trio_asyncio import TrioAsyncioDeprecationWarning
1416

@@ -74,43 +76,39 @@ async def dly_asyncio(self, do_test=True):
7476
self.flag |= 1
7577
return 4
7678

77-
@async_generator
7879
async def iter_asyncio(self, do_test=True):
7980
if do_test and sys.version_info >= (3, 7):
8081
assert sniffio.current_async_library() == "asyncio"
8182
await asyncio.sleep(0.01, loop=self.loop)
82-
await yield_(1)
83+
yield 1
8384
await asyncio.sleep(0.01, loop=self.loop)
84-
await yield_(2)
85+
yield 2
8586
await asyncio.sleep(0.01, loop=self.loop)
8687
self.flag |= 1
8788

88-
@async_generator
8989
async def iter_trio(self):
9090
if sys.version_info >= (3, 7):
9191
assert sniffio.current_async_library() == "trio"
9292
await trio.sleep(0.01)
93-
await yield_(1)
93+
yield 1
9494
await trio.sleep(0.01)
95-
await yield_(2)
95+
yield 2
9696
await trio.sleep(0.01)
9797
self.flag |= 1
9898

9999
@asynccontextmanager
100-
@async_generator
101100
async def ctx_asyncio(self):
102101
await asyncio.sleep(0.01, loop=self.loop)
103102
self.flag |= 1
104-
await yield_(self)
103+
yield self
105104
await asyncio.sleep(0.01, loop=self.loop)
106105
self.flag |= 2
107106

108107
@asynccontextmanager
109-
@async_generator
110108
async def ctx_trio(self):
111109
await trio.sleep(0.01)
112110
self.flag |= 1
113-
await yield_(self)
111+
yield self
114112
await trio.sleep(0.01)
115113
self.flag |= 2
116114

tests/interop/test_calls.py

+7-13
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import asyncio
33
import trio
44
import sniffio
5-
from async_generator import async_generator, yield_
65
from trio_asyncio import aio_as_trio, trio_as_aio
76
from tests import aiotest
87
from functools import partial
@@ -526,23 +525,21 @@ def err_asyncio():
526525

527526
@pytest.mark.trio
528527
async def test_trio_asyncio_generator(self, loop):
529-
@async_generator
530528
async def dly_asyncio():
531-
await yield_(1)
529+
yield 1
532530
await asyncio.sleep(0.01, loop=loop)
533-
await yield_(2)
531+
yield 2
534532

535533
with test_utils.deprecate(self):
536534
res = await async_gen_to_list(loop.wrap_generator(dly_asyncio))
537535
assert res == [1, 2]
538536

539537
@pytest.mark.trio
540538
async def test_trio_asyncio_generator_with_error(self, loop):
541-
@async_generator
542539
async def dly_asyncio():
543-
await yield_(1)
540+
yield 1
544541
raise RuntimeError("I has an owie")
545-
await yield_(2)
542+
yield 2
546543

547544
with test_utils.deprecate(self):
548545
with pytest.raises(RuntimeError) as err:
@@ -551,9 +548,8 @@ async def dly_asyncio():
551548

552549
@pytest.mark.trio
553550
async def test_trio_asyncio_generator_with_cancellation(self, loop):
554-
@async_generator
555551
async def dly_asyncio(hold, seen):
556-
await yield_(1)
552+
yield 1
557553
seen.flag |= 1
558554
await hold.wait()
559555

@@ -573,11 +569,10 @@ async def cancel_soon(nursery):
573569

574570
@pytest.mark.trio
575571
async def test_trio_asyncio_iterator(self, loop):
576-
@async_generator
577572
async def slow_nums():
578573
for n in range(1, 6):
579574
await asyncio.sleep(0.01, loop=loop)
580-
await yield_(n)
575+
yield n
581576

582577
sum = 0
583578
async for n in aio_as_trio(slow_nums()):
@@ -586,11 +581,10 @@ async def slow_nums():
586581

587582
@pytest.mark.trio
588583
async def test_trio_asyncio_iterator_depr(self, loop):
589-
@async_generator
590584
async def slow_nums():
591585
for n in range(1, 6):
592586
await asyncio.sleep(0.01, loop=loop)
593-
await yield_(n)
587+
yield n
594588

595589
sum = 0
596590
# with test_utils.deprecate(self): ## not yet

tests/python/conftest.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def skip(rel_id):
124124

125125
# These fail with ConnectionResetError on Pythons <= 3.7.x
126126
# for some unknown x. (3.7.1 fails, 3.7.5 and 3.7.6 pass;
127-
# older 3.6.x also affected, and older-or-all 3.5.x)
127+
# older 3.6.x also affected)
128128
if sys.platform != "win32" and sys.version_info < (3, 8):
129129
import selectors
130130

tox.ini

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
[tox]
2+
envlist = py36,py37
3+
4+
[sphinx-vars]
5+
build_dir = build
6+
input_dir = docs/source
7+
sphinxopts = -a -W -b html
8+
autosphinxopts = -i *~ -i *.sw* -i Makefile*
9+
sphinxbuilddir = {[sphinx-vars]build_dir}/sphinx/html
10+
allsphinxopts = -d {[sphinx-vars]build_dir}/sphinx/doctrees {[sphinx-vars]sphinxopts} docs
11+
12+
[testenv]
13+
deps =
14+
pytest
15+
outcome
16+
commands =
17+
pytest -xvvv --full-trace
18+
19+
[testenv:pylint]
20+
deps =
21+
pylint
22+
commands =
23+
pylint trio_asyncio
24+
25+
[testenv:flake8]
26+
deps =
27+
flake8
28+
commands =
29+
flake8 trio_asyncio tests
30+
31+
[testenv:doc]
32+
deps =
33+
sphinx
34+
sphinx-rtd-theme
35+
sphinxcontrib-trio
36+
commands =
37+
sphinx-build -a {[sphinx-vars]input_dir} {[sphinx-vars]build_dir}
38+
39+
[testenv:livehtml]
40+
deps =
41+
sphinx
42+
sphinx-autobuild
43+
commands =
44+
sphinx-autobuild {[sphinx-vars]autosphinxopts} {[sphinx-vars]allsphinxopts} {[sphinx-vars]sphinxbuilddir}

trio_asyncio/_loop.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@
88
import threading
99
from contextvars import ContextVar
1010

11-
from async_generator import async_generator, yield_, asynccontextmanager
11+
try:
12+
from contextlib import asynccontextmanager
13+
except ImportError:
14+
from async_generator import asynccontextmanager
1215

1316
from ._util import run_aio_future, run_aio_generator
1417
from ._async import TrioEventLoop
@@ -368,7 +371,6 @@ def __exit__(self, *tb):
368371

369372

370373
@asynccontextmanager
371-
@async_generator
372374
async def open_loop(queue_len=None):
373375
"""Returns a Trio-flavored async context manager which provides
374376
an asyncio event loop running on top of Trio.
@@ -396,7 +398,7 @@ async def async_main(*args):
396398
loop._closed = False
397399
await loop._main_loop_init(nursery)
398400
await nursery.start(loop._main_loop)
399-
await yield_(loop)
401+
yield loop
400402
finally:
401403
try:
402404
await loop._main_loop_exit()

trio_asyncio/_util.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import sys
77
import outcome
88
import sniffio
9-
from async_generator import async_generator, yield_
109

1110

1211
async def run_aio_future(future):
@@ -59,7 +58,6 @@ def abort_cb(raise_cancel_arg):
5958
STOP = object()
6059

6160

62-
@async_generator
6361
async def run_aio_generator(loop, async_generator):
6462
"""Return a Trio-flavored async iterator which wraps the given
6563
asyncio-flavored async iterator (usually an async generator, but
@@ -116,7 +114,7 @@ def abort_cb(raise_cancel_arg):
116114

117115
if item is STOP:
118116
break
119-
await yield_(item)
117+
yield item
120118

121119
except asyncio.CancelledError as exc:
122120
if raise_cancel is not None:
@@ -130,7 +128,6 @@ def abort_cb(raise_cancel_arg):
130128
raise
131129

132130

133-
@async_generator
134131
async def run_trio_generator(loop, async_generator):
135132
"""Run a Trio generator from within asyncio"""
136133
while True:
@@ -140,7 +137,7 @@ async def run_trio_generator(loop, async_generator):
140137
except StopAsyncIteration:
141138
break
142139
else:
143-
await yield_(item)
140+
yield item
144141

145142

146143
# Copied from Trio:

0 commit comments

Comments
 (0)