Skip to main content

A friendly Python library for async concurrency and I/O

Project description

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

https://raw.githubusercontent.com/python-trio/trio/9b0bec646a31e0d0f67b8b6ecc6939726faf3e17/logo/logo-with-background.svg

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.

Trio is a mature and well-tested project: the overall design is solid, and the existing features are fully documented and widely used in production. While we occasionally make minor interface adjustments, breaking changes are rare. We encourage you to use Trio with confidence, but if you rely on long-term API stability, consider subscribing to issue #1 for advance notice of any compatibility updates.

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.9-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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

trio-0.30.0.tar.gz (593.8 kB view details)

Uploaded Source

Built Distribution

trio-0.30.0-py3-none-any.whl (499.2 kB view details)

Uploaded Python 3

File details

Details for the file trio-0.30.0.tar.gz.

File metadata

  • Download URL: trio-0.30.0.tar.gz
  • Upload date:
  • Size: 593.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for trio-0.30.0.tar.gz
Algorithm Hash digest
SHA256 0781c857c0c81f8f51e0089929a26b5bb63d57f927728a5586f7e36171f064df
MD5 533d80e111a7edb6fab6fd2f81112dfb
BLAKE2b-256 01c168d582b4d3a1c1f8118e18042464bb12a7c1b75d64d75111b297687041e3

See more details on using hashes here.

Provenance

The following attestation bundles were made for trio-0.30.0.tar.gz:

Publisher: release.yml on python-trio/trio

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file trio-0.30.0-py3-none-any.whl.

File metadata

  • Download URL: trio-0.30.0-py3-none-any.whl
  • Upload date:
  • Size: 499.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for trio-0.30.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3bf4f06b8decf8d3cf00af85f40a89824669e2d033bb32469d34840edcfc22a5
MD5 f349e4816de33d0bf58e62ff3c2afc69
BLAKE2b-256 698e3f6dfda475ecd940e786defe6df6c500734e686c9cd0a0f8ef6821e9b2f2

See more details on using hashes here.

Provenance

The following attestation bundles were made for trio-0.30.0-py3-none-any.whl:

Publisher: release.yml on python-trio/trio

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page