-
-
Notifications
You must be signed in to change notification settings - Fork 520
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
TypeError: Design._apply_hooks() missing 1 required positional argument: 'changed' #7438
Comments
Same issue with a Xarray -> Matplotlib Panel param.Parameterized app |
I see this often across many complicated apps. |
I'd really need a reproducible example here. The problem is that there's likely some other error that's being masked here, specifically we try both signatures, and it seems like some other try:
hook(self, root, changed, old_models)
except TypeError:
hook(self, root) |
What we could do is actually inspecting the signature instead of |
Tried to create an MRE but can't quite get the error, anyways here is the analogue scatfold app that does not show the error in case someone can tweak it to produce it. import json
from datetime import datetime, timedelta
from pathlib import Path
from typing import List
from warnings import filterwarnings
import cartopy.crs as ccrs
import cartopy.feature as cf
import fstd2nc
import geoviews as gv
import matplotlib.pyplot as plt
import numpy as np
import panel as pn
import param
import utils
import xarray as xr
from fstd2nc.extra import get_crs
import hvplot.xarray
filterwarnings("ignore")
pn.extension(sizing_mode="stretch_width")
with open("domains.json", "r") as json_file:
DOMAINS = json.load(json_file)
class MRE(param.Parameterized):
def __init__(self):
self.loc_widg = pn.widgets.RadioButtonGroup(
name="Region",
options=DOMAINS,
orientation="vertical",
button_style="outline",
button_type="primary",
)
self.ds = xr.tutorial.open_dataset('air_temperature')['air'].isel(time=0)
self.ds = self.ds.assign_coords(lon=(self.ds.lon - 360))
# Initializes the pn.Row where the map will be displayed
self.col = pn.Column("init")
self._display("init")
self.loc_widg.param.watch(self._display, "value")
@pn.cache
def _matplotlib(
self, location: List[float], **kwargs
) -> plt.Figure:
air_temp = self.ds.sel(lon=slice(location[0],location[1]), lat=slice(location[3],location[2]))
fig, ax = plt.subplots(figsize=(24, 24))
plot = air_temp.plot(
ax=ax,
cmap="coolwarm",
cbar_kwargs={
"label": "Air Temperature (K)",
"fraction": 0.02,
"pad": 0.04,
},
)
plt.title(f"Air Temperature within the specified domain", fontsize=10)
plt.close(fig)
return fig
def _display(self, event: str):
self.col[0] = pn.pane.Matplotlib(
self._matplotlib(
self.loc_widg.value
),
format="svg",
tight=True,
fixed_aspect=True,
sizing_mode="stretch_both",
)
app = MRE()
template = pn.template.MaterialTemplate(
logo="https://www.canada.ca/etc/designs/canada/wet-boew/assets/sig-blk-en.svg",
site="CMC",
title="MRE",
sidebar=[ "Region:", app.loc_widg],
main=[app.col],
sidebar_width=300,
).servable() |
panel==1.5.3
I've started seeing
TypeError: Design._apply_hooks() missing 1 required positional argument: 'changed'
when I start my Panel apps.It seems
Design._apply_hooks()
does not allow providing onlyself
androot
.Logs
Minimum reproducible example coming later. But I included ChatInterface with openai in my app and that triggered it.
The text was updated successfully, but these errors were encountered: