Let the unspecified arguments of dict output of a callback function default to `dash.no_update` (or other user defined default)
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 24.4k
- Fork
- 2.3k
- Merge medio
- 2g 7h
- PR unite (30g)
- 13
Descrizione
If you use named arguments for the output a callback function, as in
@app.callback(
output=dict(x=Output(...), y=Output(...)),
inputs=dict(a=Input(...), b=Input(...)),
state=dict(c=State(...))
)
def callback(b, c, a):
return dict(x=a + b, y=b + c)
you have to specify all the arguments in the returning dict. But since named argument are useful especially when you have several output arguments, and if, like I experienced, you need to update only one or few arguments in the various return cases, it would be much more comfortable to return a dict specifying only those few arguments, instead of returning a long dict mostly made of dash.no_update.
I think the code would be shorter and clearer if the returning dict could default the unspecified named arguments to dash.no_update or some user defined value, like in defaultdict.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia tracciando come vengono validate e normalizzate le uscite dict delle callback functions. Confronta il comportamento esistente di dash.no_update con le chiavi omesse e con il default definito dall’utente proposto, quindi aggiungi test mirati per i ritorni parziali e la gestione del default. Il lavoro è completato quando le uscite non specificate ricevono coerentemente il default selezionato senza modificare i valori restituiti esplicitamente.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- backend-api-design
- Tipo di issue
- Funzionalità
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100