| 1 |
.. image:: https://img.shields.io/badge/chat-join%20now-blue.svg |
| 2 |
:target: https://gitter.im/python-trio/general |
| 3 |
:alt: Join chatroom |
| 4 |
|
| 5 |
.. image:: https://img.shields.io/badge/forum-join%20now-blue.svg |
| 6 |
:target: https://trio.discourse.group |
| 7 |
:alt: Join forum |
| 8 |
|
| 9 |
.. image:: https://img.shields.io/badge/docs-read%20now-blue.svg |
| 10 |
:target: https://trio.readthedocs.io |
| 11 |
:alt: Documentation |
| 12 |
|
| 13 |
.. image:: https://img.shields.io/pypi/v/trio.svg |
| 14 |
:target: https://pypi.org/project/trio |
| 15 |
:alt: Latest PyPi version |
| 16 |
|
| 17 |
.. image:: https://img.shields.io/conda/vn/conda-forge/trio.svg |
| 18 |
:target: https://anaconda.org/conda-forge/trio |
| 19 |
:alt: Latest conda-forge version |
| 20 |
|
| 21 |
.. image:: https://codecov.io/gh/python-trio/trio/branch/main/graph/badge.svg |
| 22 |
:target: https://codecov.io/gh/python-trio/trio |
| 23 |
:alt: Test coverage |
| 24 |
|
| 25 |
Trio – a friendly Python library for async concurrency and I/O |
| 26 |
============================================================== |
| 27 |
|
| 28 |
.. image:: https://raw.githubusercontent.com/python-trio/trio/9b0bec646a31e0d0f67b8b6ecc6939726faf3e17/logo/logo-with-background.svg |
| 29 |
:width: 200px |
| 30 |
:align: right |
| 31 |
|
| 32 |
The Trio project aims to produce a production-quality, |
| 33 |
`permissively licensed |
| 34 |
<https://github.com/python-trio/trio/blob/main/LICENSE>`__, |
| 35 |
async/await-native I/O library for Python. Like all async libraries, |
| 36 |
its main purpose is to help you write programs that do **multiple |
| 37 |
things at the same time** with **parallelized I/O**. A web spider that |
| 38 |
wants to fetch lots of pages in parallel, a web server that needs to |
| 39 |
juggle lots of downloads and websocket connections simultaneously, a |
| 40 |
process supervisor monitoring multiple subprocesses... that sort of |
| 41 |
thing. Compared to other libraries, Trio attempts to distinguish |
| 42 |
itself with an obsessive focus on **usability** and |
| 43 |
**correctness**. Concurrency is complicated; we try to make it *easy* |
| 44 |
to get things *right*. |
| 45 |
|
| 46 |
Trio was built from the ground up to take advantage of the `latest |
| 47 |
Python features <https://www.python.org/dev/peps/pep-0492/>`__, and |
| 48 |
draws inspiration from `many sources |
| 49 |
<https://github.com/python-trio/trio/wiki/Reading-list>`__, in |
| 50 |
particular Dave Beazley's `Curio <https://curio.readthedocs.io/>`__. |
| 51 |
The resulting design is radically simpler than older competitors like |
| 52 |
`asyncio <https://docs.python.org/3/library/asyncio.html>`__ and |
| 53 |
`Twisted <https://twistedmatrix.com/>`__, yet just as capable. Trio is |
| 54 |
the Python I/O library I always wanted; I find it makes building |
| 55 |
I/O-oriented programs easier, less error-prone, and just plain more |
| 56 |
fun. `Perhaps you'll find the same |
| 57 |
<https://github.com/python-trio/trio/wiki/Testimonials>`__. |
| 58 |
|
| 59 |
Trio is a mature and well-tested project: the overall design is solid, |
| 60 |
and the existing features are fully documented and widely used in |
| 61 |
production. While we occasionally make minor interface adjustments, |
| 62 |
breaking changes are rare. We encourage you to use Trio with confidence, |
| 63 |
but if you rely on long-term API stability, consider `subscribing to |
| 64 |
issue #1 <https://github.com/python-trio/trio/issues/1>`__ for advance |
| 65 |
notice of any compatibility updates. |
| 66 |
|
| 67 |
|
| 68 |
Where to next? |
| 69 |
-------------- |
| 70 |
|
| 71 |
**I want to try it out!** Awesome! We have a `friendly tutorial |
| 72 |
<https://trio.readthedocs.io/en/stable/tutorial.html>`__ to get you |
| 73 |
started; no prior experience with async coding is required. |
| 74 |
|
| 75 |
**Ugh, I don't want to read all that – show me some code!** If you're |
| 76 |
impatient, then here's a `simple concurrency example |
| 77 |
<https://trio.readthedocs.io/en/stable/tutorial.html#tutorial-example-tasks-intro>`__, |
| 78 |
an `echo client |
| 79 |
<https://trio.readthedocs.io/en/stable/tutorial.html#tutorial-echo-client-example>`__, |
| 80 |
and an `echo server |
| 81 |
<https://trio.readthedocs.io/en/stable/tutorial.html#tutorial-echo-server-example>`__. |
| 82 |
|
| 83 |
**How does Trio make programs easier to read and reason about than |
| 84 |
competing approaches?** Trio is based on a new way of thinking that we |
| 85 |
call "structured concurrency". The best theoretical introduction is |
| 86 |
the article `Notes on structured concurrency, or: Go statement |
| 87 |
considered harmful |
| 88 |
<https://vorpus.org/blog/notes-on-structured-concurrency-or-go-statement-considered-harmful/>`__. |
| 89 |
Or, `check out this talk at PyCon 2018 |
| 90 |
<https://www.youtube.com/watch?v=oLkfnc_UMcE>`__ to see a |
| 91 |
demonstration of implementing the "Happy Eyeballs" algorithm in an |
| 92 |
older library versus Trio. |
| 93 |
|
| 94 |
**Cool, but will it work on my system?** Probably! As long as you have |
| 95 |
some kind of Python 3.10-or-better (CPython or `currently maintained versions of |
| 96 |
PyPy3 <https://doc.pypy.org/en/latest/faq.html#which-python-versions-does-pypy-implement>`__ |
| 97 |
are both fine), and are using Linux, macOS, Windows, or FreeBSD, then Trio |
| 98 |
will work. Other environments might work too, but those |
| 99 |
are the ones we test on. And all of our dependencies are pure Python, |
| 100 |
except for CFFI on Windows, which has wheels available, so |
| 101 |
installation should be easy (no C compiler needed). |
| 102 |
|
| 103 |
**I tried it, but it's not working.** Sorry to hear that! You can try |
| 104 |
asking for help in our `chat room |
| 105 |
<https://gitter.im/python-trio/general>`__ or `forum |
| 106 |
<https://trio.discourse.group>`__, `filing a bug |
| 107 |
<https://github.com/python-trio/trio/issues/new>`__, or `posting a |
| 108 |
question on StackOverflow |
| 109 |
<https://stackoverflow.com/questions/ask?tags=python+python-trio>`__, |
| 110 |
and we'll do our best to help you out. |
| 111 |
|
| 112 |
**Trio is awesome, and I want to help make it more awesome!** You're |
| 113 |
the best! There's tons of work to do – filling in missing |
| 114 |
functionality, building up an ecosystem of Trio-using libraries, |
| 115 |
usability testing (e.g., maybe try teaching yourself or a friend to |
| 116 |
use Trio and make a list of every error message you hit and place |
| 117 |
where you got confused?), improving the docs, ... check out our `guide |
| 118 |
for contributors |
| 119 |
<https://trio.readthedocs.io/en/stable/contributing.html>`__! |
| 120 |
|
| 121 |
**I don't have any immediate plans to use it, but I love geeking out |
| 122 |
about I/O library design!** That's a little weird? But let's be |
| 123 |
honest, you'll fit in great around here. We have a `whole sub-forum |
| 124 |
for discussing structured concurrency |
| 125 |
<https://trio.discourse.group/c/structured-concurrency>`__ (developers |
| 126 |
of other systems welcome!). Or check out our `discussion of design |
| 127 |
choices |
| 128 |
<https://trio.readthedocs.io/en/stable/design.html#user-level-api-principles>`__, |
| 129 |
`reading list |
| 130 |
<https://github.com/python-trio/trio/wiki/Reading-list>`__, and |
| 131 |
`issues tagged design-discussion |
| 132 |
<https://github.com/python-trio/trio/labels/design%20discussion>`__. |
| 133 |
|
| 134 |
**I want to make sure my company's lawyers won't get angry at me!** No |
| 135 |
worries, Trio is permissively licensed under your choice of MIT or |
| 136 |
Apache 2. See `LICENSE |
| 137 |
<https://github.com/python-trio/trio/blob/main/LICENSE>`__ for details. |
| 138 |
|
| 139 |
|
| 140 |
Code of conduct |
| 141 |
--------------- |
| 142 |
|
| 143 |
Contributors are requested to follow our `code of conduct |
| 144 |
<https://trio.readthedocs.io/en/stable/code-of-conduct.html>`__ in all |
| 145 |
project spaces. |