internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: holoviz/panel

Issue:
FastTemplate not working on current master branch
Running the example in https://github.com/holoviz/panel/pull/3882 on the current `master` branch, I noticed the *theme toggle button* is not white. Looking at the browser console I can see it has problems loading a js file.

![image](https://user-images.githubusercontent.com/42288570/192143889-f3ee3ad8-9f73-4045-b199-a859b2f62adb.png)

```bash
       Uncaught TypeError: Failed to resolve module specifier "static/extensions/panel/bundled/js/@microsoft/fast-colors@5.3.1/dist/index.js". Relative references must start with either "/", "./", or "../".
```



Discussion:
Had the same issue but was pretty sure this was fixed. Will take a look later.
Turned out to be a tiny little typo, will push up a fix shortly.

Resolving patch:
diff --git a/panel/template/base.py b/panel/template/base.py
--- a/panel/template/base.py
+++ b/panel/template/base.py
@@ -630,7 +630,7 @@ def _template_resources(self) -> ResourcesType:
                 else:
                     resource_path = url_path(resource)
                 rtype = 'css' if resource_type == 'css' else 'js'
-                prefix = f'./{dist_path}' if resource_type == 'js_module' and not state.rel_path else dist_path
+                prefix = f'./{dist_path}' if resource_type == 'js_modules' and not state.rel_path else dist_path
                 bundlepath = BUNDLE_DIR / rtype / resource_path.replace('/', os.path.sep)
                 if bundlepath:
                     resource_files[rname] = f'{prefix}bundled/{rtype}/{resource_path}'


Test patch:
Repository: holoviz/panel

Issue:
Pyscript Example not working: https://pyscript.net/stable/pyscript.js not found
The example for the new docs will not work for several reasons

- Cannot find pyscript .js and .css
- contains `...`
- does not contain `div` with id `simple_app`.

https://pyviz-dev.github.io/panel/user_guide/Running_in_Webassembly.html#pyscript

![image](https://user-images.githubusercontent.com/42288570/193103246-49e7ea46-fb07-4227-bff2-489599ba81d1.png)



Discussion:

Resolving patch:
diff --git a/panel/io/convert.py b/panel/io/convert.py
--- a/panel/io/convert.py
+++ b/panel/io/convert.py
@@ -42,8 +42,8 @@
 PANEL_CDN_WHL = f'{CDN_DIST}wheels/panel-{PY_VERSION}-py3-none-any.whl'
 BOKEH_CDN_WHL = f'{CDN_DIST}wheels/bokeh-{BOKEH_VERSION}-py3-none-any.whl'
 PYODIDE_URL = 'https://cdn.jsdelivr.net/pyodide/v0.21.3/full/pyodide.js'
-PYSCRIPT_CSS = '<link rel="stylesheet" href="https://pyscript.net/latest/pyscript.css" />'
-PYSCRIPT_JS = '<script defer src="https://pyscript.net/latest/pyscript.js"></script>'
+PYSCRIPT_CSS = '<link rel="stylesheet" href="https://pyscript.net/releases/2022.09.1/pyscript.css" />'
+PYSCRIPT_JS = '<script defer src="https://pyscript.net/releases/2022.09.1/pyscript.js"></script>'
 PYODIDE_JS = f'<script src="{PYODIDE_URL}"></script>'
 
 ICON_DIR = DIST_DIR / 'images'


Test patch:
Repository: holoviz/panel

Issue:
Make it easy and useful to use the VideoStream
I've never seen any showcases of the `VideoStream` in Panel. As Panel can update relatively quickly via Tornado and websockets it should be the best data app framework for Video. And with `panel convert` even better.

But there are lot of issues

- There are no inspirational examples out there
- When you try out you run into several issues
  - The VideoStream transfers a high resolution image
  - The VideoStream transfers a .png base64 data url. It is slow to work with in Pillow and other frameworks. JPEG is much faster to load and transform
  - You need to be able to convert from base64 to PIL.Image for using Pillow and np.ndarray for using scikit-learn etc. This might be easy for experienced data vision people. But for beginners this is so hard.

To make it easier for Panel users to get started and create something useful. I propose we add an example to the Gallery that people can use for inspiration. We can use the example to identify and solve any performance issues.

The example should end up being easy to understand and use + super performant.

## Additional Context

[Yuichiro](https://twitter.com/whitphx) has done some really amazing work to make this possible in Streamlit. We should be able to find inspiration and make something at least as awesome. See https://edit.share.stlite.net/?sampleAppId=realtime_image_processing

[![image](https://user-images.githubusercontent.com/42288570/197327999-d67c824c-4303-44e1-9a06-623304116f0d.png)](https://twitter.com/whitphx/status/1583708572063772675?s=20&t=lZLbNEIl7LQpVWu1RyNEiQ)


Discussion:

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -191,7 +191,8 @@ def run(self):
         'python-graphviz',
         'xgboost',
         'ipyvuetify',
-        'reacton'
+        'reacton',
+        'scikit-image',
     ],
     'tests': _tests,
     'recommended': _recommended,


Test patch:
Repository: holoviz/panel

Issue:
Panel 1.0: Divider takes 100% of window height
I'm on the current `main` branch of Panel. When I use the `Divider` it takes up 100% of the window height.

```python
import panel as pn

pn.extension(sizing_mode="stretch_width")

pn.panel("Header", styles={"background": "lightgray"}).servable()
pn.layout.Divider(styles={"background": "salmon"}).servable()
pn.panel("Footer", styles={"background": "lightgray"}).servable()
```

![image](https://user-images.githubusercontent.com/42288570/218242832-e2707e78-aba7-4f1e-b924-340496c7ab6b.png)

I don't know if it is on purpose. But the `styles` seem not to apply to the `Divider` either.


Discussion:
And if I use it more simple the width is `2px`?

```python
import panel as pn

pn.extension(sizing_mode="stretch_width")

pn.Column("Header", pn.layout.Divider(sizing_mode="stretch_width"), "Footer").servable()
```

![image](https://user-images.githubusercontent.com/42288570/218270474-757b03b5-4cef-4253-8712-902b0d576968.png)
Hmmm. Someone hard coded the `styles` Who could that be @philippjfr? Should you not use the `_styles` and `:host` for that? :-)

![image](https://user-images.githubusercontent.com/42288570/218270911-12fc1213-a4fc-410c-b327-596ebc60c0e7.png)

I will fix

Resolving patch:
diff --git a/panel/layout/spacer.py b/panel/layout/spacer.py
--- a/panel/layout/spacer.py
+++ b/panel/layout/spacer.py
@@ -102,10 +102,11 @@ class Divider(Reactive):
 
     _bokeh_model = BkDiv
 
+    _stylesheets = ["css/divider.css"]
+
     def _get_model(self, doc, root=None, parent=None, comm=None):
         properties = self._process_param_change(self._init_params())
-        properties['styles'] = {'width': '100%', 'height': '100%'}
-        model = self._bokeh_model(text='<hr style="margin: 0px">', **properties)
+        model = self._bokeh_model(text='<hr>', **properties)
         if root is None:
             root = model
         self._models[root.ref['id']] = (model, parent)


Test patch:
Repository: holoviz/panel

Issue:
pn.widgets.Select does not work with size.

``` python
import panel as pn

pn.extension()

size = 10
pn.widgets.Select(options=list(range(size)), size=size)
```

![image](https://user-images.githubusercontent.com/19758978/228593707-e0e06b21-d04a-4d93-a370-0bd51c028afd.png)

This seems to be because `pn.widgets.Select._rename` is not sent to the Bokeh model.
![image](https://user-images.githubusercontent.com/19758978/228593869-487db091-f1d7-4493-8361-84ce48d9cdd5.png)

I'm unsure if the fix is to remove `size` from `_rename` or if I'm overlooking something. 



Discussion:

Resolving patch:
diff --git a/panel/models/widgets.py b/panel/models/widgets.py
--- a/panel/models/widgets.py
+++ b/panel/models/widgets.py
@@ -177,3 +177,5 @@ class CustomSelect(Select):
     disabled_options = List(Any, default=[], help="""
     List of options to disable.
     """)
+
+    size = Int(default=1)
diff --git a/panel/widgets/select.py b/panel/widgets/select.py
--- a/panel/widgets/select.py
+++ b/panel/widgets/select.py
@@ -176,7 +176,7 @@ class Select(SingleSelectBase):
       or scale mode this will merely be used as a suggestion.""")
 
     _rename: ClassVar[Mapping[str, str | None]] = {
-        'groups': None, 'size': None
+        'groups': None,
     }
 
     _source_transforms: ClassVar[Mapping[str, str | None]] = {


Test patch:
Repository: holoviz/panel

Issue:
Add ability to open custom notebook in Panelite.
The Jupyter lite extension https://github.com/jupyterlab-contrib/jupyterlab-open-url-parameter enables you to open a notebook from an url in Jupyterlite.

This would be really powerful to include in the build of Panelite as we can the start to share links to notebooks that opens quickly for the user with a working environment.


Discussion:
For a lot of background info leading to this extension check out https://github.com/jupyterlite/jupyterlite/issues/430
Docs about how to enable this here: https://github.com/jupyterlite/jupyterlite/blob/76cd0496add7494bec9a749b2044e28074f60781/docs/howto/content/open-url-parameter.md

Resolving patch:
diff --git a/doc/conf.py b/doc/conf.py
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -55,10 +55,6 @@
             "icon": "fab fa-discourse",
         },
     ],
-    "footer_items": [
-        "copyright",
-        "last-updated",
-    ],
     "google_analytics_id": "UA-154795830-2",
     "pygment_light_style": "material",
     "pygment_dark_style": "material",
@@ -111,6 +107,7 @@
         },
         'reference': {
             'title': 'Reference Gallery',
+            'as_pyodide': True,
             'sections': [
                 'panes',
                 'layouts',
@@ -129,7 +126,8 @@
         }
     },
     'thumbnail_url': 'https://assets.holoviz.org/panel/thumbnails',
-    'deployment_url': 'https://panel-gallery.pyviz.demo.anaconda.com/'
+    'deployment_url': 'https://panel-gallery.pyviz.demo.anaconda.com/',
+    'jupyterlite_url': 'https://panelite.holoviz.org/lab/index.html'
 }
 
 if panel.__version__ != version and (PANEL_ROOT / 'dist' / 'wheels').is_dir():


Test patch:
Repository: holoviz/panel

Issue:
'DataFrame' object has no attribute '_edited_indexes'
#3831 introduced a bug to `panel.widgets.DataFrame` when adding a filter. Using the `Tabulator` widget works as expected.

## Example

```python
import panel as pn
import pandas as pd

pn.extension()

data = pd.DataFrame({'x': [1, 2, 3], 'y': [4, 5, 6]})
table = pn.widgets.DataFrame(data)

table.add_filter(2, 'x')
```

### Error Output
```
File /opt/conda/envs/env_name/lib/python3.8/site-packages/panel/widgets/tables.py:272, in BaseTable._update_cds(self, *events)
    269 @updating
    270 def _update_cds(self, *events: param.parameterized.Event):
    271     old_processed = self._processed
--> 272     self._processed, data = self._get_data()
    273     self._update_index_mapping()
    274     # If there is a selection we have to compute new index
...
--> 426 if self._edited_indexes:
    427     edited_mask = (df.index.isin(self._edited_indexes))
    428     mask = mask | edited_mask

AttributeError: 'DataFrame' object has no attribute '_edited_indexes'
```


Discussion:

Resolving patch:
diff --git a/panel/widgets/tables.py b/panel/widgets/tables.py
--- a/panel/widgets/tables.py
+++ b/panel/widgets/tables.py
@@ -111,6 +111,7 @@ def __init__(self, value=None, **params):
         self._renamed_cols = {}
         self._filters = []
         self._index_mapping = {}
+        self._edited_indexes = []
         super().__init__(value=value, **params)
         self.param.watch(self._setup_on_change, ['editors', 'formatters'])
         self.param.trigger('editors')
@@ -1125,7 +1126,6 @@ def __init__(self, value=None, **params):
         self.style = None
         self._computed_styler = None
         self._child_panels = {}
-        self._edited_indexes = []
         self._explicit_pagination = 'pagination' in params
         self._on_edit_callbacks = []
         self._on_click_callbacks = {}


Test patch:
Repository: holoviz/panel

Issue:
Alerts show dunder methods as bold

![image](https://github.com/holoviz/panel/assets/19758978/cb7158f9-83fd-4b29-8450-c5b136e9d793)

```
import panel as pn

pn.extension()

def __test__():
    raise ValueError("Test")

pn.panel(__test__).servable()
```


Discussion:

Resolving patch:
diff --git a/panel/io/server.py b/panel/io/server.py
--- a/panel/io/server.py
+++ b/panel/io/server.py
@@ -723,7 +723,7 @@ def handle_exception(handler, e):
             # Serve error
             e_msg = str(e).replace('\033[1m', '<b>').replace('\033[0m', '</b>')
             Alert(
-                f'<b>{type(e).__name__}</b>: {e_msg}</br><pre style="overflow-y: auto">{tb}</pre>',
+                f'<b>{type(e).__name__}</b>: {e_msg}\n<pre style="overflow-y: auto">{tb}</pre>',
                 alert_type='danger', margin=5, sizing_mode='stretch_width'
             ).servable()
 


Test patch:
Repository: holoviz/panel

Issue:
Toggle doesn't show icon
https://panel.holoviz.org/reference/widgets/Toggle.html

<img width="755" alt="image" src="https://github.com/holoviz/panel/assets/15331990/098541a9-c387-449f-83af-e94233792637">



Discussion:
This should be fixable by removing Icon here:
https://github.com/holoviz/panel/blob/81bbfaa8ff3eb5b296fed058420a54b692a67008/panel/widgets/button.py#L272

![image](https://github.com/holoviz/panel/assets/19758978/97549923-6334-42ce-9b97-58411aee503b)

Thanks for looking into it!

I'm wondering if there was a particular reason that 'icon' is None before just dropping it?

Resolving patch:
diff --git a/panel/widgets/button.py b/panel/widgets/button.py
--- a/panel/widgets/button.py
+++ b/panel/widgets/button.py
@@ -68,11 +68,15 @@ class IconMixin(Widget):
         Size of the icon as a string, e.g. 12px or 1em.""")
 
     _rename: ClassVar[Mapping[str, str | None]] = {
-        'icon_size': None
+        'icon_size': None, '_icon': 'icon', 'icon': None
     }
 
     __abstract = True
 
+    def __init__(self, **params) -> None:
+        self._rename = dict(self._rename, **IconMixin._rename)
+        super().__init__(**params)
+
     def _process_param_change(self, params):
         icon_size = params.pop('icon_size', self.icon_size)
         if params.get('icon') is not None:
@@ -81,7 +85,7 @@ def _process_param_change(self, params):
                 icon_model = SVGIcon(svg=icon, size=icon_size)
             else:
                 icon_model = TablerIcon(icon_name=icon, size=icon_size)
-            params['icon'] = icon_model
+            params['_icon'] = icon_model
         return super()._process_param_change(params)
 
 
@@ -92,7 +96,7 @@ class _ClickButton(_ButtonBase, IconMixin):
     _event: ClassVar[str] = 'button_click'
 
     _source_transforms: ClassVar[Mapping[str, str | None]] = {
-        'button_style': None, 'icon_size': None, 'icon': None
+        'button_style': None,
     }
 
     def _get_model(
@@ -269,7 +273,7 @@ class Toggle(_ButtonBase, IconMixin):
         Whether the button is currently toggled.""")
 
     _rename: ClassVar[Mapping[str, str | None]] = {
-        'value': 'active', 'name': 'label', 'icon': None, 'icon_size': None
+        'value': 'active', 'name': 'label',
     }
 
     _supports_embed: ClassVar[bool] = True


Test patch:
Repository: holoviz/panel

Issue:
`pn.widgets.Progress` does not respect pn.config.sizing_mode
This doesn't work
```
import panel as pn

pn.extension()
pn.config.sizing_mode = "stretch_width"
probability_1 = pn.widgets.Progress(active=False, height=30, value=997, max=1000)
probability_1.servable()
```

<img width="854" alt="image" src="https://github.com/holoviz/panel/assets/15331990/ddec8ee7-6f75-48a2-9869-bcbfad9ca70d">


This works:
```
import panel as pn

pn.extension()
probability_1 = pn.widgets.Progress(
    active=False, height=30, value=997, max=1000, sizing_mode="stretch_width"
)
probability_1.servable()
```
<img width="853" alt="image" src="https://github.com/holoviz/panel/assets/15331990/3671591b-ab23-4d76-8424-f8a0db8f2715">



Discussion:

Resolving patch:
diff --git a/panel/widgets/indicators.py b/panel/widgets/indicators.py
--- a/panel/widgets/indicators.py
+++ b/panel/widgets/indicators.py
@@ -216,6 +216,10 @@ class Progress(ValueIndicator):
 
     max = param.Integer(default=100, doc="The maximum value of the progress bar.")
 
+    sizing_mode = param.ObjectSelector(default=None, objects=[
+        'fixed', 'stretch_width', 'stretch_height', 'stretch_both',
+        'scale_width', 'scale_height', 'scale_both', None])
+
     value = param.Integer(default=-1, bounds=(-1, None), doc="""
         The current value of the progress bar. If set to -1 the progress
         bar will be indeterminate and animate depending on the active
@@ -232,8 +236,6 @@ def _update_value_bounds(self):
         self.param.value.bounds = (-1, self.max)
 
     def __init__(self,**params):
-        if "sizing_mode" not in params:
-            params["sizing_mode"] = None
         super().__init__(**params)
         self._update_value_bounds()
 


Test patch:
Repository: holoviz/panel

Issue:
Automatic vscode detection is not always working 
Continuation of #5007. 

When running VSCode inside a virtualization/containerized environment, for example, WSL on Windows, the system environment variable we use `VSCODE_PID` to detect if we are running inside a vs code notebook is not set. Below is an example of the `VSCODE_` environment variables set in a notebook environment on WSL. 

```
import os
sorted(k for k in os.environ if "VSCODE" in k)
```

![image](https://github.com/holoviz/panel/assets/19758978/82b1a588-c3a3-4b35-a851-d254da710885)

![image](https://github.com/holoviz/panel/assets/19758978/93927c6d-4afc-4d48-8ba0-7ca32c67301e)





Discussion:
@giladpn, Is it possible for you to run the above code in a notebook running in a docker container?
@hoxbro Done. I ran this on a docker RHEL9 container:
![image](https://github.com/holoviz/panel/assets/60221624/8232e3e0-0606-4797-8c01-f0948432f558)

Would propose we check for VSCODE_CWD in addition to VSCODE_PID

Resolving patch:
diff --git a/panel/config.py b/panel/config.py
--- a/panel/config.py
+++ b/panel/config.py
@@ -787,14 +787,11 @@ def _detect_comms(self, params):
             return
 
         # Try to detect environment so that we can enable comms
-        try:
-            import google.colab  # noqa
+        if "google.colab" in sys.modules:
             config.comms = "colab"
             return
-        except ImportError:
-            pass
 
-        if "VSCODE_PID" in os.environ:
+        if "VSCODE_CWD" in os.environ or "VSCODE_PID" in os.environ:
             config.comms = "vscode"
             self._ignore_bokeh_warnings()
             return


Test patch:
Repository: holoviz/panel

Issue:
`pn.pane.Perspective` doesn't have the `editable` attribute
The [panel/models/perspective.py](https://github.com/holoviz/panel/blob/main/panel/models/perspective.py#L39) file has an `editable` attribute that defaults to `True`. This attribute overrides the `editable` field in the `plugin_config` of the [panel/models/perspective.ts](https://github.com/holoviz/panel/blob/main/panel/models/perspective.ts#L138-L142) file. However, [panel/pane/perspective.py](https://github.com/holoviz/panel/blob/main/panel/pane/perspective.py#L254) does not include the editable attribute. As a result, developers are unable to change the value of `editable` for the Perspective pane.



Discussion:

Resolving patch:
diff --git a/panel/pane/perspective.py b/panel/pane/perspective.py
--- a/panel/pane/perspective.py
+++ b/panel/pane/perspective.py
@@ -269,6 +269,9 @@ class Perspective(ModelPane, ReactiveData):
     columns = param.List(default=None, doc="""
         A list of source columns to show as columns. For example ["x", "y"]""")
 
+    editable = param.Boolean(default=True, allow_None=True, doc="""
+      Whether items are editable.""")
+
     expressions = param.List(default=None, doc="""
       A list of expressions computing new columns from existing columns.
       For example [""x"+"index""]""")


Test patch:
Repository: holoviz/panel

Issue:
PDF pane shows local pdf as base64 string
Reported by petegordon in https://discourse.holoviz.org/t/pn-pane-pdf-local-file-rendering/5720

## Reproduce

```python
import panel as pn

pn.extension()

pn.pane.PDF('sample.pdf', width=700, height=1000).servable()
```

[sample.pdf](https://github.com/holoviz/panel/files/12062444/sample.pdf)

![image](https://github.com/holoviz/panel/assets/42288570/4991d62a-7b35-429a-8484-77445b307ac3)




Discussion:

Resolving patch:
diff --git a/panel/pane/image.py b/panel/pane/image.py
--- a/panel/pane/image.py
+++ b/panel/pane/image.py
@@ -487,7 +487,9 @@ def _transform_object(self, obj: Any) -> Dict[str, Any]:
             if not isinstance(data, bytes):
                 data = data.encode('utf-8')
             b64 = base64.b64encode(data).decode("utf-8")
-            return dict(text=b64)
+            if self.embed:
+                return dict(text=b64)
+            obj = f'data:application/pdf;base64,{b64}'
 
         w, h = self.width or '100%', self.height or '100%'
         page = f'#page={self.start_page}' if getattr(self, 'start_page', None) else ''


Test patch:
diff --git a/panel/tests/pane/test_image.py b/panel/tests/pane/test_image.py
--- a/panel/tests/pane/test_image.py
+++ b/panel/tests/pane/test_image.py
@@ -150,6 +150,13 @@ def test_pdf_no_embed(document, comm):
 
     assert model.text.startswith(f"&lt;embed src=&quot;{url}")
 
+def test_pdf_local_file(document, comm):
+    path = Path(__file__).parent.parent / "test_data" / "sample.pdf"
+    pdf_pane = PDF(object=path)
+    model = pdf_pane.get_root(document, comm)
+    assert model.text.startswith("&lt;embed src=&quot;data:application/pdf;base64,JVBER")
+    assert model.text.endswith("RU9GCg==#page=1&quot; width=&#x27;100%&#x27; height=&#x27;100%&#x27; type=&quot;application/pdf&quot;&gt;")
+
 def test_png_native_size(document, comm):
     png = PNG(PNG_FILE, embed=False)
     model = png.get_root(document, comm)
diff --git a/panel/tests/test_data/sample.pdf b/panel/tests/test_data/sample.pdf
new file mode 100644
Binary files /dev/null and b/panel/tests/test_data/sample.pdf differ