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
Revamp shiny modules #100
Revamp shiny modules #100
Conversation
If possible, please add tests. |
56449c3
to
81d4346
Compare
c51854b
to
43f73f9
Compare
26e1063
to
5b04b6b
Compare
5b04b6b
to
e3bef60
Compare
6cc2a44
to
08115dd
Compare
c921b8f
to
c1a2e83
Compare
c1a2e83
to
738203e
Compare
738203e
to
b445500
Compare
19c6c67
to
6b45957
Compare
To summarize where we are right now:
In this example, No more
|
6378472
to
2757b1d
Compare
Some notes: We should have a test for auto-namespacing in dynamic UI, as well as a real app that exercises that. Overall, the API looks good to me. The only thing I’m wondering about is if it’ll ever be an issue that input UI objects need to be created in the context of the module. In other words, is it possible for a module's UI object to be created outside of that context? The good thing is that this is less likely in Python than in R, due to the lack of lazy evaluation. That said, in R, we also introduced |
@wch That's a really good point. If it helps, you can resolve an id as early as you want; once you've resolved it, it won't be resolved again. def foo(id: Id):
id = module.resolve_id(id)
def _():
slider_input(id)
return _ When the (Actually let me add a test for that) |
and namespaced_id to resolve_id
5fb0722
to
831d522
Compare
26d0d47
to
a5397ae
Compare
I changed the example under |
This PR removes
Module()
in favor of@module.ui
and@module.server
decorators and also removes the need to explicitly namespace ids when generating UI. Seeexamples/moduleapp/app.py
for an example. There is one main downside to implicitly name-spacing in that binding developers will need to know that they need to wrap ids withmodule.resolve_id()
(see, for example, the implementation ofui.input_action_button()
orui.output_text()
)This also fixes the following:
Closes #99
Closes #167
Closes #103
Closes #102
Closes #101
TODO
SessionProxy
methods (i.e.,Session
methods that need to know about the namespace).