--- id: txaio version: "26.6.1" license: MIT license_treatment: permissive maintenance: active --- # txaio — Compatibility API between asyncio/Twisted/Trollius License: permissive · Maintenance: active · Downloads: 6.8M/mo ## 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 above — 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 pip install txaio uv add txaio poetry add txaio ## Installing 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_current - Install friction: low - Maintenance: active - Downloads: 6.8M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags twisted asyncio compatibility, write once run on both event loops, asyncio twisted abstraction, event loop agnostic code, source code compatibility twisted asyncio, deferred future wrapper, cross-framework async, async-abstraction, event-loop-agnostic, twisted-asyncio [View on SkillFed](https://skillfed.io/packages/txaio) · [View on PyPI](https://pypi.org/project/txaio/)