txaio
Compatibility API between asyncio/Twisted/Trollius
What it is and what it does
txaio is an abstraction layer over async event loops, similar to how six bridges Python 2 and 3 differences. Instead of writing separate code paths for Twisted's Deferred and asyncio's Future, you write against txaio's unified API and choose at runtime which event loop to use. Your code runs natively on whichever framework you select—there is no event loop adapter or bridge, just a compatibility shim over the core abstractions like futures, callbacks, and errbacks.
The library is useful when you want to write a library or application that doesn't force a dependency choice on users. You provide helper functions like `create_future()`, `add_callbacks()`, `resolve()`, and `reject()` that map to the underlying framework's primitives. This means a single codebase can serve both Twisted and asyncio users without modification, though it does require you to adopt txaio's function-based style rather than direct object instantiation.
Use it for:
- Write a library that works with both Twisted and asyncio without maintaining two code paths.
- Build an application where users can choose their async framework at deployment time without code changes.
- Migrate from Twisted to asyncio (or vice versa) incrementally by using txaio as a compatibility bridge.
- Create async utilities and helpers that are framework-agnostic and reusable across projects.
- Test the same async logic against both event loops to ensure portability.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
txaio provides a compatibility layer that lets you write async code once and run it unmodified on either Twisted or asyncio, letting your users choose which event loop to use.
Yes. txaio is actively maintained, has no dependencies, installs easily, carries no security vulnerabilities, and solves a real problem for anyone writing async code that needs to support multiple event loop frameworks. Use it if you're building a library or application that should work with both Twisted and asyncio; skip it if you're committed to a single framework.
Install
txaio on PyPI
pip
pip install txaiouv
uv add txaiopoetry
poetry add txaioInstalling txaio
Before you install
Low friction—pure Python wheel with no runtime dependencies. Actively maintained with a recent release; last commit 2026-06-18.
License in practice
MIT license (permissive); you can use, modify, and distribute this package with minimal restrictions.
Quickstart
pip install txaio
import txaio
txaio.use_twisted() # or .use_asyncio()
f = txaio.create_future()
txaio.resolve(f, "value")
result = txaio.as_future(some_func, 1, 2)
Requires Python 3.11 or later; you must have either Twisted or asyncio available at runtime.
Verify before relying
- Whether Trollius support is still actively tested or documented given the description mentions it but the classifiers do not.
- Current test coverage across CPython 3.11+ and PyPy 3 versions listed in classifiers.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.11) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 57 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 6,822,988/month — #1,842 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: txaio-26.6.1-py3-none-any.whl
Keywords: asyncio, coroutine, trollius, twisted
Tags
More Libraries packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
python-dateutilProvides parsing, arithmetic, and recurrence…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
localstack-twistedA LocalStack-optimized distribution of Twisted…
permissive · top 15,000 on PyPI
asyncioThis package is an obsolete backport of…
permissive · top 1,000 on PyPI
TwistedTwisted is an event-driven networking framework…
permissive · top 5,000 on PyPI
pytest-twistedA pytest plugin that enables testing of…
permissive · top 15,000 on PyPI
unsyncDecorator-based library that runs async…
permissive · top 15,000 on PyPI
crochetCrochet lets you call Twisted asynchronous code…
permissive · top 15,000 on PyPI
treqtreq is a high-level HTTP client library for…
permissive · top 15,000 on PyPI
autobahnAutobahn provides WebSocket and WAMP (Web…
permissive · top 5,000 on PyPI
prometheus-asyncAdds async/await support to Prometheus metrics…
permissive · top 15,000 on PyPI