Skip to main content

Convert python async function to a sync function for calling from a normal function in an existing event loop

Project description

a2s

Python async function to sync function, Convert python async function to a sync function for calling from a normal function in an existing event loop

Usage

import asyncio
from a2s import sync


@sync
async def an_async_func():
    print("Hello World")


def a_sync_func():
    an_async_func()
    pass


async def main():
    a_sync_func()
    pass


if __name__ == '__main__':
    asyncio.run(main())

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

a2s-1.0.1.tar.gz (2.3 kB view hashes)

Uploaded Source

Built Distribution

a2s-1.0.1-py3-none-any.whl (2.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page