Skip to content
Trio – a friendly Python library for async concurrency and I/O
Python Shell
Branch: master
Clone or download
Latest commit 30799ed Feb 13, 2020
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs Merge pull request #1401 from lewoudar/documentation Feb 12, 2020
logo Add references to forum everywhere, and spruce up README a bit Feb 7, 2019
newsfragments Add missing newfragment for issue #1308 Dec 20, 2019
notes-to-self Add script to check how wait_readable scales with the number of sockets Oct 31, 2019
trio Merge pull request #1399 from lewoudar/open-unix-socket-fix Feb 12, 2020
.coveragerc Make trio/_core/_run less magical and understandable for static code … Jun 23, 2019
.gitignore Update gitignore Dec 4, 2019
.readthedocs.yml docs: migrate to v2 Read the Docs format Oct 1, 2019
.style.yapf Bump yapf to 0.24, and re-run with new version Sep 28, 2018
.travis.yml Revert "Allow dev builds to fail" Feb 13, 2020
.yapfignore Make trio/_core/_run less magical and understandable for static code … Jun 23, 2019
CODE_OF_CONDUCT.md Add contributing doc, and switch to WeAllJS code of conduct Dec 5, 2017
CONTRIBUTING.md Add contributing doc, and switch to WeAllJS code of conduct Dec 5, 2017
LICENSE Consistently capitalize the word Trio May 16, 2019
LICENSE.APACHE2 towards some kind of project layout Jan 14, 2017
LICENSE.MIT towards some kind of project layout Jan 14, 2017
MANIFEST.in Include CONTRIBUTING.md in sdists Dec 5, 2017
README.rst Link to stable docs everywhere else too Aug 9, 2019
azure-pipelines.yml Run Azure CI on branches too Feb 6, 2020
check.sh Make trio/_core/_run less magical and understandable for static code … Jun 23, 2019
ci.sh ci: use bash <(curl ...) again (#1393) Feb 6, 2020
docs-requirements.in Require attrs >= 19.2.0 in more places Oct 17, 2019
docs-requirements.txt Bump docutils from 0.15.2 to 0.16 Feb 12, 2020
mypy.ini Initial Mypy configuration Sep 9, 2018
pyproject.toml Configure towncrier to print the text from "misc" entries Apr 9, 2018
setup.cfg tests: use faulthandler from pytest 5 core Jul 1, 2019
setup.py Only use install_requires to specify deps Feb 5, 2020
test-requirements.in Bump yapf from 0.28.0 to 0.29.0 Nov 29, 2019
test-requirements.txt Bump cffi from 1.13.2 to 1.14.0 Feb 10, 2020

README.rst

Join chatroom Join forum Documentation Latest PyPi version Latest conda-forge version Test coverage

Trio – a friendly Python library for async concurrency and I/O

The Trio project's goal is to produce a production-quality, permissively licensed, async/await-native I/O library for Python. Like all async libraries, its main purpose is to help you write programs that do multiple things at the same time with parallelized I/O. A web spider that wants to fetch lots of pages in parallel, a web server that needs to juggle lots of downloads and websocket connections at the same time, a process supervisor monitoring multiple subprocesses... that sort of thing. Compared to other libraries, Trio attempts to distinguish itself with an obsessive focus on usability and correctness. Concurrency is complicated; we try to make it easy to get things right.

Trio was built from the ground up to take advantage of the latest Python features, and draws inspiration from many sources, in particular Dave Beazley's Curio. The resulting design is radically simpler than older competitors like asyncio and Twisted, yet just as capable. Trio is the Python I/O library I always wanted; I find it makes building I/O-oriented programs easier, less error-prone, and just plain more fun. Perhaps you'll find the same.

This project is young and still somewhat experimental: the overall design is solid and the existing features are fully tested and documented, but you may encounter missing functionality or rough edges. We do encourage you to use it, but you should read and subscribe to issue #1 to get warning and a chance to give feedback about any compatibility-breaking changes.

Where to next?

I want to try it out! Awesome! We have a friendly tutorial to get you started; no prior experience with async coding is required.

Ugh, I don't want to read all that – show me some code! If you're impatient, then here's a simple concurrency example, an echo client, and an echo server.

How does Trio make programs easier to read and reason about than competing approaches? Trio is based on a new way of thinking that we call "structured concurrency". The best theoretical introduction is the article Notes on structured concurrency, or: Go statement considered harmful. Or, check out this talk at PyCon 2018 to see a demonstration of implementing the "Happy Eyeballs" algorithm in an older library versus Trio.

Cool, but will it work on my system? Probably! As long as you have some kind of Python 3.5-or-better (CPython or the latest PyPy3 are both fine), and are using Linux, macOS, or Windows, then Trio should absolutely work. *BSD and illumos likely work too, but we don't have testing infrastructure for them. And all of our dependencies are pure Python, except for CFFI on Windows, and that has wheels available, so installation should be easy.

I tried it but it's not working. Sorry to hear that! You can try asking for help in our chat room or forum, filing a bug, or posting a question on StackOverflow, and we'll do our best to help you out.

Trio is awesome and I want to help make it more awesome! You're the best! There's tons of work to do – filling in missing functionality, building up an ecosystem of Trio-using libraries, usability testing (e.g., maybe try teaching yourself or a friend to use Trio and make a list of every error message you hit and place where you got confused?), improving the docs, ... check out our guide for contributors!

I don't have any immediate plans to use it, but I love geeking out about I/O library design! That's a little weird? But let's be honest, you'll fit in great around here. We have a whole sub-forum for discussing structured concurrency (developers of other systems welcome!). Or check out our discussion of design choices, reading list, and issues tagged design-discussion.

I want to make sure my company's lawyers won't get angry at me! No worries, Trio is permissively licensed under your choice of MIT or Apache 2. See LICENSE for details.

Code of conduct

Contributors are requested to follow our code of conduct in all project spaces.

You can’t perform that action at this time.