Upgrade Guide#
Welcome to the Upgrade Guide for Panel! When we make backward-incompatible changes, we will provide a detailed guide on how you can update your application to be compatible with the latest changes.
Version 1.11#
Panel 1.11 makes pandas an optional dependency, lets the data components work with any DataFrame library supported by Narwhals, and speeds up how updates and resources reach the browser. Most applications need no changes, but the sections below describe the changes in behavior you may notice.
pandas is optional#
pandas is no longer installed with Panel. It moved to the recommended extra, so pip install "panel[recommended]" still installs it, as does installing any library that depends on it, such as hvPlot or HoloViews. If your application uses pandas directly, declare it as a dependency of your own project or install it alongside Panel:
pip install panel pandas
Without pandas, Tabulator, the DataFrame widget, Perspective and Vizzu work with any eager DataFrame Narwhals supports, such as a Polars DataFrame or a PyArrow Table. A few features still require pandas: the admin panel, which raises an error asking you to install it, styling a Tabulator with a pandas Styler or its style accessor, hierarchical Tabulator tables, and the patched pandas.read_csv and pandas.read_json in Pyodide applications. The DataFrame pane converts other frames to pandas when it is available and otherwise renders a plain HTML table.
Polars, PyArrow and other DataFrames#
The data components no longer require their data to be a pandas DataFrame, and they never convert it to pandas, so value, current_view and selected_dataframe of a Tabulator return the type you passed in:
import polars as pl
import panel as pn
df = pl.DataFrame({'name': ['A', 'B', 'C'], 'score': [3, 1, 2]})
table = pn.widgets.Tabulator(df, selection=[1])
table.selected_dataframe # a polars DataFrame with the row for 'B'
pandas DataFrames behave exactly as before. Since Polars and PyArrow have no row index, rows of these frames are identified by their position in value: selection, expanded, the row of click and edit events and the keys of patch dictionaries are positions, show_index has no effect, row_content receives the row as a dict, and edits, stream and patch replace value with a new frame instead of modifying it in place. Lazy frames, e.g. a Polars LazyFrame, have to be collected first. The “Other DataFrame libraries” section of the Tabulator reference has the details.
Event handling#
Panel now waits 20 ms instead of 50 ms for further changes from the browser before processing a change, which roughly halves the time between a user interaction and the resulting update. BokehJS already sends all the changes made in one browser tick as a single message, so this rarely affects batching. The value is a class attribute, so if an application depends on the old timing you can restore it globally:
import panel as pn
pn.reactive.Syncable._debounce = 50
Updates made from a thread that does not hold the Document lock, for instance in a periodic callback or an event handler running on the thread pool configured with --num-threads, are now applied together on the next tick of the event loop and sent to the browser in a single message. Every value is still sent, in the order it was set, so a sequence of updates is not collapsed into its last value. Updates made by a long-running synchronous callback triggered by a browser event, e.g. showing a spinner before a slow computation, once again reach the browser while the callback is still running, rather than only once it returns as in Panel 1.10. Setting TextInput.value from Python sends one message instead of two.
Resources, compression and caching#
Served pages load fewer resources. MathJax, by far the largest file, is only included when it is needed: when pn.extension('mathjax') was declared, when a Markdown pane, or an HTML pane with disable_math=False, contains math such as $$e^{i\pi} + 1 = 0$$, or when a Bokeh plot uses LaTeX labels. If math only appears in a later update, MathJax is loaded on demand. Templates no longer load their own JavaScript and CSS twice, and the FastListTemplate now also honors font_url. The CSS for the loading indicator is shared by all components on a page instead of being repeated on every model, so the stylesheets of a Bokeh model created by Panel now contain an InlineStyleSheet where they used to contain the raw CSS string.
The Tornado server now compresses responses with gzip for clients that accept it, and Panel’s versioned static resources are served with long-lived cache headers. If a reverse proxy in front of Panel already compresses responses, you can turn Panel’s compression off when serving programmatically:
pn.serve(app, compress=False)
See Control when resources load for more details.
CDN fallback for server resources#
With resources='server', a page now requests a lazily loaded file from the CDN when loading it from Panel’s static/extensions/ routes fails. Panel’s own files are retried from the CDN configured with pn.config.cdn_root (PANEL_CDN_ROOT), and files of other extensions from the CDN they register. Previously only Jupyter extension endpoint URLs fell back to the CDN. The fallback only fires after a failed request, so a server that serves its resources never contacts the CDN, and on an air-gapped network the CDN request simply fails as well. There is no option to turn it off, so if you chose server resources to avoid third-party requests, for example for privacy or because of intranet policies, make sure the extension routes are served for every page.
As a result, hosts that embed Panel output but rewrite or do not serve Panel’s extension routes, such as Shiny through jupyter_bokeh and shinywidgets, now render lazily loaded components like ECharts instead of leaving them blank.
OAuth redirect URI with a prefix or behind a reverse proxy#
As of Panel 1.11 the redirect URI Panel sends to an OAuth provider by default is the public URL of the server root, built from the protocol and host of the request, the --root-path and the --prefix. Two setups produce a different redirect URI than before:
With
--prefixthe redirect URI now includes the prefix, e.g.https://example.org/prefixinstead ofhttps://example.org.With
--use-xheadersbehind a reverse proxy that sends theX-Forwarded-HostorX-Forwarded-Prefix(orX-Script-Name) headers, the redirect URI uses the forwarded host and path prefix, e.g.https://example.org/myappinstead ofhttps://internal-host:5006.
OAuth providers require the redirect URI to match the registered one exactly. If you registered the old value, either register the new one with your provider or keep the old one by passing it with --oauth-redirect-uri (or PANEL_OAUTH_REDIRECT_URI). Deployments that already set --oauth-redirect-uri are not affected. Without --use-xheaders the forwarded headers are ignored as before. See Configuring a reverse proxy for the supported setups.
Smaller changes#
pn.state.as_cachednow forwards the third positional argument to the cached function. Pass the cache lifetime by keyword, for examplettl=60.The
high_dpioption of theMatplotlibpane, which is enabled by default, works again for PNG output: figures are rendered at twice theirdpiand displayed at the same size as before, so they look sharp on high-resolution screens. The images are about two to three times larger; sethigh_dpi=Falseto restore the previous output. This also applies to Matplotlib plots rendered by theHoloViewspane.When an async function or async generator is rendered with
pn.panel(orpn.param.ParamFunctionandParamMethod) andloading_indicator=True, the loading indicator now stays visible until it has finished, instead of disappearing as soon as it started.pn.config.admin_endpointand thePANEL_ADMIN_ENDPOINTenvironment variable are now honored bypanel serve --adminandpn.serve(admin=True). If you set one of them before, the admin panel moves from/adminto the configured endpoint.--admin-endpointstill takes precedence.Tabulatorheader filters enabled withheader_filters=Truenow show a placeholder, e.g. “Filter by name…”. Pass aplaceholderin a per-column filter definition to change it.A
jscallbackregistered on a parameter that only exists in Python, such asrow_heighton aTabulator, raises aValueErrornaming the parameter when the component is rendered, where it previously failed with anAttributeError.Tabulator.jscallback(selection=...)is now supported.pn.serve(..., start=False)andget_server(..., start=False)no longer install a SIGINT handler, so an application that embeds the server keeps its own Ctrl+C handling.Setting
pn.state.location.reload = Truewhile the application is built now takes effect, and setting it back toFalseno longer reloads the page.A
Parampane renders aparam.DateRangeorparam.CalendarDateRangewith bounds but without a default as a slider spanning the bounds. The parameter staysNoneuntil the user selects a range.The
TextEditorwidget loads Quill from the CDN configured withpn.config.npm_cdn(PANEL_NPM_CDN).Panel reads and writes application, setup and template files as UTF-8 on every platform. On Windows it previously used the locale encoding, which broke files containing non-ASCII text.
Deprecations#
TerminalSubprocess options#
Terminal.subprocess.run now replaces the forked child process with the command instead of calling subprocess.run inside it, so none of the server’s exit handlers run in the child. Only the cwd, env, executable and shell options in Terminal.subprocess.kwargs (or passed to run) are still supported. Any other option, such as timeout or check, emits a deprecation warning and is ignored. Support for these options will be removed entirely in Panel 2.0, so drop them from your code.
Version 1.10#
Panel 1.10.0 requires Bokeh 3.10 and serves its applications on its own ASGI application in addition to the existing Tornado server. This means the FastAPI and Django integrations are now implemented in Panel itself, so the bokeh-fastapi and bokeh-django packages are no longer used and are no longer installed by panel[fastapi] or the new panel[django] extra. If your environment pins either of them you can remove them.
Moving to panel.ui#
panel.ui is an opt-in component namespace built from Material UI components and classic Panel components without a Material equivalent. Existing pn.widgets, pn.layout, pn.pane, and other classic imports continue to work; importing panel alone does not switch them to Material components. Use pn.ui or import from a submodule such as panel.ui.widgets when adopting the new components. Flat and submodule imports refer to the same class.
import pandas as pd
import panel as pn
pn.ui.Button(label='Run') # Material UI button
pn.ui.widgets.Button(label='Run') # same class
pn.ui.Tabulator(value=pd.DataFrame({'value': [1, 2]})) # classic component, re-exported unchanged
Material components can be mixed with classic components in an app. Panel 1.9 added label as an alias for name on classic components, so you can adopt that spelling before switching namespaces. We have made a best effort to keep classic and Material components compatible, but they are not 1:1 everywhere. Check Classic and panel.ui compatibility for known parameter and default differences, and test callback behavior before replacing a classic widget. Using panel.ui selects the Material UI design if you have not explicitly configured another design. In a served application only the sessions that use panel.ui switch, so classic applications served from the same process keep their design. To keep a chosen design, set it before using panel.ui. pn.ui.Param and pn.ui.HoloViews always generate Material UI widgets, whichever design is active, while pn.Param and pn.pane.HoloViews generate widgets for the active design. pn.ui.panel works like pn.panel but renders Parameterized and HoloViews objects with the pn.ui panes.
Migrate Python files#
Install the migration tool’s optional dependency, preview the changes, then apply them:
pip install 'panel[migrate]'
panel migrate my_app/
panel migrate --diff my_app/
panel migrate --fix my_app/
panel migrate accepts Python files or directories, searched recursively for *.py files while skipping hidden directories such as .venv and .pixi, as well as venv, node_modules, build and dist. By default it only reports the proposed rewrites and exits with a non-zero status if anything would change. --diff also prints a unified diff, and --fix writes the changes to disk. The report lists rewrites and items that need manual review; a successful exit does not mean there are no manual review items.
For example, a classic pn.widgets.Button(name='Run') call becomes pn.ui.Button(label='Run'). If the file does not already import panel as pn, the tool adds that import. Where supported, the tool also renames button_type to color and button_style to variant, maps the solid and outline variants of RadioButtonGroup and CheckButtonGroup to contained and outlined (the Material constructors also accept the classic spellings), renames size to icon_size on ButtonIcon and ToggleIcon (flagging calls that size the icon through width or height for review), converts MenuButton(split=True) to SplitButton, and replaces compatible classic template calls with pn.ui.Page(...). Components imported from panel_material_ui are rewritten to the same class under pn.ui, and panel_material_ui imports left unused are removed. In files it migrates to pn.ui, it removes explicit selections of Panel’s built-in designs so the app uses the Material UI design, and reports custom designs for manual review. Calls with unsupported parameters, argument unpacking, dynamic variant values, or template options that cannot be confirmed compatible are left unchanged and reported for manual review. The tool changes Python source, not notebooks.
The tool rewrites Python calls, so it cannot migrate anything that depends on the classic DOM or Bokeh models. Material components render different markup, so custom stylesheets, css_classes and config.raw_css that target classic class names or model internals need to be rewritten by hand. The same applies to custom Design and Theme subclasses, template subclasses and Jinja templates, and to jslink and jscallback code that references properties of the classic models.
Classic and panel.ui compatibility#
The following tables compare the public Param parameters of classic components with their panel.ui counterparts. A component re-exported unchanged from classic Panel has the same Python class and parameter API. For Material replacements, a matching parameter name does not guarantee identical validation or behavior; compare the individual component references and test the result in your app. The differences below reflect the updated panel-material-ui implementation; install a release containing those changes before relying on the restored parameters and defaults.
Classic component |
Parameters absent from |
Migration consideration |
|---|---|---|
|
|
Review date entry and picker mode. |
|
|
Check output types as well as input behavior. |
|
|
Material editable sliders do not offer this switch. |
|
|
Review loading timing. |
|
|
Use |
|
|
Review color selection; |
|
|
Review overflow behavior. |
|
|
Review header styling and auto-scrolling. |
Component |
Classic default or parameter type |
|
|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
Boolean |
Number |
|
Integer |
Selector |
|
|
|
|
|
|
|
|
|
The flat namespace also has name collisions: pn.ui.DataFrame is the classic pane, not pn.widgets.DataFrame (use pn.ui.Tabulator for an editable table), and pn.ui.Alert is the Material layout, not pn.pane.Alert. Review these calls manually: panel migrate may rewrite them if their arguments do not reveal the mismatch. Classic templates are not same-named panel.ui classes; use pn.ui.Page and review template-specific options manually. The command flags unsupported arguments it can identify, but it cannot detect changes to defaults or runtime behavior.
FastAPI#
The public API of panel.io.fastapi is unchanged, i.e. add_application, add_applications, get_server and serve behave as they did before, and you no longer have to install bokeh-fastapi alongside Panel. The applications are now dispatched by a middleware rather than a mount, which means it no longer matters whether you call add_applications before or after registering your own routes. See the FastAPI how-to guide for details.
Django#
The Django integration no longer relies on channels, daphne or bokeh-django. Instead Panel composes its own ASGI application with the one Django provides and hands every request it does not own to Django. Existing projects keep the document, autoload, directory, with_request and with_url_args helpers, but import them from panel.io.django and declare the applications in the project’s asgi.py:
import django
django.setup()
import myapp.pn_app as pn_app
from panel.io.django import autoload, get_asgi_application
application = get_asgi_application([
autoload('myapp', pn_app.app),
])
The routing.py module, the bokeh_apps urlpatterns and STATICFILES_DIRS = [bokehjsdir()] are no longer needed. The project is served by an ASGI server such as uvicorn rather than a WSGI one; in development, add panel.io.django to the top of the INSTALLED_APPS and manage.py runserver will serve the ASGI application with uvicorn, the same way channels and daphne used to take that command over. RoutingConfiguration, DjangoBokehConfig and the Channels consumers raise an error pointing at the new API. The Django how-to guide has a full migration section.
Choosing a server from the command line#
panel serve gained a --server option to pick the implementation:
panel serve app.py --server fastapi
The choices are tornado (the default, unchanged), fastapi and asgi, the latter running Panel’s ASGI application under uvicorn without importing FastAPI. The ASGI implementations support everything the Tornado server does apart from the deprecated --rest-provider, --enable-xsrf-cookies and --num-procs, each of which fails with an error naming the option. Authentication, including all the OAuth providers, works on either implementation and the cookies are interoperable, so you can move between them without invalidating existing sessions.
--plugins is supported on --server fastapi, but since the endpoints are no longer Tornado request handlers the plugin module has to declare a FastAPI APIRouter in a ROUTER variable rather than a list of ROUTES. A module may declare both and then be served on either implementation. See Add custom endpoints for the details.
Tabulator and the bokeh-tables bundle#
Tabulator no longer uses Bokeh’s DataTable models, so Panel only loads Bokeh’s bokeh-tables bundle (about 500 KB) when a page needs it, i.e. when a pn.widgets.DataFrame, a HoloViews Table or a Bokeh DataTable is part of the initial layout of a served app or saved file. Notebooks always load it. If such a component is only added after the page has loaded, e.g. in a callback, request the bundle up front:
pn.extension('bokeh-tables')
Bokeh CellFormatter and CellEditor instances passed to the formatters and editors of a Tabulator keep working, but they are now converted to plain specs and rendered by Panel itself:
PercentEditorandTimeEditoruse Tabulator’s own text input.The
columnsof the underlyingDataTabulatormodel areTabulatorColumnmodels holding the formatter and editor specs, rather than BokehTableColumnmodels. Code that inspects the model, e.g. in tests, needs to be updated.Cell formatters and editors defined in a custom Bokeh extension are still rendered by their own views, and the bundle is loaded automatically when such an extension is used.
Deprecations#
REST providers and pn.state.publish#
--rest-provider, --rest-endpoint, pn.state.publish and the panel.io.rest module, including the panel.io.rest entry point for third-party providers, are deprecated and will be removed in Panel 2.0. Both built-in providers had problems: Tranquilizer is no longer maintained and requires a Werkzeug version older than 2.1, so it cannot be installed alongside current Flask releases, and the param provider failed with a server error whenever a request tried to set a parameter. Neither worked on the ASGI servers.
Declare the endpoints in a plugin module instead, as described in Add custom endpoints. A function decorated with @tranquilize usually maps directly onto a FastAPI route, which validates the arguments from the type annotations in the same way:
# Before, served with: panel serve app.py --rest-provider tranquilizer
from tranquilizer import tranquilize
@tranquilize()
def order(cost: float, count: int):
return {'total': cost * count}
# Now, in plugin.py, served with: panel serve app.py --server fastapi --plugins plugin
from fastapi import APIRouter
ROUTER = APIRouter(prefix='/rest')
@ROUTER.get('/order')
def order(cost: float, count: int):
return {'total': cost * count}
To replace pn.state.publish, move the published Parameterized into a module that both the application and the plugin import, and expose the parameters from the plugin. Sharing state with the applications has a complete example.
/rest/session_info#
--rest-session-info and pn.serve(session_history=...) now serve the session information on /session_info on every server implementation, returning the contents of pn.state.session_info directly. The Tornado server also keeps serving it on /rest/session_info, nested under a session_info key as before, but that route is deprecated and will be removed in Panel 2.0.
Neither route requires authentication, even when --basic-auth or --oauth-provider is configured, and the same applies to /liveness. The session information includes timestamps and user agents for each session, so if the server is publicly reachable, restrict access to these routes at the reverse proxy or leave --rest-session-info disabled.
Version 1.0#
The 1.0 release brings a wealth of improvements compared to the 0.x series, including significant changes to the layout engine and an improved approach to handling CSS for individual components. These improvements are thanks to the new Bokeh 3.x releases, which received a bottom-up rewrite of layouts and CSS handling. These updates not only boost the performance but also elevate the customizability of your Panel apps.
As with any major update, it’s important to understand the implications of these changes for your existing applications. This guide is designed to walk you through the key updates introduced in Panel 1.0, the rationale behind them, and the critical considerations to consider while adapting your applications to this new version. We’ll take you on a comprehensive journey, outlining how the new layout engine transforms how you create and manage your Panel apps and the impact of the enhanced CSS handling on your components.
By the end of this guide, you will have a clear understanding of how to leverage the full potential of Panel 1.0’s features and enhancements, ensuring a smooth transition for your applications. So, without further ado, let’s dive into the exciting world of Panel 1.0 and explore the new possibilities it has to offer!
The layout engine#
Panel 1.0, built upon Bokeh 3.0, introduces a CSS-based layout engine that replaces the previous engine, primarily optimized for plotting. This upgrade results in improved performance, especially when handling a multitude of components on the page at the same time and makes it possible to create more complex applications without sacrificing speed and responsiveness.
Additionally, Panel 1.0 offers better sizing of components that are slow to render, such as images. By removing the need for explicit CSS size overrides, Panel 1.0 streamlines the customization process for your layouts. This added flexibility makes it easier to tailor your apps to fit your design goals and user needs.
However, it’s important to note that the complete replacement of the layout implementation might not ensure identical behavior to previous versions. In the upcoming sections, we’ll review key points to consider when adapting to this new layout engine.
sizing_mode#
The sizing_mode has been the primary way to configure the responsiveness of components in Panel, and that has not changed. However, previously the layout engine was quite forgiving in the way it interpreted combinations of the sizing_mode and explicit width/height settings that really did not make sense. Before we dive into some of these differences, let’s briefly go through the different sizing_mode options and what they actually mean:

stretch_width: Stretches content/container in width, while the size of contents determines the height.stretch_height: Stretches content/container in height, while the size of contents determines the width.stretch_both: Stretches content/container in both width and height.
Now let us explore what changed in this release. In the past, the behavior of a responsive component inside a non-responsive container was poorly defined. Generally it would force the container to be responsive as well, but often it would only be width responsive. In this release there are a number of well defined behaviors which determine how a container behaves when it wraps one or more responsively sized component:
If a child is responsive in width then the layout should also be responsive in width (unless a fixed
widthhas been).If a container is vertical (e.g. a
Column) or supports responsive reflowing (e.g. aFlexBox) and a child is responsive in height then the container should also be height-responsive (unless a fixedheightis set).If a container is horizontal (e.g. a
Row) and all children are responsive in height then the container should also be height-responsive. This behavior is asymmetrical with width because there isn’t always vertical space to expand into and it is better for the component to match the height of the other children.If any children declare a fixed
widthorheightthen the container will inherit these asmin_widthandmin_heightsettings to ensure that sufficient space is allocated.
These very explicit rules ensure consistent behavior in most cases, however it is always best to be explicit and declare the sizes.
Let us walk through an example. Below we declare a responsive Image and a fixed-size Markdown pane inside a Row. According to the rules above the Row layout will inherit responsive sizing in width but not height. Additionally it will inherit a min_width from the Markdown pane.
Note
To maintain backward compatibility Panel will still try to infer the appropriate sizing mode by inspecting the children of a container. It is, however, always best to be explicit.
Current behavior
The rules above describe the behavior as of Panel 1.0 and have since been
refined, e.g. FlexBox now derives its sizing_mode from its flex_direction
rather than from its children. Panel also now warns when child inference
overrides a sizing_mode you set on a layout yourself, and offers the
respect_explicit_sizing config option to disable inference for explicitly
sized layouts. See Sizing Mode Inference on Layouts for the current rules and how
to opt out.
Ambiguous configurations#
In the past, Panel would happily accept ambiguous layout configurations, e.g., providing a fixed width while also setting a responsive sizing_mode along the same dimension. As an example, take the following:
pn.pane.Image(..., sizing_mode='stretch_both', width=500)
This specification is ambiguous. Did you want it to stretch the width, or did you want to set a fixed width? In the past, this would be resolved in favor of making the component responsive, i.e. ignoring the width value. In Panel 1.0, we will warn that this is not a supported configuration and turn the width into a min_width. In the future, this conflicting specification will error. To toggle these errors on instead of a warning, set layout_compatibility to 'error':
pn.extension(layout_compatibility='error')
# OR
pn.config.layout_compatibility = 'error'
CSS styling#
The other major change in Panel 1.0 is in the CSS handling on components. Starting in Bokeh 3.0 each component is now rendered into the Shadow DOM. While you don’t have to understand the intricacies of how the shadow DOM works, know that each component is now encapsulated and therefore isolated from the rest of the page. This has big benefits because each component can be styled fully independently without the CSS leaking to other components but it also has significant backward compatibility implications.
Global vs. local stylesheets#
In the past, it was possible to declare global stylesheets that could override the styles of all components on the page. As a backward compatibility measure, any stylesheets defined using the raw_css and css_files config parameters, e.g., by setting:
pn.extension(raw_css=['div.widget-box { color: red; }'], css_files=['https://panel.holoviz.org/custom.css'])
is now strongly discouraged. Because global stylesheets no longer affect the encapsulated components, we will inject these stylesheets directly into each component, which is highly inefficient.
Attention
Usage of pn.config.raw_css and pn.config.css_files is now strongly discouraged.
Depending on whether your custom CSS controlled the styling of individual components or the template, you should now either use the stylesheets property on each component OR use the raw_css and css_files parameters on the template.
Component Stylesheets#
Now that each component is isolated from the rest of the page, it is possible to style each component separately by injecting stylesheets. This is what makes it possible for each component to be styled using the design frameworks (see the how-to guide on applying designs). Instead of injecting global stylesheets, you should now apply the stylesheets on the component.
Let us walk through a simple example. Let’s say you had a global stylesheet that would change the style of a Slider handle. Previously you would have injected this globally like this:
import panel as pn
slider_css = """
.noUi-handle {
border-radius: 100%;
box-shadow: unset;
background-color: #0081f3;
}
"""
pn.extension(raw_css=[slider_css])
Now you can inject it directly on the specific component you want to override like this:
import panel as pn
slider_css = """
.noUi-handle {
border-radius: 100%;
box-shadow: unset;
background-color: #0081f3;
}
"""
pn.widgets.FloatSlider(label='Number', stylesheets=[slider_css])
Alternatively you can also modify the class default like this:
pn.widgets.FloatSlider.stylesheets = [slider_css]
For more details on applying CSS to components see the corresponding how-to guide.
Template Stylesheets#
Sometimes there is still a need to change the appearance of the overall template. Instead of injecting those options via the global raw_css and css_files config parameters you can inject them directly on a template, e.g.:
pn.template.MaterialTemplate(
raw_css=[...], css_files=[...]
)
or if you are using a global template:
pn.state.template.param.update(
raw_css=[...], css_files=[...]
)
Loading extensions#
In the past Panel extensions could be loaded using the pn.extension call, or, if no extension call was present, could simply be imported. When serving an application Panel would then include the resources for all loaded extensions. This meant that when serving multiple applications that required very different components you may end up loading resources for components were not even used.
Going forward we strongly recommend that you always declare which components a particular application is using with a pn.extension call, e.g. if you are using the Tabulator widget and the Vega pane you should declare:
import panel as pn
pn.extension('tabulator', 'vega', ...)
at the top of your application. The flipside of this is that if you call pn.extension but fail to declare the actual requirements then those resources will not be loaded and your application will not render correctly.
Tip
We recommend always declaring all required extensions at the top of your application.
Smaller changes#
Tabulator.frozen_rowsnow respects the order of rows in the data instead of the order in which thefrozen_rowswere defined.Viewable.embednow returns aMimebundleobject that can be rendered in a notebook but also in other contexts.The
policyargument toonpn.cacheused to accept'LIFO'but instead implemented a'FIFO'policy. This has been fixed and the function now only accepts'LRU','LIFO', and'LFU'policies.
Deprecations#
The following changes have been deprecated; we will warn you and guide you on how to update them.
styles and background#
To align with the definition set by Bokeh 3.x, style has been renamed to styles, and the background is now needed to be set inside the styles dictionary:
# Before:
pn.pane.Markdown("# Hello", background="red")
# Now:
pn.pane.Markdown("# Hello", styles={'background': 'red'})
Ace renamed to CodeEditor#
pn.widgets.Ace() has been renamed to pn.widgets.CodeEditor() to reflect better what the component does and not the implementation used.