{"id":15009010,"url":"https://github.com/crossbario/txaio","last_synced_at":"2025-10-08T18:33:08.443Z","repository":{"id":28858577,"uuid":"32382669","full_name":"crossbario/txaio","owner":"crossbario","description":"Utilities to support code that runs unmodified on Twisted and asyncio","archived":false,"fork":false,"pushed_at":"2024-01-28T05:03:39.000Z","size":428,"stargazers_count":56,"open_issues_count":17,"forks_count":30,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-03-28T18:13:32.913Z","etag":null,"topics":["asyncio","python-2","python-3","source-compatibility","twisted"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/crossbario.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-03-17T09:10:13.000Z","updated_at":"2024-11-28T16:30:48.000Z","dependencies_parsed_at":"2024-01-13T04:19:42.007Z","dependency_job_id":"b3e61057-2ce5-493e-997f-e0d1e6a95202","html_url":"https://github.com/crossbario/txaio","commit_stats":{"total_commits":317,"total_committers":16,"mean_commits":19.8125,"dds":0.501577287066246,"last_synced_commit":"50a111a95b19168127681429bebd3827e1e2f6e5"},"previous_names":[],"tags_count":37,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crossbario%2Ftxaio","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crossbario%2Ftxaio/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crossbario%2Ftxaio/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crossbario%2Ftxaio/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/crossbario","download_url":"https://codeload.github.com/crossbario/txaio/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247234923,"owners_count":20905854,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asyncio","python-2","python-3","source-compatibility","twisted"],"created_at":"2024-09-24T19:22:24.918Z","updated_at":"2025-10-08T18:33:03.386Z","avatar_url":"https://github.com/crossbario.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"txaio\n=====\n\n| |Version| |Build| |Deploy| |Coverage| |Docs|\n\n--------------\n\n**txaio** is a helper library for writing code that runs unmodified on\nboth `Twisted \u003chttps://twistedmatrix.com/\u003e`_ and `asyncio \u003chttps://docs.python.org/3/library/asyncio.html\u003e`_ / `Trollius \u003chttp://trollius.readthedocs.org/en/latest/index.html\u003e`_.\n\nThis is like `six \u003chttp://pythonhosted.org/six/\u003e`_, but for wrapping\nover differences between Twisted and asyncio so one can write code\nthat runs unmodified on both (aka *source code compatibility*). In\nother words: your *users* can choose if they want asyncio **or** Twisted\nas a dependency.\n\nNote that, with this approach, user code **runs under the native event\nloop of either Twisted or asyncio**. This is different from attaching\neither one's event loop to the other using some event loop adapter.\n\n\nPlatform support\n----------------\n\n**txaio** runs on CPython 3.6+ and PyPy 3, on top of *Twisted* or *asyncio*. Specifically, **txaio** is tested on the following platforms:\n\n* CPython 3.6 and 3.9 on Twisted 18.7, 19.10, trunk and on asyncio (stdlib)\n* PyPy 3.6 an 3.7 on Twisted 18.7, 19.10, trunk and on asyncio (stdlib)\n\n\u003e Note: txaio up to version 18.8.1 also supported Python 2.7 and Python 3.4. Beginning with release v20.1.1, txaio only supports Python 3.5+. Beginning with release v20.12.1, txaio only supports Python 3.6+.\n\n\nHow it works\n------------\n\nInstead of directly importing, instantiating and using ``Deferred``\n(for Twisted) or ``Future`` (for asyncio) objects, **txaio** provides\nhelper-functions to do that for you, as well as associated things like\nadding callbacks or errbacks.\n\nThis obviously changes the style of your code, but then you can choose\nat runtime (or import time) which underlying event-loop to use. This\nmeans you can write **one** code-base that can run on Twisted *or*\nasyncio (without a Twisted dependency) as you or your users see fit.\n\nCode like the following can then run on *either* system:\n\n.. sourcecode:: python\n\n    import txaio\n    txaio.use_twisted()  # or .use_asyncio()\n\n    f0 = txaio.create_future()\n    f1 = txaio.as_future(some_func, 1, 2, key='word')\n    txaio.add_callbacks(f0, callback, errback)\n    txaio.add_callbacks(f1, callback, errback)\n    # ...\n    txaio.resolve(f0, \"value\")\n    txaio.reject(f1, RuntimeError(\"it failed\"))\n\nPlease refer to the `documentation \u003chttps://txaio.readthedocs.io/en/latest/\u003e`_ for description and usage of the library features.\n\n\n.. |Version| image:: https://img.shields.io/pypi/v/txaio.svg\n   :target: https://pypi.python.org/pypi/txaio\n   :alt: Version\n\n.. |Build| image:: https://github.com/crossbario/txaio/workflows/main/badge.svg\n   :target: https://github.com/crossbario/txaio/actions?query=workflow%3Amain\n   :alt: Build Workflow\n\n.. |Deploy| image:: https://github.com/crossbario/txaio/workflows/deploy/badge.svg\n   :target: https://github.com/crossbario/txaio/actions?query=workflow%3Adeploy\n   :alt: Deploy Workflow\n\n.. |Coverage| image:: https://codecov.io/github/crossbario/txaio/coverage.svg?branch=master\n   :target: https://codecov.io/github/crossbario/txaio\n   :alt: Coverage\n\n.. |Docs| image:: https://readthedocs.org/projects/txaio/badge/?version=latest\n   :target: https://txaio.readthedocs.io/en/latest/\n   :alt: Docs\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrossbario%2Ftxaio","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcrossbario%2Ftxaio","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrossbario%2Ftxaio/lists"}