Skip to content

drawing

asyncify⚓︎

Wheel Version py_versions Ruff

TLDR: Sync 2 Async decorator

Install: pip install asyncify

Breaking change (v0.13.0): the asyncify module is no longer callable. Replace import asyncify; @asyncify with from asyncify import asyncify; @asyncify.

Usage:

from asyncify import asyncify
from asyncify import run  # asyncio.run polyfill for python36


def add(a, b):
    return a + b


assert add(1, 2) == 3


@asyncify
def add_async(a, b):
    return a + b


res = await add_async(1, 2)
assert res == 3