Skip to content

Commit a3778f5

Browse files
committed
Missing bits from python-trio#69
1 parent c7b9809 commit a3778f5

File tree

8 files changed

+46
-38
lines changed

8 files changed

+46
-38
lines changed

README.rst

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@
2323
trio-asyncio
2424
==============
2525

26-
**Trio-Asyncio** is a re-implementation of the ``asyncio`` mainloop on top of
26+
**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
29+
trio-asyncio requires at least Python 3.5.3. It is tested on recent versions of
3030
3.5, 3.6, 3.7, 3.8, and nightly.
3131

3232
+++++++++++
@@ -42,7 +42,7 @@ On the other hand, there are quite a few asyncio-enhanced libraries. You
4242
*really* don't want to re-invent any wheels in your project.
4343

4444
Thus, being able to use asyncio libraries from Trio is useful.
45-
Trio-Asyncio enables you to do that, and more.
45+
trio-asyncio enables you to do that, and more.
4646

4747
--------------------------------------
4848
Transparent vs. explicit translation
@@ -65,34 +65,27 @@ Trio-Asyncio's documentation is too large for a README.
6565

6666
For further information, `see the manual on readthedocs <http://trio-asyncio.readthedocs.io/en/latest/>`_.
6767

68-
++++++++++++++++++++++
69-
Hacking trio-asyncio
70-
++++++++++++++++++++++
68+
++++++++++++++
69+
Contributing
70+
++++++++++++++
7171

72-
-----------
73-
Licensing
74-
-----------
72+
Like Trio, trio-asyncio is licensed under both the MIT and Apache licenses.
73+
Submitting a patch or pull request implies your acceptance of these licenses.
7574

76-
Like trio, trio-asyncio is licensed under both the MIT and Apache licenses.
77-
Submitting patches or pull requests imply your acceptance of these licenses.
75+
Testing is done with ``pytest``. Test coverage is pretty thorough; please
76+
keep it that way when adding new code.
7877

79-
---------
80-
Patches
81-
---------
78+
See the `Trio contributor guide
79+
<https://trio.readthedocs.io/en/stable/contributing.html>`__ for much
80+
more detail on how to get involved.
8281

83-
are accepted gladly.
84-
85-
---------
86-
Testing
87-
---------
88-
89-
As in trio, testing is done with ``pytest``.
90-
91-
Test coverage is close to 100%. Please keep it that way.
82+
Contributors are requested to follow our `code of conduct
83+
<https://trio.readthedocs.io/en/stable/code-of-conduct.html>`__ in all
84+
project spaces.
9285

9386
++++++++
9487
Author
9588
++++++++
9689

97-
Matthias Urlichs <matthias@urlichs.de>
98-
90+
trio-asyncio was originally written by Matthias Urlichs <matthias@urlichs.de>.
91+
It is now maintained by the `Trio project <https://github.com/python-trio>`_.

docs/source/history.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,14 @@ Features
1414
- `trio_asyncio` now contains an `allow_asyncio` wrapper which allows you to
1515
seamlessly mix asyncio and trio semantics::
1616

17-
from trio_asyncio import run
18-
@allow_asyncio
17+
import asyncio
18+
import trio
19+
from trio_asyncio import run, allow_asyncio
1920
async def main():
2021
print("Sleeping 1")
21-
await asyncio.sleep(1)
22+
await asyncio.sleep(1)
2223
print("Sleeping 2")
23-
await trio.sleep(1)
24+
await trio.sleep(1)
2425
run(allow_asyncio, main)
2526

2627
The problem with this solution is that Trio's cancellations will no

docs/source/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
trio-asyncio: A re-implementation of the asyncio mainloop on top of Trio
99
========================================================================
1010

11-
trio-asyncio is *the* library of choice for a Python program that
11+
trio-asyncio is the library of choice for a Python program that
1212
contains both `Trio <https://trio.readthedocs.io/en/stable/>`__ and
1313
`asyncio` code.
1414

docs/source/principles.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ though Trio supports them on earlier Pythons using a backport package.
148148
Event loop implementations
149149
----------------------------
150150

151-
An asyncio event loop may generally be interrupted and restarted at any
151+
A stock asyncio event loop may be interrupted and restarted at any
152152
time, simply by making repeated calls to :meth:`run_until_complete()
153153
<asyncio.loop.run_until_complete>`.
154154
Trio, however, requires one long-running main loop. trio-asyncio bridges

docs/source/usage.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ context variables.)
209209
However, this feature should generally not be necessary, because you
210210
should know whether each function in your program is asyncio-flavored
211211
or Trio-flavored. (The two have different semantics, especially
212-
surroudning cancellation.) It's provided mainly so that your
212+
surrounding cancellation.) It's provided mainly so that your
213213
trio-asyncio program can safely depend on libraries that use `sniffio`
214214
to support both flavors. It can also be helpful if you want to assert
215215
that you're in the mode you think you're in, using ::

newsfragments/64.removal.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
The non-underscore-prefixed names of trio-asyncio submodules (``trio_asyncio.loop``,
2+
``trio_asyncio.adapter``, etc) have been deprecated; public names should be
3+
imported from ``trio_asyncio`` directly.
4+
5+
``trio_asyncio.current_policy``, ``trio_asyncio.TrioChildWatcher``,
6+
and ``trio_asyncio.TrioPolicy`` have been deprecated with no
7+
replacement. ``current_policy`` is no longer used at all, and the
8+
other two are singletons that can't be customized so there's no reason
9+
to make them publicly visible.
10+
11+
A number of functions which were already documented as deprecated now
12+
raise the new :exc:`~trio_asyncio.TrioAsyncioDeprecationWarning` where
13+
previously they provided either no runtime warning or a generic
14+
:exc:`DeprecationWarning`.

trio_asyncio/_async.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ def default_exception_handler(self, context):
2222
Rationale:
2323
2424
In traditional asyncio, there frequently is no context which the
25-
exception is supposed to effect.
25+
exception is supposed to affect.
2626
27-
trio-asyncio, however, collects the loop and all its tasks in a
28-
Trio nursery. Thus the context which must be aborted, and thus in which
29-
the error needs to be raised, is known and can easily be controlled
30-
by the programmer.
27+
trio-asyncio, however, collects the loop and all its tasks in
28+
a Trio nursery. This means the context in which the error should
29+
be raised is known and can easily be controlled by the programmer.
3130
3231
For maximum compatibility, this default handler is only used in
3332
asynchronous loops.
33+
3434
"""
3535
# TODO: add context.get('handle') to the exception
3636

trio_asyncio/_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ async def run_aio_coroutine(self, coro):
222222
then return or raise its result.
223223
224224
Cancelling the current Trio scope will cancel the coroutine,
225-
which it will experience as a single thrown `asyncio.CancelledError`
225+
which will throw a single `asyncio.CancelledError` into the coroutine
226226
(just like the usual asyncio behavior). If the coroutine then
227227
exits with a `~asyncio.CancelledError` exception, the call to
228228
:meth:`run_aio_coroutine` will raise `trio.Cancelled`.

0 commit comments

Comments
 (0)