Skip to content

Commit 26b0500

Browse files
param update
1 parent 32268d6 commit 26b0500

10 files changed

Lines changed: 37 additions & 17 deletions

File tree

pyproject.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,16 @@ python_version = '3.11'
189189
no_implicit_optional = true
190190
check_untyped_defs = true
191191

192+
# The apps/ package contains demo/dev Panel tools built on param.Parameterized.
193+
# param 2.4.0 ships inline type hints that turn Parameter objects into generic
194+
# descriptors (param#1147). For these demo apps that produces noise:
195+
# - assignment: reassigning an inherited Boolean param at class level
196+
# (e.g. ``pn.pane.Markdown.disable_anchors = True``) now mismatches Boolean[bool]
197+
# These are silenced only here; union-attr and other checks stay enabled.
198+
[[tool.mypy.overrides]]
199+
module = "holoviz_mcp.apps.*"
200+
disable_error_code = ["assignment"]
201+
192202
[tool.hatch.build.targets.wheel.force-include]
193203
"skills" = "holoviz_mcp/skills"
194204

src/holoviz_mcp/apps/configuration_viewer.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"""
99

1010
import json
11+
from typing import Literal
1112

1213
import panel as pn
1314
import panel_material_ui as pmui
@@ -31,7 +32,9 @@ class ConfigViewer(param.Parameterized):
3132
- Supports dark and light themes
3233
"""
3334

34-
config_source = param.Selector(objects=["Combined", "Default", "User"], default="Combined", doc="Which configuration to show")
35+
config_source: Literal["Combined", "Default", "User"] = param.Selector(
36+
objects=["Combined", "Default", "User"], default="Combined", doc="Which configuration to show"
37+
)
3538
dark_theme = param.Boolean(default=False, doc="Use dark theme for the JSON editor", allow_refs=True)
3639

3740
def __init__(self, **params):

src/holoviz_mcp/apps/hv_get.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
"""An app to retrieve HoloViews element documentation via the hv_get tool."""
22

3+
from typing import Literal
4+
35
import panel as pn
46
import panel_material_ui as pmui
57
import param
@@ -36,8 +38,8 @@
3638
class GetDocstringConfiguration(param.Parameterized):
3739
"""Configuration for the HoloViews get_docstring tool."""
3840

39-
element = param.Selector(default="", objects=[""], label="Element")
40-
backend = param.Selector(default="bokeh", objects=["bokeh", "matplotlib", "plotly"], label="Backend")
41+
element: str = param.Selector(default="", objects=[""], label="Element")
42+
backend: Literal["bokeh", "matplotlib", "plotly"] = param.Selector(default="bokeh", objects=["bokeh", "matplotlib", "plotly"], label="Backend")
4143

4244
result = param.String(default="", doc="Docstring result")
4345
loading = param.Boolean(default=False, doc="Loading state")

src/holoviz_mcp/apps/hvplot_get.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@
5858
class GetDocstringConfiguration(param.Parameterized):
5959
"""Configuration for hvPlot hvplot_get tool."""
6060

61-
plot_type = param.Selector(default="line", objects=["line"], label="Plot Type")
61+
plot_type: str = param.Selector(default="line", objects=["line"], label="Plot Type")
6262
docstring = param.Boolean(default=True, label="Include Docstring")
6363
generic = param.Boolean(default=True, label="Include Generic Options")
64-
style = param.Selector(default=True, objects=[True, "matplotlib", "bokeh", "plotly"], label="Style Backend")
64+
style: bool | str = param.Selector(default=True, objects=[True, "matplotlib", "bokeh", "plotly"], label="Style Backend")
6565

6666
result = param.String(default="", doc="Docstring result")
6767
loading = param.Boolean(default=False, doc="Loading state")

src/holoviz_mcp/apps/pn_get.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class GetComponentConfiguration(param.Parameterized):
8080

8181
component_name = param.String(default="Button", label="Component Name")
8282
module_path = param.String(default="", label="Module Path")
83-
package = param.Selector(default="panel", objects=[ALL, "panel"], label="Package")
83+
package: str = param.Selector(default="panel", objects=[ALL, "panel"], label="Package")
8484

8585
get_component = param.Event(label="Get Component")
8686

src/holoviz_mcp/apps/pn_list.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@ class ListComponentsConfiguration(param.Parameterized):
6060

6161
component_name = param.String(default="Button", label="Component Name")
6262
module_path = param.String(default="", label="Module Path")
63-
package = param.Selector(default=ALL, objects=[ALL], label="Package")
63+
package: str = param.Selector(default=ALL, objects=[ALL], label="Package")
6464

6565
list_components = param.Event(label="List Components")
6666

67-
results = param.List(default=[], doc="List results")
67+
results: list = param.List(default=[], doc="List results")
6868
loading = param.Boolean(default=False, doc="Loading state")
6969
error_message = param.String(default="", doc="Error message if listing fails")
7070

@@ -118,7 +118,7 @@ async def _update_results(self):
118118
class ComponentsListViewer(pn.viewable.Viewer):
119119
"""Viewer for displaying component list as a table."""
120120

121-
results = param.List(default=[], allow_refs=True, doc="List of components")
121+
results: list = param.List(default=[], allow_refs=True, doc="List of components")
122122

123123
data = param.DataFrame(doc="DataFrame of components")
124124

src/holoviz_mcp/apps/pn_params.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ class GetComponentParametersConfiguration(param.Parameterized):
9696

9797
component_name = param.String(default="Button", label="Component Name")
9898
module_path = param.String(default="", label="Module Path")
99-
package = param.Selector(default="panel", objects=[ALL, "panel"], label="Package")
99+
package: str = param.Selector(default="panel", objects=[ALL, "panel"], label="Package")
100100

101101
get_parameters = param.Event(label="Get Parameters")
102102

src/holoviz_mcp/apps/pn_search.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@ class SearchConfiguration(param.Parameterized):
5353
"""Configuration for Panel component search tool."""
5454

5555
query = param.String(default="Button", label="Search Query")
56-
package = param.Selector(default=ALL, objects=[ALL], label="Package")
56+
package: str = param.Selector(default=ALL, objects=[ALL], label="Package")
5757
limit = param.Integer(default=10, bounds=(1, 50), label="Max Results")
5858

5959
search = param.Event(label="Search")
6060

61-
results = param.List(default=[], doc="Search results")
61+
results: list = param.List(default=[], doc="Search results")
6262
loading = param.Boolean(default=False, doc="Loading state")
6363
error_message = param.String(default="", doc="Error message if search fails")
6464

@@ -114,7 +114,7 @@ async def _update_results(self):
114114
class SearchResultsViewer(pn.viewable.Viewer):
115115
"""Viewer for displaying search results as a menu list."""
116116

117-
results = param.List(default=[], allow_refs=True, doc="List of search results")
117+
results: list = param.List(default=[], allow_refs=True, doc="List of search results")
118118

119119
data = param.DataFrame(doc="DataFrame of search results")
120120

src/holoviz_mcp/apps/search.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
"""A search application for exploring the HoloViz MCP search tool."""
22

3+
from typing import Literal
4+
35
import panel as pn
46
import panel_material_ui as pmui
57
import param
@@ -99,15 +101,15 @@ class SearchConfiguration(param.Parameterized):
99101

100102
query = param.String(default="What is HoloViz?", doc="Search text for semantic similarity search across the documentation")
101103

102-
project = param.Selector(
104+
project: str = param.Selector(
103105
default=ALL,
104106
objects=[ALL, "panel", "hvplot", "datashader", "holoviews", "geoviews", "param", "colorcet", "holoviz"],
105107
doc="Filter results to a specific project. Select 'all' for all projects.",
106108
)
107109

108110
max_results = param.Integer(default=5, bounds=(1, 50), doc="Maximum number of search results to return")
109111

110-
content = param.Selector(
112+
content: Literal["truncated", "chunk", "full", "none"] = param.Selector(
111113
default="truncated",
112114
objects=["truncated", "chunk", "full", "none"],
113115
doc='Controls what content is returned. "truncated": full doc smart-truncated around query keywords (default). '
@@ -293,7 +295,10 @@ class SearchApp(pn.viewable.Viewer):
293295
"""
294296

295297
title = param.String(default="HoloViz MCP - search Tool Demo", doc="Title of the search app")
296-
config = param.ClassSelector(class_=SearchConfiguration, doc="Configuration for the search app")
298+
# Annotated as non-optional (always set in __init__) so param 2.4.0's generic
299+
# ClassSelector descriptor does not infer ``SearchConfiguration | None`` and
300+
# trigger union-attr errors on ``self.config.param``.
301+
config: SearchConfiguration = param.ClassSelector(class_=SearchConfiguration, doc="Configuration for the search app")
297302

298303
def __init__(self, **params):
299304
"""Initialize the SearchApp with default configuration."""

src/holoviz_mcp/apps/skill_get.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class SkillConfiguration(param.Parameterized):
5454
Parameters correspond to the skill selection for viewing skills.
5555
"""
5656

57-
skill = param.Selector(
57+
skill: str | None = param.Selector(
5858
default=None,
5959
objects=[],
6060
doc="Select a skill to view its details",

0 commit comments

Comments
 (0)