Skip to content

Commit 69ea9ef

Browse files
committed
Deprecation warning
1 parent 91c93ee commit 69ea9ef

File tree

2 files changed

+56
-22
lines changed

2 files changed

+56
-22
lines changed

chatkit/actions.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from typing import Any, Generic, Literal, TypeVar, get_args, get_origin
44

55
from pydantic import BaseModel, Field
6+
from typing_extensions import deprecated
67

78
Handler = Literal["client", "server"]
89
LoadingBehavior = Literal["auto", "none", "self", "container"]
@@ -11,6 +12,12 @@
1112
DEFAULT_LOADING_BEHAVIOR: LoadingBehavior = "auto"
1213

1314

15+
direct_usage_of_action_classes_deprecated = deprecated(
16+
"Direct usage of Action classes are deprecated; use WidgetTemplate to build widgets from .widget files/definitions instead."
17+
)
18+
19+
20+
@direct_usage_of_action_classes_deprecated
1421
class ActionConfig(BaseModel):
1522
type: str
1623
payload: Any = None
@@ -22,6 +29,7 @@ class ActionConfig(BaseModel):
2229
TPayload = TypeVar("TPayload")
2330

2431

32+
@direct_usage_of_action_classes_deprecated
2533
class Action(BaseModel, Generic[TType, TPayload]):
2634
type: TType = Field(default=TType, frozen=True) # pyright: ignore
2735
payload: TPayload = None # pyright: ignore - default to None to allow no-payload actions

0 commit comments

Comments
 (0)