A lightweight library for allowing async functions to be called in a synchronous manner.
import asyncio
from anysync import anysync
@anysync
async def f():
return 42
assert f().run() == 42
async def main():
assert await f() == 42
asyncio.run(main())
Just pip install anysync
and you're good to go!
For more information, please see the documentation.