Closed MarcSkovMadsen closed 2 years ago
I guess the main question for me is how do I meet the _curdoc().session_context
criterion in the servable
function? What should I do to mimic what panel serve
does?
I have added support for serving script with lightning which makes this issue less important.
I've worked around this issue by using panel serve
as outlined here https://github.com/holoviz/panel/issues/3681
Background
I'm trying to contribute a
PanelFrontend
to lightning.ai in https://github.com/Lightning-AI/lightning/pull/13531.The feedback is that they would like an api where the
PanelFrontend
is instantiated with arender_fn
function that runs the Panel code. The main argument is that this is consistent with theStreamlitFrontend
.Personally I think this is problematic because 1) Most panel users are familiar with
panel serve
of a script or notebook.pn.serve
of a function works a bit differently because 2) You can't use.servable
withpn.serve
and a function. But my impression is that starting with an api similar to what they already have is easier for them to understand and approve.Example
Request
My request is to support the combination of
pn.serve
of a function using.servable
as defined inview_2
.Extra Motivation
The
.servable
api is simpler and similar to the Streamlit api. Its easier to work with for a lot of users.Discussion
I think it would be possible to wrap the
view_x
functions in some other function that returns the result ofview_1
because it is not none and does something (what) to collect the.servable
marked items ofview_2
and return them in a template. BUT HOW?