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

Issue:
Deployment of Templated Apps to Binder using jupypter-panel-proxy not working.
Panel 0.11

## My Pain

I would like to demonstrate to colleagues and the Panel community how easy it is to share Panel apps on binder. It's really just adding `jupyter-panel-proxy` as described in the Panel docs and your notebooks in the root directory.

But no. The world is not so easy and the FastGridTemplate does not work

## Reproducing Steps

Open https://mybinder.org/v2/gh/MarcSkovMadsen/load-forecasts/HEAD?urlpath=/panel/app

## Screenshot of bug

![image](https://user-images.githubusercontent.com/42288570/110526870-9b516b00-8116-11eb-971c-2c4ce5e42ef8.png)

## Repository

https://github.com/marcskovmadsen/load-forecasts

## Additional Context

I would also in the near future have access to a JupyterHub and would like to run my panel apps there. And it would be the same problem on JupyterHub. 

So there is a large community of users on Universities, Govt. institutions and in Enterprises that do not have easy access to share their Panel apps via JupyterHub.

FYI. @WesleyTheGeolien


Discussion:
## Additional Context

When running locally the app looks like

![image](https://user-images.githubusercontent.com/42288570/110527428-3d715300-8117-11eb-86fe-dbc419d1427b.png)
## Additional Context - reverse proxy

I believe the problem is more general tjen jupyter deployment. I believe panel have problems whenever it’s deployed besind a reverse proxy to a non-root path.

For example at work I deploy to kubernetes and i have to serve my panel apps at /. If i serve them at /panel-apps my bundled static files cannot be found. Because panel looks for them at /static not / panel-apps/static

Thus a whole lot of kubernetes users/ reverse proxy users will not be able to deploy their panel apps.
Yes, I think the paths are getting mangled here. We should fix this and then release 0.11.1.

Resolving patch:
diff --git a/panel/template/base.py b/panel/template/base.py
--- a/panel/template/base.py
+++ b/panel/template/base.py
@@ -462,9 +462,9 @@ def _get_theme(self):
     def _template_resources(self):
         name = type(self).__name__.lower()
         resources = _settings.resources(default="server")
-        base_url = state.base_url[1:] if state.base_url.startswith('/') else state.base_url        
         if resources == 'server':
-            dist_path = urljoin(base_url, LOCAL_DIST)
+            base_url = state.base_url[1:] if state.base_url.startswith('/') else state.base_url        
+            dist_path = '/' + urljoin(base_url, LOCAL_DIST)
         else:
             dist_path = CDN_DIST
 


Test patch:
Repository: holoviz/panel

Issue:
Cannot give Progress initial look of value=0, max=100
Panel 0.11

I am trying to build the `Tqdm` indicator with an initial look of 

![image](https://user-images.githubusercontent.com/42288570/111056643-ee158480-8480-11eb-88d6-91ef5b5a0288.png)

But the only initial look I can get is

![image](https://user-images.githubusercontent.com/42288570/111056655-0dacad00-8481-11eb-8cc1-f3738785a4df.png)

This is produced by

```python
import panel as pn

progress = pn.widgets.indicators.Progress(active=False)
progress.servable()
```

## Background

I think the "non-active" look is not nice. And it is something that will catch the eye of the user instead of the button, plot or slider she should initially interact with.

## Hack

This code will give the desired initial look

```python
import panel as pn

progress = pn.widgets.indicators.Progress(value=1, max=1000000, active=False)
progress.servable()
```

## Solution

I don't know. Maybe it's just the hack.


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
@@ -122,10 +122,10 @@ class Progress(ValueIndicator):
 
     max = param.Integer(default=100, doc="The maximum value of the progress bar.")
 
-    value = param.Integer(default=None, bounds=(0, None), doc="""
+    value = param.Integer(default=None, bounds=(-1, None), doc="""
         The current value of the progress bar. If set to None the progress
         bar will be indeterminate and animate depending on the active
-        parameter.""")
+        parameter. If set to -1 the progress bar will be empty.""")
 
     _rename = {'name': None}
 
@@ -133,7 +133,7 @@ class Progress(ValueIndicator):
 
     @param.depends('max', watch=True)
     def _update_value_bounds(self):
-        self.param.value.bounds = (0, self.max)
+        self.param.value.bounds = (-1, self.max)
 
     def __init__(self,**params):
         super().__init__(**params)


Test patch:
diff --git a/panel/tests/widgets/test_misc.py b/panel/tests/widgets/test_misc.py
--- a/panel/tests/widgets/test_misc.py
+++ b/panel/tests/widgets/test_misc.py
@@ -41,7 +41,7 @@ def test_audio_url(document, comm):
 def test_progress_bounds():
     progress = Progress()
     progress.max = 200
-    assert progress.param.value.bounds == (0, 200)
+    assert progress.param.value.bounds == (-1, 200)
     progress.value = 120
     assert progress.value == 120
Repository: holoviz/panel

Issue:
Quote conversion in JSON pane breaks valid JSON content
The Javascript code for the JSON pane blindly replaces all single quotes with double quotes, presumably to convert Python single quoted strings to standard JSON double quoted strings. 

https://github.com/holoviz/panel/blob/3fdfa3248d1bd838fee88af6a277bf94eeaad87a/panel/models/json.ts#L17

However, it is perfectly legal to have single quotes inside of JSON string values, so this will turn correctly encoded JSON string into invalid JSON.

![Screen Shot 2020-11-20 at 7 02 53 PM](https://user-images.githubusercontent.com/7408243/99861092-12142980-2b63-11eb-94a3-b21fbadaee82.png)

The simplest fix would simply be to remove the quote conversion hack. Otherwise, you are going to need to be smart enough to only convert quotes that are not inside of strings.




Discussion:
The only workaround I can think of in the meantime is to pass in an already encoded string with single quotes replaced by `\u0027`:

```python
pn.pane.JSON(object="""["can\\u0027t show this"]""")
```

Resolving patch:
diff --git a/panel/pane/markup.py b/panel/pane/markup.py
--- a/panel/pane/markup.py
+++ b/panel/pane/markup.py
@@ -338,10 +338,11 @@ def applies(cls, obj, **params):
 
     def _get_properties(self):
         properties = super()._get_properties()
-        if isinstance(self.object, string_types):
-            text = self.object
-        else:
-            text = json.dumps(self.object or {}, cls=self.encoder)
+        try:
+            data = json.loads(self.object)
+        except Exception:
+            data = self.object
+        text = json.dumps(data or {}, cls=self.encoder)
         depth = None if self.depth < 0 else self.depth
         return dict(text=text, theme=self.theme, depth=depth,
                     hover_preview=self.hover_preview, **properties)


Test patch:
diff --git a/panel/tests/pane/test_markup.py b/panel/tests/pane/test_markup.py
--- a/panel/tests/pane/test_markup.py
+++ b/panel/tests/pane/test_markup.py
@@ -205,6 +205,22 @@ def test_json_pane(document, comm):
     assert model.text == '{"b": 3}'
     assert pane._models[model.ref['id']][0] is model
 
+    pane.object = {"test": "can't show this"}
+    assert model.text == '{"test": "can\'t show this"}'
+    assert pane._models[model.ref['id']][0] is model
+
+    pane.object = ["can't show this"]
+    assert model.text == '["can\'t show this"]'
+    assert pane._models[model.ref['id']][0] is model
+
+    pane.object = "can't show this"
+    assert model.text == '"can\'t show this"'
+    assert pane._models[model.ref['id']][0] is model
+
+    pane.object = "can show this"
+    assert model.text == '"can show this"'
+    assert pane._models[model.ref['id']][0] is model
+
     # Cleanup
     pane._cleanup(model)
     assert pane._models == {}
Repository: holoviz/panel

Issue:
panel serve --autoreload does not work consistently with imported modules
#### ALL software version info

- python: 3.9.2
    - holoviews: 1.14.4
    - jupyter_bokeh: 3.0.2
    - ipython 7.22.0
    - jupyterlab: 3.0.16
    - pyviz-comms: 2.0.1

- MacOS: 11.4

- VSCode Insiders: 
    - Version: 1.59.0-insider
    - Commit: f6df685c62da50886f7540cbf768ed4333d58bea
    - Date: 2021-07-13T05:15:28.368Z
    - Electron: 12.0.13
    - Chrome: 89.0.4389.128
    - Node.js: 14.16.0
    - V8: 8.9.255.25-electron.0
    - OS: Darwin x64 20.5.0

#### Description of expected behavior and the observed behavior

`panel --autoreload` does not trigger a reload when saving changes to an imported module.

However, if I first save the actual served module (triggering a reload), *then* subsequent saves of imported modules will also trigger reloads. It's as if the "registry" of imports is not populated when you first start serving, and only becomes populated after the first reload.

#### Complete, minimal, self-contained example code that reproduces the issue

```
# test_panel.py
import holoviews as hv
import panel as pn

data = [('a', 10), ('b', 7)]
def test():
    return pn.panel(hv.Bars(data))

# test.py
import test_panel
test_panel.test().servable()
```

Try `panel serve --autoreload` with `test.py`. While serving, change the data values in `test_panel.py` and save. No reload.

Try the same thing again, but this time save `test.py` immediately after you begin serving (you don't have to change anytime, just save it to trigger a server reload). Now if you change the values in `test_panel.py`, it will reload.


Discussion:

Resolving patch:
diff --git a/panel/io/reload.py b/panel/io/reload.py
--- a/panel/io/reload.py
+++ b/panel/io/reload.py
@@ -113,11 +113,12 @@ def _reload(module=None):
     if module is not None:
         for module in _modules:
             del sys.modules[module]
-    if state.curdoc in _callbacks:
-        _callbacks[state.curdoc].stop()
-        del _callbacks[state.curdoc]
-    if state.location:
-        state.location.reload = True
+    for cb in _callbacks.values():
+        cb.stop()
+    _callbacks.clear()
+    state.location.reload = True
+    for loc in state._locations.values():
+        loc.reload = True
 
 def _check_file(modify_times, path, module=None):
     try:


Test patch:
Repository: holoviz/panel

Issue:
TQDM.ipynb reference raises exception: AttributeError: Column.value property descriptor does not exist
I'm on Panel 0.12.0, Param 1.11.1, Bokeh: 2.3.3

If I run the TQDM.ipynb reference notebook top to bottom and click one of the buttons I get a `AttributeError: Column.value property descriptor does not exist` error.

![image](https://user-images.githubusercontent.com/42288570/126439660-554b5d01-57e6-481b-8069-0e3f689c9599.png)



Discussion:
You can replicate the problem using this simple script

```python
import time

import panel as pn

from panel.widgets import Tqdm

pn.extension()

tqdm = Tqdm()

def run_loop(*events, timeout=0.2):
    for i in tqdm(range(0,10), desc="My loop bar", leave=True, colour='#666666'):
        time.sleep(timeout)

run_loop(timeout=0.01)

button = pn.widgets.Button(name="Run Loop", button_type="success")
button.on_click(run_loop)
pn.Row(button, tqdm).servable()
```
I've tried to identify the cause and understand how to fix this without success.

I can see it tries to set the `value` on a `Column` which does not make sense. But why I don't understand. I suspect something changed in `reactive.py` since I implemented `TQDM` and tested. But I cannot find out what.

I will need your help @philippjfr to fix this.
Got a fix, will push out a 0.12.1 in the coming days.

Resolving patch:
diff --git a/panel/widgets/indicators.py b/panel/widgets/indicators.py
--- a/panel/widgets/indicators.py
+++ b/panel/widgets/indicators.py
@@ -749,6 +749,8 @@ class Tqdm(Indicator):
 
     _layouts = {Row: 'row', Column: 'column'}
 
+    _rename = {'value': None, 'min': None, 'max': None, 'text': None}
+
     def __init__(self, **params):
         layout = params.pop('layout', 'column')
         layout = self._layouts.get(layout, layout) 


Test patch:
Repository: holoviz/panel

Issue:
"packages" no longer supported in __js_require__
I just upgraded the `panel-highchart` extension to Panel 0.12.0. But I can see something changed.

![image](https://user-images.githubusercontent.com/42288570/126873135-60f4bf5c-7cb5-454b-9a0e-be836f97f8c4.png)

You can replicate this on Binder: https://mybinder.org/v2/gh/marcskovmadsen/panel-highcharts/6c10727?urlpath=lab/tree/examples/HighChart.ipynb

I believe the issue is that I "mock" Panel to be able to load the extension via `pn.extension('highchart')`. The mocking is done in https://github.com/MarcSkovMadsen/panel-highcharts/blob/6c107271a4902f7a8df0b87f3b7a9c81d58c1149/panel_highcharts/config.py

![image](https://user-images.githubusercontent.com/42288570/126873255-fbbfaf75-2afb-4d64-a715-a580e021b706.png)

This worked in Panel 0.11 but appearently not in Panel 0.12.

## Solution

Describe and support a way to develop and deploy Panel Extensions. Currently I have to investigate, do some mocking and then fix when mocking breaks in new versions.



Discussion:
If I disable the `_imports` above I don't get the error. But then again HighCharts is not loaded.

![image](https://user-images.githubusercontent.com/42288570/126873387-76eba19c-02bf-4121-90f2-fb5e7de14acf.png)

Ok. Adding the key `packages` to the `config` below removes the error in the cell. 

![image](https://user-images.githubusercontent.com/42288570/126876110-06f639dc-676e-4926-a392-e309fa8e7d50.png)

But then an error appears in the js console

![image](https://user-images.githubusercontent.com/42288570/126876130-6cfd21f1-81ac-48e1-b6df-829ef5b7a7bb.png)

![image](https://user-images.githubusercontent.com/42288570/126876153-2a225c6d-52da-4e1a-b09c-4ffa6ce5b18a.png)

If I change the "exports" from None to something random like below

![image](https://user-images.githubusercontent.com/42288570/126876365-3d893bec-7017-4b0c-a33e-3e8674ae1955.png)

it works.

![image](https://user-images.githubusercontent.com/42288570/126876372-a32ad5a9-8b33-47a1-ad65-3dd83e809716.png)

Then the question is then if an `exports` value of `None` should be supported or not. What do you think @philippjfr 

Resolving patch:
diff --git a/panel/io/notebook.py b/panel/io/notebook.py
--- a/panel/io/notebook.py
+++ b/panel/io/notebook.py
@@ -96,7 +96,7 @@ def push_notebook(*objs):
 NB_TEMPLATE_BASE = _env.get_template('nb_template.html')
 
 def _autoload_js(bundle, configs, requirements, exports, skip_imports, ipywidget, load_timeout=5000):
-    config = {'paths': {}, 'shim': {}}
+    config = {'packages': {}, 'paths': {}, 'shim': {}}
     for conf in configs:
         for key, c in conf.items():
             config[key].update(c)


Test patch:
Repository: holoviz/panel

Issue:
Change fast theme button color back to white
After upgrading to Panel 0.12.0 the fast theme button switched to the red color

![image](https://user-images.githubusercontent.com/42288570/128121534-ab72365c-9a3c-4db3-be02-9138fe2d0416.png)

I would propose switching it back to white because 1) It looks better 2) receives less attention 3) makes changing the style of the template easier.

With the white color it looks like

![image](https://user-images.githubusercontent.com/42288570/128121664-4bbc9029-da22-498f-b3ad-2a2adf2b66c2.png)


Discussion:

Resolving patch:
diff --git a/panel/template/fast/theme.py b/panel/template/fast/theme.py
--- a/panel/template/fast/theme.py
+++ b/panel/template/fast/theme.py
@@ -45,7 +45,7 @@ class FastStyle(param.Parameterized):
 
     header_background = param.String(default="#00aa41")
     header_neutral_color = param.String(default="#ffffff")
-    header_accent_base_color = param.String(default="#A01346")
+    header_accent_base_color = param.String(default="#ffffff")
     header_color = param.String(default="#ffffff")
     font = param.String(default="Open Sans, sans-serif")
     font_url = param.String(default=FONT_URL)


Test patch:
Repository: holoviz/panel

Issue:
--autoreload raises AttributeError: 'NoneType' object has no attribute 'stop'
I'm on the current Panel master. When I `panel serve 'script.py' --autoreload` this code

```python
import panel as pn
pn.extension()

import numpy as np
import holoviews as hv

from holoviews import opts, streams
from holoviews.plotting.links import DataLink

hv.extension('bokeh')
curve = hv.Curve(np.random.randn(10).cumsum()).opts(responsive=True, line_width=6)
table = hv.Table(curve).opts(editable=True)
component=pn.pane.HoloViews(table, height=500, sizing_mode="stretch_both")
pn.template.FastListTemplate(title="Table", main=[component]).servable()
```

and change the code I get the error

```bash
2021-08-04 06:40:44,760 Error thrown from periodic callback:
2021-08-04 06:40:44,763 Traceback (most recent call last):
  File "c:\repos\private\panel_docker\panel\.venv\lib\site-packages\tornado\gen.py", line 526, in callback
    result_list.append(f.result())
  File "c:\repos\private\panel_docker\panel\.venv\lib\site-packages\bokeh\server\session.py", line 67, in _needs_document_lock_wrapper
    result = func(self, *args, **kwargs)
  File "c:\repos\private\panel_docker\panel\.venv\lib\site-packages\bokeh\server\session.py", line 195, in with_document_locked
    return func(*args, **kwargs)
  File "c:\repos\private\panel_docker\panel\.venv\lib\site-packages\bokeh\document\document.py", line 1212, in wrapper
    return doc._with_self_as_curdoc(invoke)
  File "c:\repos\private\panel_docker\panel\.venv\lib\site-packages\bokeh\document\document.py", line 1198, in _with_self_as_curdoc
    return f()
  File "c:\repos\private\panel_docker\panel\.venv\lib\site-packages\bokeh\document\document.py", line 1211, in invoke
    return f(*args, **kwargs)
  File "c:\repos\private\panel_docker\panel\panel\io\callbacks.py", line 72, in _periodic_callback
    self.callback()
  File "c:\repos\private\panel_docker\panel\panel\io\reload.py", line 155, in _reload_on_update
    _check_file(modify_times, path)
  File "c:\repos\private\panel_docker\panel\panel\io\reload.py", line 134, in _check_file
    _reload(module)
  File "c:\repos\private\panel_docker\panel\panel\io\reload.py", line 117, in _reload
    cb.stop()
  File "c:\repos\private\panel_docker\panel\panel\io\callbacks.py", line 134, in stop
    self._cb.stop()
AttributeError: 'NoneType' object has no attribute 'stop'
```

I believe this is would be a major issue if 0.12.1 was released before fixing this @philippjfr 


Discussion:

Resolving patch:
diff --git a/panel/io/callbacks.py b/panel/io/callbacks.py
--- a/panel/io/callbacks.py
+++ b/panel/io/callbacks.py
@@ -130,7 +130,7 @@ def stop(self):
         self._timeout = None
         if self._doc:
             self._doc.remove_periodic_callback(self._cb)
-        else:
+        elif self._cb:
             self._cb.stop()
         self._cb = None
         doc = self._doc or _curdoc()


Test patch:
Repository: holoviz/panel

Issue:
Sync location does not work with checkbox
#### ALL software version info
(this library, plus any other relevant software, e.g. bokeh, python, notebook, OS, browser, etc)
``` yaml
panel	0.13.0a5.post8+g80a66c3f
bokeh	2.4.0
OS	Windows	10
```

#### Description of expected behavior and the observed behavior
The sync location does not work when using a checkbox. 

I would gladly help solving the problem but I need a small hint of where in the code to look. 

#### Complete, minimal, self-contained example code that reproduces the issue

``` python
import panel as pn

box = pn.widgets.Checkbox(value=False)
pn.state.location.sync(box)
box.servable()

```

#### Screenshots or screencasts of the bug in action
![image](https://user-images.githubusercontent.com/19758978/133932091-54993b9b-3c2d-488d-9601-a95af14e90ca.png)



Discussion:

Resolving patch:
diff --git a/panel/util.py b/panel/util.py
--- a/panel/util.py
+++ b/panel/util.py
@@ -295,6 +295,8 @@ def parse_query(query):
             query[k] = float(v)
         elif v.startswith('[') or v.startswith('{'):
             query[k] = json.loads(v)
+        elif v.lower() in ("true", "false"):
+            query[k] = v.lower() == "true"
     return query
 
 


Test patch:
diff --git a/panel/tests/test_util.py b/panel/tests/test_util.py
--- a/panel/tests/test_util.py
+++ b/panel/tests/test_util.py
@@ -4,7 +4,7 @@
 
 from panel.io.notebook import render_mimebundle
 from panel.pane import PaneBase
-from panel.util import get_method_owner, abbreviated_repr
+from panel.util import get_method_owner, abbreviated_repr, parse_query
 
 
 def test_get_method_owner_class():
@@ -37,3 +37,15 @@ def test_abbreviated_repr_list():
 def test_abbreviated_repr_ordereddict():
     assert (abbreviated_repr(OrderedDict([('key', 'some really, really long string')]))
             == "OrderedDict([('key', ...])")
+
+
+def test_parse_query():
+    query = '?bool=true&int=2&float=3.0&json=["a"%2C+"b"]'
+    expected_results = {
+        "bool": True,
+        "int": 2,
+        "float": 3.0,
+        "json": ["a", "b"],
+    }
+    results = parse_query(query)
+    assert expected_results == results
Repository: holoviz/panel

Issue:
Support pn.serve for pn.viewable.Viewer class
#### Is your feature request related to a problem? Please describe.
I want to be able to run `pn.viewable.Viewer` directly with `pn.serve` like:

``` python
import panel as pn


class Location(pn.viewable.Viewer):
    def __panel__(self):
        return pn.pane.Markdown("# Test")


pn.serve(Location, port=5007)
```

But it is not possible right now and I, therefore, need to run something like this instead of:
``` python
import panel as pn


class Location(pn.viewable.Viewer):
    def __panel__(self):
        return pn.pane.Markdown("# Test")


def location():
    return Location().__panel__()


pn.serve(location, port=5007)
```



Discussion:

Resolving patch:
diff --git a/panel/pane/base.py b/panel/pane/base.py
--- a/panel/pane/base.py
+++ b/panel/pane/base.py
@@ -13,7 +13,7 @@
 from ..links import Link
 from ..models import ReactiveHTML as _BkReactiveHTML
 from ..reactive import Reactive
-from ..viewable import Layoutable, Viewable
+from ..viewable import Layoutable, Viewable, Viewer
 from ..util import param_reprs
 
 
@@ -46,6 +46,8 @@ def panel(obj, **kwargs):
     if isinstance(obj, Viewable):
         return obj
     elif hasattr(obj, '__panel__'):
+        if not isinstance(obj, Viewer) and issubclass(obj, Viewer):
+            return panel(obj().__panel__())
         return panel(obj.__panel__())
     if kwargs.get('name', False) is None:
         kwargs.pop('name')


Test patch:
diff --git a/panel/tests/test_viewable.py b/panel/tests/test_viewable.py
--- a/panel/tests/test_viewable.py
+++ b/panel/tests/test_viewable.py
@@ -3,8 +3,8 @@
 
 from panel import config
 from panel.interact import interactive
-from panel.pane import Str
-from panel.viewable import Viewable
+from panel.pane import Str, panel
+from panel.viewable import Viewable, Viewer
 
 from .util import jb_available, py3_only
 
@@ -27,3 +27,16 @@ def test_viewable_signature(viewable):
     parameters = signature(viewable).parameters
     assert 'params' in parameters
     assert parameters['params'] == Parameter('params', Parameter.VAR_KEYWORD)
+
+
+def test_Viewer_not_initialized():
+    class Test(Viewer):
+        def __panel__(self):
+            return "# Test"
+
+    test = panel(Test)
+    assert test.object == "# Test"
+
+    # Confirm that initialized also work
+    test = panel(Test())
+    assert test.object == "# Test"