-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
PanelFrontend and Panel Web UI Intermediate docs #13531
PanelFrontend and Panel Web UI Intermediate docs #13531
Conversation
for more information, see https://pre-commit.ci
…com/MarcSkovMadsen/lightning into feature/panel-frontend-intermediate
With the commit just added I believe I understand the basic principles of a creating a PanelFrontend. Then I just need to convert it to an Api that you @tchaton and others can accept. Panel is different from Streamlit in many ways. It is a reactive framework that does not need to re-run the entire script and update the entire page when the app state changes. So for Panel developers it much more natural to subscribe to an I don't think all apps will depend on the app state. Sometimes you just want to make some tool to visualize some data associated with the app. Thus there is no reason to always start a web socket connection to the app state. Furthermore one of Panels strength is that you can also develop your apps in both panel-lightning-principle-works.mp4Furtheremore there is an issue with the existing web socket loop for the StreamlitPlugin. Each iteration of the loop takes minimum 1 second. So if the app state changes more frequently the loop will get behind and trigger updates of the Streamlit app long after the app state changed. I've used the same implementation for Panel in the latest commit and you can see that in the video. |
…to feature/panel-frontend-intermediate
1e61f51
to
cd133c6
Compare
for more information, see https://pre-commit.ci
Now I have the app code working as I would like to and supporting basic+intermediate examples similar to the Streamlit doc examples. I would still like to add support for serving general-principle-working.mp4Instead of providing an def your_panel_app(app: AppStateWatcher):
submit_button = pn.widgets.Button(name="submit")
@pn.depends(submit_button, watch=True)
def submit(_):
app.state.count += 1
@pn.depends(app.param.state)
def current_count(_):
return f'current count: {app.state.count}'
return pn.Column(
submit_button,
current_count,
) |
…to feature/panel-frontend-intermediate
…com/MarcSkovMadsen/lightning into feature/panel-frontend-intermediate
for more information, see https://pre-commit.ci
…com/MarcSkovMadsen/lightning into feature/panel-frontend-intermediate
FYI, I have tried to add the missing package to mocked list but seems it did not help... |
If you look at the failing docs build you will see that neither Param, Panel or Streamlit is being installed. Investigating a bit you will see the difference between the Panel and Streamlit implementation is that Panel needs to I see two fixes. 1) Figure out how to get param installed during the build pipeline (docs.txt ? ) or 2) somehow change the code/ api to not trigger an import of AppStateWatcher. You probably need to be a bit careful here. Because if the docs fails because Param is not installed, I think there is a risk of the lightning package not working if param is not installed. I think the best solution is not something I can decide. Let me know if there is something I can do. |
In the docs build we have some import statements that run. This means if there is an import path that goes all the way to the app state watcher, it will try to import param, which does not get installed for the docs build, and it doesn't have to be. So I changed the code so that you can import the file/class regardless of whether param is installed. This should fix the problem. |
Hey @MarcSkovMadsen, congrats on your first contribution! |
Juhuuh. We made it ⚡ 🥂 . Thanks for the help. |
Hi @tchaton Is there a way to install easily install a release candidate of the package? Or can I just I have a friend that might want to write a blog post about Panel+Lightning. And it would help her a lot if the package with the Panel frontend could be easily installed already now. |
Hi, @MarcSkovMadsen - @tchaton or @Borda will be able to shed more light on this, but from what I'm aware of:
Again, thank you for your contribution ⚡ 🚀 ! Looking forward to the blog post on Panel + Lightning. 🔥 |
This PR contributes a
PanelFrontend
and intermediate documentation as discussed in #13335.app_pull_state.py
app_pull_state.mp4