This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author douglas-raillard-arm
Recipients Rokas K. (rku), crusaderky, davidbrochart, djarb, douglas-raillard-arm, jab, jcea, martin.panter, njs, pmpp, yselivanov, zzzeek
Date 2021-08-19.14:22:25
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1629382945.61.0.221154406309.issue22239@roundup.psfhosted.org>
In-reply-to
Content
Drive by comment: I landed on this thread for the exact same reason:
> This situation is very frequent when e.g. a library is designed to be async-first, and also provides a blocking API which just wraps the async code by running it until complete.

The library in question is "devlib", which abstracts over SSH/adb/local shell. We cannot make a "full" switch to async as it would be a big breaking change. To workaround that, I came up with a decorator that wraps a corountine, and "replaces" it such that:

    @asyncf
    async def f(...):
        ...

    # Blocking call under its "normal" name, for backward compat
    f()

    # Used in an async environment
    await f.asyn()

This allows converting bit by bit the whole library, with full backward compatibility for both users and internal calls.

On top of that, that library is heavily used in jupyter notebooks, so all in all, nest-asyncio is impossible to avoid.
History
Date User Action Args
2021-08-19 14:22:25douglas-raillard-armsetrecipients: + douglas-raillard-arm, jcea, djarb, zzzeek, njs, jab, pmpp, martin.panter, yselivanov, Rokas K. (rku), crusaderky, davidbrochart
2021-08-19 14:22:25douglas-raillard-armsetmessageid: <1629382945.61.0.221154406309.issue22239@roundup.psfhosted.org>
2021-08-19 14:22:25douglas-raillard-armlinkissue22239 messages
2021-08-19 14:22:25douglas-raillard-armcreate