You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since trame-server>=2.8.0 trame support dynamic file reloading.
Q: What does it mean for you? A: That means you can dynamically edit your code base and re-execute it without stoping and/or restarting your server.
Q: How does it work? A: Any method attached to the controller or a state.change will reload from disk at each execution. Needs to be triggered by the controller.my_method() or @state.change(...) decoration.
Q: How do I enable it while developing? A: You can either set the environment variable TRAME_HOT_RELOAD=1 or add a CLI arg --hot-reload or server.hot_reload = True
Q: What if I want to reload a function/method that is outside of the controller or state.change? A: You can use our @hot_reload annotation (from trame_server.utils.hot_reload import hot_reload).
Q: Is there any limitation? A: Yes, especially with closure functions. But instance methods works great.
Q: Is there a reference example that I can play with? A: Yes and it is available in 17_hot_reload.py
Q: Can I use it when tweaking the UI? A: Absolutely. You just need to encapsulate your layout definition inside a function/method. Then either attach it to the controller.on_server_reload which will add a refresh button in the footer of the vuetify.ui.*. Or bind it to your own button.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Since
trame-server>=2.8.0
trame support dynamic file reloading.Q: What does it mean for you?
A: That means you can dynamically edit your code base and re-execute it without stoping and/or restarting your server.
Q: How does it work?
A: Any method attached to the
controller
or astate.change
will reload from disk at each execution. Needs to be triggered by thecontroller.my_method()
or@state.change(...)
decoration.Q: How do I enable it while developing?
A: You can either set the environment variable
TRAME_HOT_RELOAD=1
or add a CLI arg--hot-reload
orserver.hot_reload = True
Q: What if I want to reload a function/method that is outside of the controller or state.change?
A: You can use our
@hot_reload
annotation (from trame_server.utils.hot_reload import hot_reload
).Q: Is there any limitation?
A: Yes, especially with closure functions. But instance methods works great.
Q: Is there a reference example that I can play with?
A: Yes and it is available in 17_hot_reload.py
Q: Can I use it when tweaking the UI?
A: Absolutely. You just need to encapsulate your layout definition inside a function/method. Then either attach it to the
controller.on_server_reload
which will add a refresh button in the footer of thevuetify.ui.*
. Or bind it to your own button.Beta Was this translation helpful? Give feedback.
All reactions