-
-
Notifications
You must be signed in to change notification settings - Fork 41
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
Assert and validate Dash component functionality #3
Comments
I don't fully understand what that means. Most of this seems to be due to the fact that both Python and R are untyped languages. On the items:
Dash produce error exception "output "$(out)" already registered" on
In Dash.jl signature of
I will add these checks to |
At master checks for this added |
I actually think Python and R are dynamically typed, rather than untyped, but I can see what you mean about the character string check above. I've removed it, thanks for the reminder! As long as the user is presented with a helpful message explaining the error when the inputs don't match what Dash expects, I think this is fine. If there are situations where a user cannot pass arguments of a given type or structure to the constructor because the language disallows it, then it definitely makes sense to avoid a pointless check. If the Julia exception serves this purpose, I imagine this is OK. Some situations are a little more nuanced, though. What happens when a nested structure is not used when passing multiple
Perfect! |
Yes, I chose the wrong term. I meant that Julia is also dynamically typed, but in Python and R there is no way to use strict typing.
It's always struct of arrays. For example
|
@waralex In order to close this issue, there's just one item left to resolve, I believe:
Have we already made this change? I see Dash.jl/src/app/supporttypes.jl Lines 9 to 12 in b50e5dc
... but on the other hand, I also see: Lines 31 to 38 in b50e5dc
|
@rpkyle The order of passing keywords arguments is not fixed. If this is so important and the user can never specify state after input, then the only way to do this is to reject keywords argruments and use positional. Are you sure we need to do this? According to this issue this python code should produce a validation error:
However it works perfectly |
I asked the same question during initial development of the R version of the backend: plotly/dashR#51 (comment) While it's not explicitly required that Dash handles the callback parameters in this manner, ordering of If Dash.jl is able to "reshuffle" the elements as @alexcjohnson mentions in his comment above, it's fine to avoid imposing a requirement that |
Well. Then the question remains what to do with the
|
Let me back up for a moment to the motivation for this restriction on the Python side: the callback function receives arguments
That's a little more strict than the comment I made when this came up in dashR - we could revisit if someone feels strongly but lately I've been leaning more in the direction of extra uniformity and "one right way to use the package." That discussion was happening in the context of a PR to remove the requirement (in Python) to wrap inputs in a list and states in another list. Of course if you use named args Additionally, unless there's a strong reason to prefer a different order in Julia, I'd like to keep this consistent between languages: in the callback definition, outputs first, then inputs, then state; in the function arguments, inputs first and then state. That will help users of Dash in one language to read Dash apps written in another language, whether to adapt an example back to their primary language or for some other purpose. The So all that said I might prefer to remove |
I understand the motivation and I agree with it. I suggest that I do the following as part of this task:
Regarding point 2, I see such requirements for determining the parameters of the callback
Correct me if I'm wrong. I think that in any case, we will need to discuss several options when I come up with them, because my understanding of readability and convenience may not coincide with yours |
That all sounds right, feel free to either propose a specific API here, or to open a PR and we can discuss there, depending on your confidence in what you're suggesting. |
Both the R and Python implementations of the Dash backend perform various tests for component functionality, in R, these occur within
assert_valid_callbacks
. We should implement the following tests within Dash.jl in similar fashion:output
arguments are duplicatedinput
orstate
argumentsinput
arguments precedestate
arguments, when latter are presentinput
arguments are a nested list of dictionaries (or whatever data structure makes the most sense in Julia)state
arguments are a nested list of dictionaries, if they existinput
has been providedinput
arguments are identical tooutput
arguments (in Dash, we call these "circular callbacks" and they are not allowed)The text was updated successfully, but these errors were encountered: