Can we move to a @ui.page
-only world?
#5223
Replies: 3 comments 1 reply
-
For me personally "the easy running of demos and small scripts" is a huge advantage of script mode. It's like Jupyter for NiceGUI. I use it for debugging code snippets from the community, demonstrating simply NiceGUI concepts, or even experimenting with NiceGUI-agnostic Python code. And the fact that almost all demos are one or two lines shorter and an indentation less complex, adds up. Apart from that I think that the cost of maintaining the script mode is far smaller than it was for the auto-index client. We now have basically one switch right at the start and the rest behaves like the script was wrapped in a page function. Oh course, I'm open for counterarguments. But at the moment I'm very happy with the script mode and would like to keep it. |
Beta Was this translation helpful? Give feedback.
-
I think , we should tell beginner what does not work in script mode. |
Beta Was this translation helpful? Give feedback.
-
I think the new root parameter is much better that If you do not use a root page function in |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
With NiceGUI 3.0, we dropped the concept of the shared client for the UI elements outside of
@ui.page
function, but for the name of existing code to "work", we have this "script mode" where NiceGUI wraps your code into@ui.page
for you.But, with recent discussions, it has been brought to my attention that it "works" to some extent only, with the following discrepancies to 2.x behaviour.
ui.label(str(time.time()))
in your code, every time you refresh it it's the same.Maintaining this "script mode" is tough, since:
Consider this: For 2.x upgrade to 3.0, code which needs migration will migrate straight to
@ui.page
. What's left are the code which still works, my hypothesis is that it may be a small amount.And so, maybe in 4.0 we can finally drop the "script mode" and we basically follow FastAPI in a sense that with the exception of the
root
parameter used for Single-Page Applications, "no decorator no talk" for pages.Question is: are there genuine uses, other than the easy running of demos and small scripts, that the "script mode" is of use?
Beta Was this translation helpful? Give feedback.
All reactions