• Stars
    star
    6,058
  • Rank 6,649 (Top 0.2 %)
  • Language
    Python
  • License
    Other
  • Created almost 8 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

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

image

The Trio project aims 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 simultaneously, 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 a 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.8-or-better (CPython or currently maintained versions of PyPy3 are both fine), and are using Linux, macOS, Windows, or FreeBSD, then Trio will work. Other environments might work too, but those are the ones we test on. And all of our dependencies are pure Python, except for CFFI on Windows, which has wheels available, so installation should be easy (no C compiler needed).

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.

More Repositories

1

trustme

#1 quality TLS certs while you wait, for the discerning tester
Python
501
star
2

purerpc

Native, async Python gRPC client and server implementation supporting asyncio, uvloop, and trio
Python
217
star
3

trio-asyncio

a re-implementation of the asyncio mainloop on top of Trio
Python
188
star
4

async_generator

Making it easy to write async iterators in Python 3.5
Python
94
star
5

sniffio

Sniff out which async library your code is running under
Python
90
star
6

unasync

The async transformation code.
Python
88
star
7

hip

A new Python HTTP client for everybody
Python
79
star
8

trio-websocket

WebSocket client and server implementation for Python Trio
Python
70
star
9

trimeter

(not ready yet) A simple but powerful job scheduler for Trio programs
Python
54
star
10

pytest-trio

Pytest plugin for trio
Python
53
star
11

triopg

PostgreSQL client for Trio based on asyncpg
Python
45
star
12

outcome

Capture the outcome of Python function calls
Python
32
star
13

exceptiongroup

Python
27
star
14

trio-typing

Type hints for Trio and related projects
Python
27
star
15

sphinxcontrib-trio

Make Sphinx better at documenting Python functions and methods
Python
26
star
16

cookiecutter-trio

Quickstart template for Trio projects
Python
25
star
17

trio-talks

Talks, slides, and other similar resources for Trio
Jupyter Notebook
22
star
18

snekomatic

The code behind @trio-bot
Python
21
star
19

flake8-async

Highly opinionated linter for Trio code
Python
17
star
20

trio-amqp

Asynchronous messaging for snake people
Python
10
star
21

asyncgpio

A small library to access GPIO pins the Trio way. Linux 4.9+ only.
Python
10
star
22

hypothesis-trio

Hypothesis plugin for trio
Python
8
star
23

trzmq

Trio + ZeroMQ - vowels = trzmq
Python
5
star
24

trio-monitor

Monitor utility for trio
Python
4
star
25

trio-owfs

Access 1wire buses (via owserver)
Python
3
star
26

ahip

You're probably looking for https://github.com/python-trio/hip
Python
2
star
27

python-trio.github.io

Trio website
1
star