Skip to content

asyncio #758

Open
Open
@tony

Description

@tony

After adding sleep_after / sleep_before in #750 we need a way to sleep asynchronously

Example from this convo: pallets/click#85 (comment)

import asyncio
from functools import wraps

def coro(f):
    @wraps(f)
    def wrapper(*args, **kwargs):
        return asyncio.run(f(*args, **kwargs))

    return wrapper

Usage:

@click.command()
@coro
async def command():
    await asyncio.sleep(1)
    click.echo("Delayed hello")

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Todo

Relationships

None yet

Development

No branches or pull requests

Issue actions