@alloy-js/python 0.2.0-dev.2 → 0.2.0-dev.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (209) hide show
  1. package/dist/src/builtins/python.d.ts +3 -0
  2. package/dist/src/builtins/python.d.ts.map +1 -1
  3. package/dist/src/builtins/python.js +6 -0
  4. package/dist/src/builtins/python.js.map +1 -1
  5. package/dist/src/components/CallSignature.d.ts +4 -15
  6. package/dist/src/components/CallSignature.d.ts.map +1 -1
  7. package/dist/src/components/CallSignature.js +13 -67
  8. package/dist/src/components/CallSignature.js.map +1 -1
  9. package/dist/src/components/ClassMethodDeclaration.d.ts +22 -0
  10. package/dist/src/components/ClassMethodDeclaration.d.ts.map +1 -0
  11. package/dist/src/components/ClassMethodDeclaration.js +32 -0
  12. package/dist/src/components/ClassMethodDeclaration.js.map +1 -0
  13. package/dist/src/components/ConstructorDeclaration.d.ts +21 -0
  14. package/dist/src/components/ConstructorDeclaration.d.ts.map +1 -0
  15. package/dist/src/components/ConstructorDeclaration.js +35 -0
  16. package/dist/src/components/ConstructorDeclaration.js.map +1 -0
  17. package/dist/src/components/DunderMethodDeclaration.d.ts +21 -0
  18. package/dist/src/components/DunderMethodDeclaration.d.ts.map +1 -0
  19. package/dist/src/components/DunderMethodDeclaration.js +29 -0
  20. package/dist/src/components/DunderMethodDeclaration.js.map +1 -0
  21. package/dist/src/components/EnumDeclaration.d.ts +11 -32
  22. package/dist/src/components/EnumDeclaration.d.ts.map +1 -1
  23. package/dist/src/components/EnumDeclaration.js +10 -48
  24. package/dist/src/components/EnumDeclaration.js.map +1 -1
  25. package/dist/src/components/EnumMember.js +3 -3
  26. package/dist/src/components/EnumMember.js.map +1 -1
  27. package/dist/src/components/FunctionBase.d.ts +48 -0
  28. package/dist/src/components/FunctionBase.d.ts.map +1 -0
  29. package/dist/src/components/FunctionBase.js +91 -0
  30. package/dist/src/components/FunctionBase.js.map +1 -0
  31. package/dist/src/components/FunctionDeclaration.d.ts +11 -31
  32. package/dist/src/components/FunctionDeclaration.d.ts.map +1 -1
  33. package/dist/src/components/FunctionDeclaration.js +22 -79
  34. package/dist/src/components/FunctionDeclaration.js.map +1 -1
  35. package/dist/src/components/MemberExpression.d.ts.map +1 -1
  36. package/dist/src/components/MemberExpression.js +12 -13
  37. package/dist/src/components/MemberExpression.js.map +1 -1
  38. package/dist/src/components/MethodBase.d.ts +29 -0
  39. package/dist/src/components/MethodBase.d.ts.map +1 -0
  40. package/dist/src/components/MethodBase.js +32 -0
  41. package/dist/src/components/MethodBase.js.map +1 -0
  42. package/dist/src/components/MethodDeclaration.d.ts +22 -0
  43. package/dist/src/components/MethodDeclaration.d.ts.map +1 -0
  44. package/dist/src/components/MethodDeclaration.js +34 -0
  45. package/dist/src/components/MethodDeclaration.js.map +1 -0
  46. package/dist/src/components/PropertyDeclaration.d.ts +71 -0
  47. package/dist/src/components/PropertyDeclaration.d.ts.map +1 -0
  48. package/dist/src/components/PropertyDeclaration.js +227 -0
  49. package/dist/src/components/PropertyDeclaration.js.map +1 -0
  50. package/dist/src/components/PyDoc.d.ts +107 -42
  51. package/dist/src/components/PyDoc.d.ts.map +1 -1
  52. package/dist/src/components/PyDoc.js +845 -181
  53. package/dist/src/components/PyDoc.js.map +1 -1
  54. package/dist/src/components/SourceFile.d.ts +24 -0
  55. package/dist/src/components/SourceFile.d.ts.map +1 -1
  56. package/dist/src/components/SourceFile.js +28 -1
  57. package/dist/src/components/SourceFile.js.map +1 -1
  58. package/dist/src/components/StaticMethodDeclaration.d.ts +22 -0
  59. package/dist/src/components/StaticMethodDeclaration.d.ts.map +1 -0
  60. package/dist/src/components/StaticMethodDeclaration.js +32 -0
  61. package/dist/src/components/StaticMethodDeclaration.js.map +1 -0
  62. package/dist/src/components/TypeArguments.d.ts +9 -0
  63. package/dist/src/components/TypeArguments.d.ts.map +1 -0
  64. package/dist/src/components/TypeArguments.js +18 -0
  65. package/dist/src/components/TypeArguments.js.map +1 -0
  66. package/dist/src/components/TypeReference.d.ts +14 -0
  67. package/dist/src/components/TypeReference.d.ts.map +1 -0
  68. package/dist/src/components/TypeReference.js +29 -0
  69. package/dist/src/components/TypeReference.js.map +1 -0
  70. package/dist/src/components/UnionTypeExpression.d.ts +1 -2
  71. package/dist/src/components/UnionTypeExpression.d.ts.map +1 -1
  72. package/dist/src/components/UnionTypeExpression.js +3 -11
  73. package/dist/src/components/UnionTypeExpression.js.map +1 -1
  74. package/dist/src/components/VariableDeclaration.d.ts.map +1 -1
  75. package/dist/src/components/VariableDeclaration.js +3 -3
  76. package/dist/src/components/VariableDeclaration.js.map +1 -1
  77. package/dist/src/components/index.d.ts +10 -0
  78. package/dist/src/components/index.d.ts.map +1 -1
  79. package/dist/src/components/index.js +9 -0
  80. package/dist/src/components/index.js.map +1 -1
  81. package/dist/src/parameter-descriptor.d.ts +1 -4
  82. package/dist/src/parameter-descriptor.d.ts.map +1 -1
  83. package/dist/src/parameter-descriptor.js +7 -1
  84. package/dist/src/parameter-descriptor.js.map +1 -1
  85. package/dist/src/symbol-creation.d.ts +4 -0
  86. package/dist/src/symbol-creation.d.ts.map +1 -1
  87. package/dist/src/symbol-creation.js +12 -0
  88. package/dist/src/symbol-creation.js.map +1 -1
  89. package/dist/src/symbols/factories.d.ts +15 -0
  90. package/dist/src/symbols/factories.d.ts.map +1 -0
  91. package/dist/src/symbols/factories.js +28 -0
  92. package/dist/src/symbols/factories.js.map +1 -0
  93. package/dist/src/symbols/index.d.ts +1 -0
  94. package/dist/src/symbols/index.d.ts.map +1 -1
  95. package/dist/src/symbols/index.js +1 -0
  96. package/dist/src/symbols/index.js.map +1 -1
  97. package/dist/src/symbols/reference.d.ts +1 -1
  98. package/dist/src/symbols/reference.d.ts.map +1 -1
  99. package/dist/src/symbols/reference.js +1 -1
  100. package/dist/src/symbols/reference.js.map +1 -1
  101. package/dist/src/utils.d.ts.map +1 -1
  102. package/dist/src/utils.js +1 -1
  103. package/dist/src/utils.js.map +1 -1
  104. package/dist/test/callsignatures.test.js +42 -64
  105. package/dist/test/callsignatures.test.js.map +1 -1
  106. package/dist/test/class-method-declaration.test.d.ts +2 -0
  107. package/dist/test/class-method-declaration.test.d.ts.map +1 -0
  108. package/dist/test/class-method-declaration.test.js +61 -0
  109. package/dist/test/class-method-declaration.test.js.map +1 -0
  110. package/dist/test/classdeclarations.test.js +6 -8
  111. package/dist/test/classdeclarations.test.js.map +1 -1
  112. package/dist/test/constructordeclaration.test.d.ts +2 -0
  113. package/dist/test/constructordeclaration.test.d.ts.map +1 -0
  114. package/dist/test/constructordeclaration.test.js +58 -0
  115. package/dist/test/constructordeclaration.test.js.map +1 -0
  116. package/dist/test/dundermethoddeclaration.test.d.ts +2 -0
  117. package/dist/test/dundermethoddeclaration.test.d.ts.map +1 -0
  118. package/dist/test/dundermethoddeclaration.test.js +65 -0
  119. package/dist/test/dundermethoddeclaration.test.js.map +1 -0
  120. package/dist/test/enums.test.js +14 -16
  121. package/dist/test/enums.test.js.map +1 -1
  122. package/dist/test/externals.test.js +2 -4
  123. package/dist/test/externals.test.js.map +1 -1
  124. package/dist/test/factories.test.d.ts +2 -0
  125. package/dist/test/factories.test.d.ts.map +1 -0
  126. package/dist/test/factories.test.js +78 -0
  127. package/dist/test/factories.test.js.map +1 -0
  128. package/dist/test/functiondeclaration.test.js +213 -59
  129. package/dist/test/functiondeclaration.test.js.map +1 -1
  130. package/dist/test/memberexpressions.test.js +1 -1
  131. package/dist/test/memberexpressions.test.js.map +1 -1
  132. package/dist/test/methoddeclaration.test.d.ts +2 -0
  133. package/dist/test/methoddeclaration.test.d.ts.map +1 -0
  134. package/dist/test/methoddeclaration.test.js +239 -0
  135. package/dist/test/methoddeclaration.test.js.map +1 -0
  136. package/dist/test/namepolicies.test.js +1 -2
  137. package/dist/test/namepolicies.test.js.map +1 -1
  138. package/dist/test/propertydeclaration.test.d.ts +2 -0
  139. package/dist/test/propertydeclaration.test.d.ts.map +1 -0
  140. package/dist/test/propertydeclaration.test.js +229 -0
  141. package/dist/test/propertydeclaration.test.js.map +1 -0
  142. package/dist/test/pydocs.test.js +926 -126
  143. package/dist/test/pydocs.test.js.map +1 -1
  144. package/dist/test/references.test.js +1 -5
  145. package/dist/test/references.test.js.map +1 -1
  146. package/dist/test/sourcefiles.test.js +90 -1
  147. package/dist/test/sourcefiles.test.js.map +1 -1
  148. package/dist/test/staticmethoddeclaration.test.d.ts +2 -0
  149. package/dist/test/staticmethoddeclaration.test.d.ts.map +1 -0
  150. package/dist/test/staticmethoddeclaration.test.js +61 -0
  151. package/dist/test/staticmethoddeclaration.test.js.map +1 -0
  152. package/dist/test/typereference.test.d.ts +2 -0
  153. package/dist/test/typereference.test.d.ts.map +1 -0
  154. package/dist/test/typereference.test.js +51 -0
  155. package/dist/test/typereference.test.js.map +1 -0
  156. package/dist/test/uniontypeexpression.test.js +152 -15
  157. package/dist/test/uniontypeexpression.test.js.map +1 -1
  158. package/dist/test/variables.test.js +28 -19
  159. package/dist/test/variables.test.js.map +1 -1
  160. package/dist/tsconfig.tsbuildinfo +1 -1
  161. package/package.json +2 -2
  162. package/src/builtins/python.ts +7 -0
  163. package/src/components/CallSignature.tsx +17 -69
  164. package/src/components/ClassMethodDeclaration.tsx +34 -0
  165. package/src/components/ConstructorDeclaration.tsx +37 -0
  166. package/src/components/DunderMethodDeclaration.tsx +30 -0
  167. package/src/components/EnumDeclaration.tsx +16 -44
  168. package/src/components/EnumMember.tsx +3 -3
  169. package/src/components/FunctionBase.tsx +88 -0
  170. package/src/components/FunctionDeclaration.tsx +18 -82
  171. package/src/components/MemberExpression.tsx +6 -19
  172. package/src/components/MethodBase.tsx +53 -0
  173. package/src/components/MethodDeclaration.tsx +27 -0
  174. package/src/components/PropertyDeclaration.tsx +264 -0
  175. package/src/components/PyDoc.tsx +795 -195
  176. package/src/components/SourceFile.tsx +29 -0
  177. package/src/components/StaticMethodDeclaration.tsx +34 -0
  178. package/src/components/TypeArguments.tsx +24 -0
  179. package/src/components/TypeReference.tsx +33 -0
  180. package/src/components/UnionTypeExpression.tsx +4 -15
  181. package/src/components/VariableDeclaration.tsx +1 -3
  182. package/src/components/index.ts +10 -0
  183. package/src/parameter-descriptor.ts +6 -5
  184. package/src/symbol-creation.ts +17 -0
  185. package/src/symbols/factories.ts +39 -0
  186. package/src/symbols/index.ts +1 -0
  187. package/src/symbols/reference.tsx +3 -5
  188. package/src/utils.ts +0 -2
  189. package/temp/api.json +5281 -2273
  190. package/test/callsignatures.test.tsx +102 -74
  191. package/test/class-method-declaration.test.tsx +53 -0
  192. package/test/classdeclarations.test.tsx +7 -9
  193. package/test/constructordeclaration.test.tsx +48 -0
  194. package/test/dundermethoddeclaration.test.tsx +53 -0
  195. package/test/enums.test.tsx +14 -16
  196. package/test/externals.test.tsx +5 -7
  197. package/test/factories.test.tsx +72 -0
  198. package/test/functiondeclaration.test.tsx +196 -44
  199. package/test/memberexpressions.test.tsx +7 -2
  200. package/test/methoddeclaration.test.tsx +202 -0
  201. package/test/namepolicies.test.tsx +1 -2
  202. package/test/propertydeclaration.test.tsx +192 -0
  203. package/test/pydocs.test.tsx +1093 -129
  204. package/test/references.test.tsx +1 -1
  205. package/test/sourcefiles.test.tsx +100 -1
  206. package/test/staticmethoddeclaration.test.tsx +49 -0
  207. package/test/typereference.test.tsx +52 -0
  208. package/test/uniontypeexpression.test.tsx +169 -34
  209. package/test/variables.test.tsx +27 -16
@@ -0,0 +1,53 @@
1
+ import { abcModule } from "../builtins/python.js";
2
+ import {
3
+ BaseFunctionDeclaration,
4
+ BaseFunctionDeclarationProps,
5
+ CommonFunctionProps,
6
+ } from "./FunctionBase.js";
7
+
8
+ /**
9
+ * Shared base props for all method-like declarations.
10
+ */
11
+ export interface MethodDeclarationBaseProps extends CommonFunctionProps {
12
+ /** Indicates that the method is abstract. */
13
+ abstract?: boolean;
14
+ }
15
+
16
+ /**
17
+ * Internal base for method-like components.
18
+ *
19
+ * @remarks
20
+ * Applies `@abstractmethod` when requested and delegates to
21
+ * `BaseFunctionDeclaration` for the function/method body.
22
+ *
23
+ * @example
24
+ * ```tsx
25
+ * <MethodDeclarationBase name="do_work" functionType="instance">
26
+ * return 1
27
+ * </MethodDeclarationBase>
28
+ * ```
29
+ * Generates:
30
+ * ```python
31
+ * def do_work(self):
32
+ * return 1
33
+ * ```
34
+ */
35
+ export function MethodDeclarationBase(
36
+ props: MethodDeclarationBaseProps &
37
+ Pick<BaseFunctionDeclarationProps, "functionType" | "sym">,
38
+ ) {
39
+ const abstractMethod =
40
+ props.abstract ?
41
+ <>
42
+ @{abcModule["."].abstractmethod}
43
+ <hbr />
44
+ </>
45
+ : undefined;
46
+
47
+ return (
48
+ <>
49
+ {abstractMethod}
50
+ <BaseFunctionDeclaration {...props} />
51
+ </>
52
+ );
53
+ }
@@ -0,0 +1,27 @@
1
+ import { createMethodSymbol } from "../symbols/factories.js";
2
+ import type { MethodDeclarationBaseProps } from "./MethodBase.js";
3
+ import { MethodDeclarationBase } from "./MethodBase.js";
4
+
5
+ /**
6
+ * A Python instance method declaration component.
7
+ *
8
+ * @example
9
+ * ```tsx
10
+ * <py.MethodDeclaration name="do_work" parameters={[{ name: "value", type: "int" }]}>
11
+ * return value * 2
12
+ * </py.MethodDeclaration>
13
+ * ```
14
+ * Generates:
15
+ * ```python
16
+ * def do_work(self, value: int) -> None:
17
+ * return value * 2
18
+ * ```
19
+ *
20
+ * @remarks
21
+ * Automatically injects the `self` parameter for instance methods and enforces
22
+ * that the declaration appears within a class body.
23
+ */
24
+ export function MethodDeclaration(props: MethodDeclarationBaseProps) {
25
+ const sym = createMethodSymbol(props.name, { refkeys: props.refkey });
26
+ return <MethodDeclarationBase functionType="instance" {...props} sym={sym} />;
27
+ }
@@ -0,0 +1,264 @@
1
+ import {
2
+ Children,
3
+ DeclarationContext,
4
+ List,
5
+ Refkey,
6
+ Show,
7
+ childrenArray,
8
+ code,
9
+ createContext,
10
+ findKeyedChild,
11
+ findUnkeyedChildren,
12
+ taggedComponent,
13
+ useContext,
14
+ } from "@alloy-js/core";
15
+ import { PythonOutputSymbol } from "../index.js";
16
+ import { ParameterDescriptor } from "../parameter-descriptor.js";
17
+ import { createMethodSymbol } from "../symbols/factories.js";
18
+ import { Atom } from "./Atom.jsx";
19
+ import { CommonFunctionProps } from "./FunctionBase.js";
20
+ import { MethodDeclarationBase } from "./MethodBase.js";
21
+
22
+ const setterTag = Symbol();
23
+ const deleterTag = Symbol();
24
+
25
+ /** Context to provide property type information within a PropertyDeclaration */
26
+ const PropertyContext = createContext<Children | undefined>();
27
+
28
+ /**
29
+ * Declares a Python property with optional getter, setter, and deleter methods.
30
+ *
31
+ * @example
32
+ * ```tsx
33
+ * <py.PropertyDeclaration name="name" type={{ children: "str" }}>
34
+ * return self._name
35
+ * </py.PropertyDeclaration>
36
+ * ```
37
+ * Generates:
38
+ * ```python
39
+ * @property
40
+ * def name(self) -> str:
41
+ * return self._name
42
+ * ```
43
+ *
44
+ * @example Setter and deleter
45
+ * ```tsx
46
+ * <py.PropertyDeclaration name="value" type={{ children: "int" }}>
47
+ * return self._value
48
+ * <py.PropertyDeclaration.Setter type={{ children: "int" }}>
49
+ * self._value = value
50
+ * </py.PropertyDeclaration.Setter>
51
+ * <py.PropertyDeclaration.Deleter>
52
+ * del self._value
53
+ * </py.PropertyDeclaration.Deleter>
54
+ * </py.PropertyDeclaration>
55
+ * ```
56
+ * Generates:
57
+ * ```python
58
+ * @property
59
+ * def value(self) -> int:
60
+ * return self._value
61
+ *
62
+ * @value.setter
63
+ * def value(self, value: int) -> None:
64
+ * self._value = value
65
+ *
66
+ * @value.deleter
67
+ * def value(self) -> None:
68
+ * del self._value
69
+ * ```
70
+ *
71
+ * @remarks
72
+ * The property must be declared within a class. The getter method is
73
+ * automatically generated using the `@property` decorator. Use the nested
74
+ * `Setter` and `Deleter` components to add mutators.
75
+ */
76
+ export interface PropertyDeclarationProps {
77
+ name: string;
78
+ type?: Children;
79
+ children?: Children;
80
+ refkey?: Refkey;
81
+ abstract?: boolean;
82
+ doc?: Children;
83
+ }
84
+
85
+ export function PropertyDeclaration(props: PropertyDeclarationProps) {
86
+ const nonEmptyOrNotImplemented = (
87
+ children: Children | undefined,
88
+ ): Children => {
89
+ if (children && childrenArray(() => children).length > 0) {
90
+ return children;
91
+ } else {
92
+ return [code`raise NotImplementedError`];
93
+ }
94
+ };
95
+
96
+ const children = childrenArray(() => props.children);
97
+ const setterComponent =
98
+ findKeyedChild(children, PropertyDeclaration.Setter.tag) ?? undefined;
99
+ const deleterComponent =
100
+ findKeyedChild(children, PropertyDeclaration.Deleter.tag) ?? undefined;
101
+
102
+ const setterChildren = nonEmptyOrNotImplemented(
103
+ setterComponent?.props?.children,
104
+ );
105
+ const deleterChildren = nonEmptyOrNotImplemented(
106
+ deleterComponent?.props?.children,
107
+ );
108
+ const unkeyedChildren = nonEmptyOrNotImplemented(
109
+ findUnkeyedChildren(children),
110
+ );
111
+
112
+ const sym: PythonOutputSymbol = createMethodSymbol(props.name, {
113
+ refkeys: props.refkey,
114
+ });
115
+ return (
116
+ <>
117
+ <DeclarationContext.Provider value={sym}>
118
+ <PropertyContext.Provider value={props.type}>
119
+ <List hardline enderPunctuation>
120
+ <PropertyMethodDeclaration
121
+ abstract={props.abstract}
122
+ doc={props.doc}
123
+ >
124
+ {unkeyedChildren}
125
+ </PropertyMethodDeclaration>
126
+ <Show when={Boolean(setterComponent)}>
127
+ <PropertyDeclaration.Setter
128
+ {...setterComponent?.props}
129
+ type={setterComponent?.props?.type ?? props.type}
130
+ abstract={setterComponent?.props?.abstract ?? props.abstract}
131
+ >
132
+ {setterChildren}
133
+ </PropertyDeclaration.Setter>
134
+ </Show>
135
+ <Show when={Boolean(deleterComponent)}>
136
+ <PropertyDeclaration.Deleter
137
+ {...deleterComponent?.props}
138
+ abstract={deleterComponent?.props?.abstract ?? props.abstract}
139
+ >
140
+ {deleterChildren}
141
+ </PropertyDeclaration.Deleter>
142
+ </Show>
143
+ </List>
144
+ </PropertyContext.Provider>
145
+ </DeclarationContext.Provider>
146
+ </>
147
+ );
148
+ }
149
+
150
+ export interface PropertyMethodDeclarationProps
151
+ extends Omit<CommonFunctionProps, "name"> {
152
+ abstract?: boolean;
153
+ }
154
+
155
+ function PropertyMethodDeclaration(props: PropertyMethodDeclarationProps) {
156
+ const propertySymbol = useContext(DeclarationContext) as PythonOutputSymbol;
157
+ const propertyType = useContext(PropertyContext);
158
+
159
+ return (
160
+ <>
161
+ {code`@property`}
162
+ <hbr />
163
+ <MethodDeclarationBase
164
+ {...props}
165
+ name={propertySymbol.name}
166
+ functionType="instance"
167
+ returnType={propertyType}
168
+ sym={propertySymbol}
169
+ >
170
+ {props.children}
171
+ </MethodDeclarationBase>
172
+ </>
173
+ );
174
+ }
175
+
176
+ interface PropertyMethodBaseProps
177
+ extends Omit<PropertyMethodDeclarationProps, "name"> {
178
+ decoratorType: "setter" | "deleter";
179
+ parameters?: (ParameterDescriptor | string)[];
180
+ }
181
+
182
+ function PropertyMethodBase(props: PropertyMethodBaseProps) {
183
+ const propertySymbol = useContext(DeclarationContext) as PythonOutputSymbol;
184
+ const { decoratorType, parameters, children, ...restProps } = props;
185
+
186
+ return (
187
+ <>
188
+ {code`@${propertySymbol.name}.${decoratorType}`}
189
+ <hbr />
190
+ <MethodDeclarationBase
191
+ {...restProps}
192
+ name={propertySymbol.name}
193
+ functionType="instance"
194
+ parameters={parameters}
195
+ returnType={<Atom jsValue={null} />}
196
+ sym={propertySymbol}
197
+ >
198
+ {children}
199
+ </MethodDeclarationBase>
200
+ </>
201
+ );
202
+ }
203
+
204
+ /**
205
+ * Adds a setter to a `PropertyDeclaration`.
206
+ *
207
+ * @example
208
+ * ```tsx
209
+ * <py.PropertyDeclaration name="value" type={{ children: "int" }}>
210
+ * return self._value
211
+ * <py.PropertyDeclaration.Setter type={{ children: "int" }}>
212
+ * self._value = value
213
+ * </py.PropertyDeclaration.Setter>
214
+ * </py.PropertyDeclaration>
215
+ * ```
216
+ * Generates:
217
+ * ```python
218
+ * @value.setter
219
+ * def value(self, value: int) -> None:
220
+ * self._value = value
221
+ * ```
222
+ */
223
+ PropertyDeclaration.Setter = taggedComponent(
224
+ setterTag,
225
+ function PropertySetter(
226
+ props: PropertyMethodDeclarationProps & { type?: Children },
227
+ ) {
228
+ return (
229
+ <PropertyMethodBase
230
+ decoratorType="setter"
231
+ parameters={[{ name: "value", type: props.type }]}
232
+ {...props}
233
+ />
234
+ );
235
+ },
236
+ );
237
+
238
+ /**
239
+ * Adds a deleter to a `PropertyDeclaration`.
240
+ *
241
+ * @example
242
+ * ```tsx
243
+ * <py.PropertyDeclaration name="value" type={{ children: "int" }}>
244
+ * return self._value
245
+ * <py.PropertyDeclaration.Deleter>
246
+ * del self._value
247
+ * </py.PropertyDeclaration.Deleter>
248
+ * </py.PropertyDeclaration>
249
+ * ```
250
+ * Generates:
251
+ * ```python
252
+ * @value.deleter
253
+ * def value(self) -> None:
254
+ * del self._value
255
+ * ```
256
+ */
257
+ PropertyDeclaration.Deleter = taggedComponent(
258
+ deleterTag,
259
+ function PropertyDeleter(
260
+ props: Omit<PropertyMethodDeclarationProps, "returnType">,
261
+ ) {
262
+ return <PropertyMethodBase decoratorType="deleter" {...props} />;
263
+ },
264
+ );