Skip to main content

Transform your python code to use async/await (PEP 492)

Project description

PyPI python versions license


Transform your python code from old syntax with yield from to use async/await (PEP 492).


$ pip install yield2await
$ yield2await <path> [-i <ignore-path>]


def handler(request):
    session = yield from get_session(request)
    session['last_visit'] = time.time()
    with (yield from self.dbengine) as conn:
        ret = yield from conn.execute(query)
        user = yield from ret.fetchone()
    return web.Response(body=b'OK')


async def handler(request):
    session = await get_session(request)
    session['last_visit'] = time.time()
    async with self.dbengine as conn:
        ret = await conn.execute(query)
        user = await ret.fetchone()
    return web.Response(body=b'OK')


Feel free to contribute. Just do RP.


This is a very alpha, check the changes manually before commit.

Project details

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
yield2await-0.0.1-py3-none-any.whl (4.5 kB) Copy SHA256 hash SHA256 Wheel py3

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page