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

Add `condition` to `halt_after` / `halt_before`

Aperta
#436 11 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 4 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
55/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
python

Direzione di ricerca

Inizia individuando l’implementazione e i test per app.run, halt_after e halt_before. Traccia il modo in cui gli elenchi di azioni correnti attivano l’arresto, quindi definisci la copertura per le voci condizionali e incondizionate; il lavoro è completato quando l’arresto avviene solo se la condizione fornita è soddisfatta, mentre il comportamento esistente rimane invariato quando non viene fornita alcuna condizione.

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

Descrizione

area/core kind/feature priority/low

Is your feature request related to a problem? Please describe.
Currently, it is not possible to halt the app after a given action iff a condition is met. Here is a motivating example of when it might be needed:

Say you have a chatgpt-like app with various "chats", where each chat is a distinct burr app. When a user starts a new chat, you'd like to have a quick routing step that will detect, based on the first prompt, if the new chat is actually the continuation of a previous chat. If so, we want to halt the current app and restart the relevant app. If not, the app can continue its normal lifecycle.

Describe the solution you'd like
Instead of providing a list of actions to halt_after (or halt_before), provide a list of tuples (action, condition). The application will halt after a given action if and only if condition is met. If no condition is provided, the app will always halt after action is processed (current behavior).

Describe alternatives you've considered
Right now, the alternative is to have a dummy action to halt on and a conditional transition to it.

with_transitions(
    ("routing_action", "continue_action", when(continue=True)),
    ("routing_action, "halt_action", when(continue=False))
)

And then when calling app.run:

final_action, result, final_state = app.run(
            halt_after=["halt_action"],
            inputs={"prompt" : user_input}
        )

This is less clean than the suggested API.

Another possible way to address this would be to enable halting the application from within an action, although it may be harder to implement.

Lingua principale
Python
Stelle
2.6k
Fork
208
Merge medio
8g 9h
PR unite (30g)
26

Preparare l'ambiente

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 apache/burr

Tutte le issue di apache/burr

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.