trio-asyncio


Nametrio-asyncio JSON
Version 0.15.0 PyPI version JSON
download
home_pagehttps://github.com/python-trio/trio-asyncio
SummaryA re-implementation of the asyncio mainloop on top of Trio
upload_time2024-04-24 22:23:59
maintainerNone
docs_urlNone
authorMatthias Urlichs
requires_python>=3.8
licenseMIT -or- Apache License 2.0
keywords async io trio asyncio trio-asyncio
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            ``trio-asyncio`` is a re-implementation of the ``asyncio`` mainloop on top of
Trio.

Rationale
=========

There are quite a few asyncio-compatible libraries.

On the other hand, Trio has native concepts of tasks and task cancellation.
Asyncio, on the other hand, is based on chaining Future objects, albeit
with nicer syntax.

Thus, being able to use asyncio libraries from Trio is useful.

Principle of operation
======================

The core of the "normal" asyncio main loop is the repeated execution of
synchronous code that's submitted to ``call_soon`` or
``add_reader``/``add_writer``.

Everything else within ``asyncio``, i.e. Futures and ``async``/``await``,
is just syntactic sugar. There is no concept of a task; while a Future can
be cancelled, that in itself doesn't affect the code responsible for
fulfilling it.

On the other hand, trio has genuine tasks with no separation between
returning a value asynchronously, and the code responsible for providing
that value.

``trio_asyncio`` implements a task which runs (its own version of) the
asyncio main loop. It also contains shim code which translates between these
concepts as transparently and correctly as possible, and it supplants a few
of the standard loop's key functions.

This works rather well: ``trio_asyncio`` consists of just ~700 lines of
code (asyncio: ~8000) but passes the complete Python 3.6 test suite with no
errors.

``trio_asyncio`` requires Python 3.8 or later.

Author
======

Matthias Urlichs <matthias@urlichs.de>


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/python-trio/trio-asyncio",
    "name": "trio-asyncio",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "async, io, trio, asyncio, trio-asyncio",
    "author": "Matthias Urlichs",
    "author_email": "matthias@urlichs.de",
    "download_url": "https://files.pythonhosted.org/packages/b2/29/f1b5dd48796526dc00849d2f6ca276724930aa2f96c32bca9bed01802c3b/trio_asyncio-0.15.0.tar.gz",
    "platform": null,
    "description": "``trio-asyncio`` is a re-implementation of the ``asyncio`` mainloop on top of\nTrio.\n\nRationale\n=========\n\nThere are quite a few asyncio-compatible libraries.\n\nOn the other hand, Trio has native concepts of tasks and task cancellation.\nAsyncio, on the other hand, is based on chaining Future objects, albeit\nwith nicer syntax.\n\nThus, being able to use asyncio libraries from Trio is useful.\n\nPrinciple of operation\n======================\n\nThe core of the \"normal\" asyncio main loop is the repeated execution of\nsynchronous code that's submitted to ``call_soon`` or\n``add_reader``/``add_writer``.\n\nEverything else within ``asyncio``, i.e. Futures and ``async``/``await``,\nis just syntactic sugar. There is no concept of a task; while a Future can\nbe cancelled, that in itself doesn't affect the code responsible for\nfulfilling it.\n\nOn the other hand, trio has genuine tasks with no separation between\nreturning a value asynchronously, and the code responsible for providing\nthat value.\n\n``trio_asyncio`` implements a task which runs (its own version of) the\nasyncio main loop. It also contains shim code which translates between these\nconcepts as transparently and correctly as possible, and it supplants a few\nof the standard loop's key functions.\n\nThis works rather well: ``trio_asyncio`` consists of just ~700 lines of\ncode (asyncio: ~8000) but passes the complete Python 3.6 test suite with no\nerrors.\n\n``trio_asyncio`` requires Python 3.8 or later.\n\nAuthor\n======\n\nMatthias Urlichs <matthias@urlichs.de>\n\n",
    "bugtrack_url": null,
    "license": "MIT -or- Apache License 2.0",
    "summary": "A re-implementation of the asyncio mainloop on top of Trio",
    "version": "0.15.0",
    "project_urls": {
        "Homepage": "https://github.com/python-trio/trio-asyncio"
    },
    "split_keywords": [
        "async",
        " io",
        " trio",
        " asyncio",
        " trio-asyncio"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2b3fa529b02ae6a4145721eaf952cdf19f2627bd4f5e248b010f77c0064eb4f6",
                "md5": "1378eb4cbd6778022ad11cd0782c3054",
                "sha256": "7dad5a5edcc7c90c5b80b777dcaef11c22668ce7ddc374633068c2b35d683d62"
            },
            "downloads": -1,
            "filename": "trio_asyncio-0.15.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1378eb4cbd6778022ad11cd0782c3054",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 39786,
            "upload_time": "2024-04-24T22:23:57",
            "upload_time_iso_8601": "2024-04-24T22:23:57.699339Z",
            "url": "https://files.pythonhosted.org/packages/2b/3f/a529b02ae6a4145721eaf952cdf19f2627bd4f5e248b010f77c0064eb4f6/trio_asyncio-0.15.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b229f1b5dd48796526dc00849d2f6ca276724930aa2f96c32bca9bed01802c3b",
                "md5": "5b7d3de715f3d7216e533b7ab353b307",
                "sha256": "061e31a71fb039d5074f064ec868dc0e6759e6cca33bf3080733a20ee9667781"
            },
            "downloads": -1,
            "filename": "trio_asyncio-0.15.0.tar.gz",
            "has_sig": false,
            "md5_digest": "5b7d3de715f3d7216e533b7ab353b307",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 75674,
            "upload_time": "2024-04-24T22:23:59",
            "upload_time_iso_8601": "2024-04-24T22:23:59.290114Z",
            "url": "https://files.pythonhosted.org/packages/b2/29/f1b5dd48796526dc00849d2f6ca276724930aa2f96c32bca9bed01802c3b/trio_asyncio-0.15.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-24 22:23:59",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "python-trio",
    "github_project": "trio-asyncio",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "tox": true,
    "lcname": "trio-asyncio"
}
        
Elapsed time: 0.23653s