diff --git a/panel/template/base.py b/panel/template/base.py index 7d30fd1209..38ddc000f2 100644 --- a/panel/template/base.py +++ b/panel/template/base.py @@ -56,6 +56,7 @@ from bokeh.server.contexts import BokehSessionContext from jinja2 import Template as _Template from pyviz_comms import Comm + from typing_extensions import Self from ..io.location import Location from ..io.resources import ResourcesType @@ -506,7 +507,7 @@ def server_doc( def servable( self, title: str | None = None, location: bool | Location = True, area: str = 'main', target: str | None = None - ) -> ServableMixin: + ) -> Self: """ Serves the template and returns self to allow it to display itself in a notebook context. diff --git a/panel/viewable.py b/panel/viewable.py index 5280efff07..425567b673 100644 --- a/panel/viewable.py +++ b/panel/viewable.py @@ -56,6 +56,7 @@ from bokeh.model import Model from bokeh.server.contexts import BokehSessionContext from bokeh.server.server import Server + from typing_extensions import Self from .io.location import Location from .io.notebook import Mimebundle @@ -359,7 +360,7 @@ def _add_location( def servable( self, title: str | None = None, location: bool | Location = True, area: str = 'main', target: str | None = None - ) -> ServableMixin: + ) -> Self: """ Serves the object or adds it to the configured pn.state.template if in a `panel serve` context, writes to the