Let the unspecified arguments of dict output of a callback function default to `dash.no_update` (or other user defined default)
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 24.4k
- Forks
- 2.3k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 13
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing how dict outputs from callback functions are validated and normalized. Compare the existing dash.no_update behavior with omitted keys and the proposed user-defined default, then add focused tests for partial returns and default handling. Done means unspecified outputs consistently receive the selected default without changing explicitly returned values.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend-api-design
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100