-
-
Notifications
You must be signed in to change notification settings - Fork 525
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
Add ability to configure global template #2271
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2271 +/- ##
==========================================
- Coverage 83.54% 83.45% -0.09%
==========================================
Files 185 185
Lines 22635 22677 +42
==========================================
+ Hits 18910 18925 +15
- Misses 3725 3752 +27
Continue to review full report at Codecov.
|
This looks fabulous! I think it's a very good default way to build an app. What happens in the notebook? |
Nothing, you see the individual components. For viewing the full app you'd have to view the |
I opened #2274 under the assumption that showing the whole app is a separate topic, but it might not be independent. E.g. in this PR, the default template is None. I could imagine that instead there would be an actual zero-frills template that's the default template, and that |
Can I panel serve multiple notebooks using different templates this way? For example Panel on Binder? |
One downside is that users will get slower apps than using a template directly @philippjfr because we teach them to put everything into a column that the Bokeh layout engine then lays out. And you don.t get things layed out nicely in Cards as with the Fast templates. |
If you can make multiple components side_title = pn.pane.Markdown("## Settings").servable(area='sidebar')
freq = pn.widgets.FloatSlider(name="Frequency", start=0, end=10, value=2).servable(area='sidebar')
phase = pn.widgets.FloatSlider(name="Phase", start=0, end=np.pi).servable(area='sidebar')` Especially if you where able to see the resulting template in the notebook. A simple version either in a notebook html template or just a simple, responsive, Panel layout of some kind is better than nothing. It would also be nice if you could access the list or |
Yes you can but I will have to make sure that the config settings are reset for each session (which is probably a problem in general). You can also add as many items as you want and access the existing items on pn.state.template.main for example. The only problem I see is with grid based templates since you'd also have to specify the grid coordinates somehow. |
For the grid option, can someone create a pn.Gridspec object and mark that servable, and that becomes the grid? (Instead of marking each individual item servable?) |
@philippjfr would you not just add something like Something like |
Yeah, this is the only thing I can imagine working, but it's not pretty :/ |
Again this would be new API which wouldn't fit with the rest of this model of working, so I'm -1 on any approach like this. |
I've updated where I said pn.Grid to say pn.Gridspec; I hadn't meant to propose any new API. I just meant, can't a user create a pn.Gridspec object and have that be the thing they mark servable? Having done so seems like it's up to Panel precisely how it makes it servable, i.e. whether to put the whole grid in one card (presumably what happens right now) or to map it down to the template's card grid (what I'm proposing), though I may be skipping some important technical steps. The idea was to let the user have a grid object to work with (because they created it). With the |
e4e8722
to
556aae8
Compare
Sure they could but the tension is between template rendering which is fixed once the template is served and dynamic rendering which allows changing the dynamically after rendering. Making the GridSpec fixed would be surprising to a user trying to change it dynamically but keeping it dynamic has performance implications (until the unmanaged layout is available in bokeh). |
ffc0316
to
afad8ca
Compare
afad8ca
to
8750b4e
Compare
I have decided against supporting grid based templates for now, may revisit that before release but for now this is a sufficient win for me to be convinced that I should merge this. |
Allows setting a global template via
pn.config
and adding to the template via.servable
. This will be particularly handy for notebooks where you construct and view individual components while also allowing you to place them in the appropriate places in the template.Ping @jbednar @MarcSkovMadsen for thoughts