Skip to content
a re-implementation of the asyncio mainloop on top of Trio
Branch: master
Clone or download
smurfix Merge pull request #53 from python-trio/cancel
open_cancel_scope → CancelScope
Latest commit 8098e93 Feb 13, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
ci
debian
docs Fix cross-references Dec 9, 2018
newsfragments Upgrade from deprecated trio.Queue Dec 9, 2018
tests open_cancel_scope → CancelScope Feb 12, 2019
trio_asyncio open_cancel_scope → CancelScope Feb 12, 2019
.appveyor.yml Add 3.7 and 3.8-dev to the test matrix Jul 28, 2018
.coveragerc
.gitignore .gitignore Jul 23, 2018
.readthedocs.yml
.style.yapf No more flake8 warnings Feb 14, 2018
.travis.yml allow for failures on 3.8 Aug 3, 2018
CHEATSHEET.rst updated cheat sheet, Makefile Feb 16, 2018
CODE_OF_CONDUCT.md Imported cookiecutter-trio -generated files, lightly modified. Feb 12, 2018
CONTRIBUTING.md Imported cookiecutter-trio -generated files, lightly modified. Feb 12, 2018
LICENSE
LICENSE.APACHE2 python-trio project boilerplate Jan 21, 2018
LICENSE.MIT python-trio project boilerplate Jan 21, 2018
MANIFEST.in require pytest-trio for testing Feb 15, 2018
Makefile don't complain if a tag is set already Jul 26, 2018
README.rst Add 3.5.3 requirement to setup.py's description Aug 25, 2018
pyproject.toml Imported cookiecutter-trio -generated files, lightly modified. Feb 12, 2018
setup.cfg Heed deprecation warning Aug 3, 2018
setup.py open_cancel_scope → CancelScope Feb 12, 2019

README.rst

Join chatroom Documentation Status Automated test status (Linux and MacOS) Automated test status (Windows) Test coverage

trio-asyncio

Trio-Asyncio is a re-implementation of the asyncio mainloop on top of Trio.

Trio-Asyncio requires Python 3.6 or 3.7. It should work on Python 3.5.3, but that's not tested, as the test suite requires 3.6.

Rationale

Trio has native concepts of tasks and task cancellation. Asyncio is based on callbacks and chaining Futures, albeit with nicer syntax, which make handling of failures and timeouts fundamentally less reliable, esp. in larger programs. Thus, you really want to base your async project on Trio.

On the other hand, there are quite a few asyncio-enhanced libraries. You really don't want to re-invent any wheels in your project.

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

Transparent vs. explicit translation

trio_asyncio does not try to magically allow calling await trio_code() from asyncio or vice versa. There are multiple reasons for this; the executive summary is that cross-domain calls can't be made to work correctly, and any such call is likely to result in an irrecoverable error. You need to keep your code's asyncio and trio domains rigidly separate.

Fortunately, this is not difficult.

Usage

Trio-Asyncio's documentation is too large for a README.

For further information, see the manual on readthedocs.

Hacking trio-asyncio

Licensing

Like trio, trio-asyncio is licensed under both the MIT and Apache licenses. Submitting patches or pull requests imply your acceptance of these licenses.

Patches

are accepted gladly.

Testing

As in trio, testing is done with pytest.

Test coverage is close to 100%. Please keep it that way.

Author

Matthias Urlichs <matthias@urlichs.de>

You can’t perform that action at this time.