Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Repeated post tasks aren't correctly ordered

Aperta
#1,006 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
python
Ambito
cli, tooling

Direzione di ricerca

Start by reproducing the issue with the Python task definitions in the report and inspect Invoke's task execution and pre/post-task ordering logic. Done means the shared post task runs only once, after the last task that declares it, producing the expected output.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Description

When I set a post task on multiple tasks Invoke correctly only executes it once. But it is executed after the first task that has it as a post task, instead of waiting until the last task is done which has the task as post task.

Code

import invoke


@invoke.task
def post_task(_: invoke.Context) -> None:
    print('The last task')


@invoke.task(post=[post_task])
def pre_task_1(_: invoke.Context) -> None:
    print('The first pre task')


@invoke.task(post=[post_task])
def pre_task_2(_: invoke.Context) -> None:
    print('The second pre task')


@invoke.task(default=True, pre=[pre_task_1, pre_task_2], post=[post_task])
def main(ctx: invoke.Context) -> None:
    print('The main task')

Expected output

The first pre task
The second pre task
The main task
The last task

Output result

The first pre task
The last task
The second pre task
The main task

Additional information

  • Invoke 2.2.0
  • Python 3.11.6
Lingua principale
Python
Stelle
4.8k
Fork
414
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di pyinvoke/invoke

Tutte le issue di pyinvoke/invoke

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.