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

Task pre attribute is wrongly types

Open Beginner friendly
#1,065 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
70/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
python
Domain
cli

Research direction

The report centers on Task.pre and the @task decorator in invoke.tasks; start by locating their type declarations and reproduce the shown type-checking error. Update the relevant type information so the runtime pre value is represented accurately, then rerun the example and confirm the comparison-overlap error is gone.

Written by the indexing model from the issue text.

Description

from typing import cast, Any
from invoke.context import Context
from invoke.tasks import Task, task

@task()
def bar(context: Context) -> None:
    pass

@task(bar)
def foo(context: Context) -> None:
    pass

assert cast(Task[Any], foo).pre == (bar,)

The code works during runtime, but during type checking it fails with

x.py:17:8: error: Non-overlapping equality check (left operand type: "list[str] | str", right operand type: "tuple[Any]")  [comparison-overlap]
    assert cast(Task[Any], foo).pre == (bar,)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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.