Description
.. image:: https://img.shields.io/badge/chat-join%20now-blue.svg :target: https://gitter.im/python-trio/general :alt: Join chatroom .. image:: https://img.shields.io/badge/forum-join%20now-blue.svg :target: https://trio.discourse.group :alt: Join forum .. image:: https://img.shields.io/badge/docs-read%20now-blue.svg :target: https://trio.readthedocs.io :alt: Documentation .. image:: https://img.shields.io/pypi/v/trio.svg :target: https://pypi.org/project/trio :alt: Latest PyPi version .. image:: https://img.shields.io/conda/vn/conda-forge/trio.svg :target: https://anaconda.org/conda-forge/trio :alt: Latest conda-forge version .. image:: https://codecov.io/gh/python-trio/trio/branch/main/graph/badge.svg :target: https://codecov.io/gh/python-trio/trio :alt: Test coverage Trio – a friendly Python library for async concurrency and I/O ============================================================== .. image:: https://raw.githubusercontent.com/python-trio/trio/9b0bec646a31e0d0f67b8b6ecc6939726faf3e17/logo/logo-with-background.svg :width: 200px :align: right The Trio project aims to produce a production-quality, `permissively licensed <https://github.com/python-trio/trio/blob/main/LICENSE>`__, 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 <https://www.python.org/dev/peps/pep-0492/>`__, and draws inspiration from `many sources <https://github.com/python-trio/trio/wiki/Reading-list>`__, in particular Dave Beazley's `Curio <https://curio.readthedocs.io/>`__. The resulting design is radically simpler than older competitors like `asyncio <https://docs.python.org/3/library/asyncio.html>`__ and `Twisted <https://twistedmatrix.com/>`__, 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 <https://github.com/python-trio/trio/wiki/Testimonials>`__. 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 <https://github.com/python-trio/trio/issues/1>`__ for advance notice of any compatibility updates. Where to next? -------------- **I want to try it out!** Awesome! We have a `friendly tutorial <https://trio.readthedocs.io/en/stable/tutorial.html>`__ 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 <https://trio.readthedocs.io/en/stable/tutorial.html#tutorial-example-tasks-intro>`__, an `echo client <https://trio.readthedocs.io/en/stable/tutorial.html#tutorial-echo-client-example>`__, and an `echo server <https://trio.readthedocs.io/en/stable/tutorial.html#tutorial-echo-server-example>`__. **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 <https://vorpus.org/blog/notes-on-structured-concurrency-or-go-statement-considered-harmful/>`__. Or, `check out this talk at PyCon 2018 <https://www.youtube.com/watch?v=oLkfnc_UMcE>`__ 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.10-or-better (CPython or `currently maintained versions of PyPy3 <https://doc.pypy.org/en/latest/faq.html#which-python-versions-does-pypy-implement>`__ 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 <https://gitter.im/python-trio/general>`_
Release History
| Version | Changes | Urgency | Date |
|---|---|---|---|
| 0.33.0 | Imported from PyPI (0.33.0) | Low | 4/21/2026 |
| v0.33.0 | **Full Changelog**: https://github.com/python-trio/trio/compare/v0.32.0...v0.33.0 Bugfixes --- - Start supporting Android's new ``"android"`` `sys.platform`. (https://github.com/python-trio/trio/issues/3357) Deprecations and removals --- - Both `trio.testing.RaisesGroup` and `trio.testing.Matcher` have been deprecated. Pytest alternatives ``pytest.RaisesGroup`` and ``pytest.RaisesExc`` (respectively) are considered correct replacement. (https://github.com/python-trio/trio/issues/ | Low | 2/14/2026 |
| v0.32.0 | **Full Changelog**: https://github.com/python-trio/trio/compare/v0.31.0...v0.32.0 Features --- - Allow `trio.CapacityLimiter` to have zero total_tokens. (https://github.com/python-trio/trio/issues/3321) Bugfixes --- - Fixed a bug where iterating over an ``@as_safe_channel``-derived ``ReceiveChannel`` would raise `trio.BrokenResourceError` if the channel was closed by another task. It now shuts down cleanly. (https://github.com/python-trio/trio/issues/3331) - `trio.lowlevel.Task. | Low | 10/31/2025 |
| v0.31.0 | **Full Changelog**: https://github.com/python-trio/trio/compare/v0.30.0...v0.31.0 Features --- - `Cancelled` strings can now display the source and reason for a cancellation. Trio-internal sources of cancellation will set this string, and `CancelScope.cancel` now has a ``reason`` string parameter that can be used to attach info to any `Cancelled` to help in debugging. (https://github.com/python-trio/trio/issues/3232) Bugfixes --- - Make ctrl+c work in more situations in the Trio | Low | 9/9/2025 |
| v0.30.0 | **Full Changelog**: https://github.com/python-trio/trio/compare/v0.29.0...v0.30.0 Features --- - Add `@trio.as_safe_channel`, a wrapper that can be used to make async generators safe. This will be the suggested fix for the flake8-async lint rule `ASYNC900`. (https://github.com/python-trio/trio/issues/3197) Bugfixes --- - Allow `trio` to be a `types.ModuleType` and still have deprecated attributes. (https://github.com/python-trio/trio/issues/2135) - Fixed socket module for som | Low | 4/21/2025 |
| v0.29.0 | **Full Changelog**: https://github.com/python-trio/trio/compare/v0.28.0...v0.29.0 Features --- - Add `trio.lowlevel.in_trio_run` and `trio.lowlevel.in_trio_task` and document the semantics (and differences) thereof. (https://github.com/python-trio/trio/issues/2757) - If `trio.testing.RaisesGroup` does not get the expected exceptions it now raises an `AssertionError` with a helpful message, instead of letting the raised exception/group fall through. The raised exception is available in th | Low | 2/14/2025 |
| v0.28.0 | **Full Changelog**: https://github.com/python-trio/trio/compare/v0.27.0...v0.28.0 Bugfixes --- - :func:`inspect.iscoroutinefunction` and the like now give correct answers when called on KI-protected functions. (https://github.com/python-trio/trio/issues/2670) - Rework KeyboardInterrupt protection to track code objects, rather than frames, as protected or not. The new implementation no longer needs to access `frame.f_locals` dictionaries, so it won't artificially extend the lif | Low | 12/25/2024 |
| v0.27.0 | **Full Changelog**: https://github.com/python-trio/trio/compare/v0.26.2...v0.27.0 Breaking changes --- - `trio.move_on_after` and `trio.fail_after` previously set the deadline relative to initialization time, instead of more intuitively upon entering the context manager. This might change timeouts if a program relied on this behavior. If you want to restore previous behavior you should instead use ``trio.move_on_at(trio.current_time() + ...)``. flake8-async has a new rule to catch this | Low | 10/16/2024 |
| v0.26.2 | **Full Changelog**: https://github.com/python-trio/trio/compare/v0.26.1...v0.26.2 Bugfixes --- - Remove remaining ``hash`` usage and fix test configuration issue that prevented it from being caught. (https://github.com/python-trio/trio/issues/3053) | Low | 8/8/2024 |
| v0.26.1 | **Full Changelog**: https://github.com/python-trio/trio/compare/v0.26.0...v0.26.1 Bugfixes --- - Switched ``attrs`` usage off of ``hash``, which is now deprecated. (https://github.com/python-trio/trio/issues/3053) Miscellaneous internal changes --- - Use PyPI's Trusted Publishers to make releases. (https://github.com/python-trio/trio/issues/2980) | Low | 8/5/2024 |
| v0.26.0 | **Full Changelog**: https://github.com/python-trio/trio/compare/v0.25.1...v0.26.0 Features --- - Added an interactive interpreter ``python -m trio``. This makes it easier to try things and experiment with trio in the a Python repl. Use the ``await`` keyword without needing to call ``trio.run()`` ```sh $ python -m trio Trio 0.26.0, Python 3.10.6 Use "await" directly instead of "trio.run()". Type "help", "copyright", "credits" or "license" for more information. >>> import tr | Low | 7/5/2024 |
| v0.25.1 | **Full Changelog**: https://github.com/python-trio/trio/compare/v0.25.0...v0.25.1 Bugfixes --- - Fix crash when importing trio in embedded Python on Windows, and other installs that remove docstrings. (https://github.com/python-trio/trio/issues/2987) | Low | 5/16/2024 |
| v0.25.0 | **Full Changelog**: https://github.com/python-trio/trio/compare/v0.24.0...v0.25.0 Breaking changes --- - The `strict_exception_groups` parameter now defaults to `True` in `trio.run` and `trio.lowlevel.start_guest_run`. `trio.open_nursery` still defaults to the same value as was specified in `trio.run`/`trio.lowlevel.start_guest_run`, but if you didn't specify it there then all subsequent calls to `trio.open_nursery` will change. This is unfortunately very tricky to change with a deprec | Low | 3/17/2024 |
| v0.24.0 | **Full Changelog**: https://github.com/python-trio/trio/compare/v0.23.2...v0.24.0 Features --- - New helper classes: `testing.RaisesGroup` and `testing.Matcher`. In preparation for changing the default of ``strict_exception_groups`` to `True`, we're introducing a set of helper classes that can be used in place of `pytest.raises` in tests, to check for an expected `ExceptionGroup`. These are provisional, and only planned to be supplied until there's a good solution in ``pytest``. S | Low | 1/10/2024 |
| v0.23.2 | **Full Changelog**: https://github.com/python-trio/trio/compare/v0.23.1...v0.23.2 Features --- - [TypeVarTuple](https://docs.python.org/3.12/library/typing.html#typing.TypeVarTuple) is now used to fully type `nursery.start_soon()`, `trio.run()`, `trio.to_thread.run_sync()`, and other similar functions accepting `(func, *args)`. This means type checkers will be able to verify types are used correctly. `nursery.start()` is not fully typed yet however. (https://github.com/python-trio/trio/is | Low | 12/14/2023 |
| v0.23.1 | **Full Changelog**: https://github.com/python-trio/trio/compare/v0.23.0...v0.23.1 Bugfixes --- - Don't crash on import in Anaconda interpreters. (<https://github.com/python-trio/trio/issues/2855>) | Low | 11/4/2023 |
| v0.23.0 | **Full Changelog**: https://github.com/python-trio/trio/compare/v0.22.2...v0.23.0 Headline features --- - Add type hints. (<https://github.com/python-trio/trio/issues/543>) Features --- - When exiting a nursery block, the parent task always waits for child tasks to exit. This wait cannot be cancelled. However, previously, if you tried to cancel it, it *would* inject a `Cancelled` exception, even though it wasn't cancelled. Most users probably never noticed either way, but injecti | Low | 11/3/2023 |
| v0.22.2 | **Full Changelog**: https://github.com/python-trio/trio/compare/v0.22.1...v0.22.2 Bugfixes --- - Fix ``PermissionError`` when importing `trio` due to trying to access ``pthread``. (https://github.com/python-trio/trio/issues/2688) | Low | 7/12/2023 |
