Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

can I declare tasks as async ?

Open
#1,068 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Quiet
Tech stack
python
Domain
cli

Research direction

Start by tracing the executor.execute(*self.tasks) entry point named in the warning and how task callables are invoked. Determine whether async task functions are supported and how the Playwright example should be executed. Done means the example runs without the coroutine-was-never-awaited warning.

Written by the indexing model from the issue text.

Description

I am trying to use Playwright async APIs https://playwright.dev/python/docs/library
within a task.

This means (at least that's how I understand it), that I have to declare

@task()
async mytask (ctx):
     async with async_playwright() as p:
        browser = await p.chromium.launch()
        page = await browser.new_page()
        await page.goto("https://playwright.dev")
        print(await page.title())
        await browser.close()

but that does not seem to work, I get:

RuntimeWarning: coroutine 'mytask' was never awaited
executor.execute(*self.tasks)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback

is this possible, or do I need to switch to synchronous playwright APIs

Dominant language
Python
Stars
4.8k
Forks
412
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from pyinvoke/invoke

All issues in pyinvoke/invoke

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.