-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multi output callbacks support. #436
Conversation
ffc6443
to
eb8e1c5
Compare
hello, |
@sdementen This is a standalone update. You can try it right now with:
|
@rmarren1 Please review. |
This allows you to define multiple callbacks to the same output. For example, adding
to the example you give above results in a race condition (sometimes Output 1 is 'something else', sometimes it is the number of clicks). I think this just needs logic changed in the condition throwing |
I think we should eventually allow multiple callbacks to be defined for an output component on the condition that those input sets are disjoint (e.g. |
This discussion might belong in #475, but I'm skeptical of both the idea of multiple callbacks and the disjoint exception. I guess you're imagining cases where one set of inputs disappears and another appears? But you could still have some other global setting that factors in to the final output... so seems to me the cleaner way to handle it is to make the output depend on all of the inputs, but the conditionally-available ones are wildcarded somehow - eg @chriddyp's #475 (comment) |
dash/dash.py
Outdated
@@ -320,6 +321,7 @@ def serve_layout(self): | |||
|
|||
def _config(self): | |||
config = { | |||
'multi_output': True, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the idea to make this configurable by the user?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or is this for backward compatibility?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's for backward compatibility.
d87013b
to
98d34e9
Compare
I added validation for multi output and changed |
I think there will be an issue encoding the IDs of multi-output callbacks as an ASCII-delimited string, since there will be a backwards compatibility issue with apps that use the ASCII characters we choose as delimiters. One idea: We already blacklisted Another idea is to use a different key for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent work @T4rk1n, this is going to make a lot of people happy 🎉 💃
I'll leave it up to you how to manage the renderer-dash dependency tango as these two PRs are merged 😅
for some reason pylint complains about things differently on AJs machine?
@@ -28,7 +28,7 @@ jobs: | |||
sudo pip install virtualenv | |||
virtualenv venv | |||
. venv/bin/activate | |||
pip install -r $REQUIREMENTS_FILE | |||
pip install -r $REQUIREMENTS_FILE --force-reinstall |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@T4rk1n I've already merged this but... was --force-reinstall
just for debugging or do we need it going forward if we're using git branches in requirements files?
Tests and tweak for Interval component
Release candidates
Add multi output callbacks support.
Output
as output in callbacks.Usage example:
Needs plotly/dash-renderer#91
Tests will fails until I release a rc version of dash-renderer, this is kind of breaking changes as no apps will run if they don't have the right version of dash-renderer (The json payload changed).
Todos: