Named callback arguments could default to `no_update` if not provided
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 24.4k
- Forks
- 2.3k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 13
Description
Apologies if this is a duplicate, I tried a search and didn't see anything.
Is your feature request related to a problem? Please describe.
Imagine a callback with many outputs, using named keyword arguments.
@app.callback(
output=dict(out_1=..., out_2=..., out_3=..., error_div=...),
input=...
)
def my_callback(...):
# I have to return a dict with _all_ outputs defined even if several are no_update
# e.g., I have an error and I only want to report the error to the user
return dict(out_1=no_update, out_2=no_update, out_3=no_update, error_div=...)
Describe the solution you'd like
It would be nice if, instead, if a key is not present it is assumed to be no_update by default, e.g. in the above example we could just return:
return dict(error_div=...)
Currently, this would raise a schema error.
Describe alternatives you've considered
N/A
Additional context
N/A
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 at the callback output handling and the schema validation that currently rejects dictionaries missing declared output keys. Define the behavior so omitted named outputs are treated as no_update, then verify that returning only error_div works while invalid or unexpected keys still produce the appropriate schema error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend-api-design
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100