@alloy-js/python 0.5.0-dev.1 → 0.5.0

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 (217) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/dev/src/components/CallSignature.js +2 -2
  3. package/dist/dev/src/components/CallSignature.js.map +1 -1
  4. package/dist/dev/src/components/ConstructorDeclaration.js +1 -1
  5. package/dist/dev/src/components/ConstructorDeclaration.js.map +1 -1
  6. package/dist/dev/src/components/DataclassDeclaration.js +5 -5
  7. package/dist/dev/src/components/DataclassDeclaration.js.map +1 -1
  8. package/dist/dev/src/components/FunctionBase.js +9 -9
  9. package/dist/dev/src/components/FunctionBase.js.map +1 -1
  10. package/dist/dev/src/components/PropertyDeclaration.js +8 -8
  11. package/dist/dev/src/components/PropertyDeclaration.js.map +1 -1
  12. package/dist/dev/src/components/PyDoc.js +64 -64
  13. package/dist/dev/src/components/PyDoc.js.map +1 -1
  14. package/dist/dev/src/components/PydanticClassDeclaration.js +5 -5
  15. package/dist/dev/src/components/PydanticClassDeclaration.js.map +1 -1
  16. package/dist/dev/src/components/SourceFile.js +44 -32
  17. package/dist/dev/src/components/SourceFile.js.map +1 -1
  18. package/dist/dev/src/symbols/python-output-symbol.js.map +1 -1
  19. package/dist/dev/test/callsignatures.test.js +471 -297
  20. package/dist/dev/test/callsignatures.test.js.map +1 -1
  21. package/dist/dev/test/class-method-declaration.test.js +21 -10
  22. package/dist/dev/test/class-method-declaration.test.js.map +1 -1
  23. package/dist/dev/test/classdeclarations.test.js +459 -393
  24. package/dist/dev/test/classdeclarations.test.js.map +1 -1
  25. package/dist/dev/test/classinstantiations.test.js +201 -168
  26. package/dist/dev/test/classinstantiations.test.js.map +1 -1
  27. package/dist/dev/test/constructordeclaration.test.js +22 -11
  28. package/dist/dev/test/constructordeclaration.test.js.map +1 -1
  29. package/dist/dev/test/dataclassdeclarations.test.js +322 -368
  30. package/dist/dev/test/dataclassdeclarations.test.js.map +1 -1
  31. package/dist/dev/test/decoratorlist.test.js +96 -49
  32. package/dist/dev/test/decoratorlist.test.js.map +1 -1
  33. package/dist/dev/test/dundermethoddeclaration.test.js +22 -11
  34. package/dist/dev/test/dundermethoddeclaration.test.js.map +1 -1
  35. package/dist/dev/test/enums.test.js +218 -184
  36. package/dist/dev/test/enums.test.js.map +1 -1
  37. package/dist/dev/test/externals.test.js +57 -45
  38. package/dist/dev/test/externals.test.js.map +1 -1
  39. package/dist/dev/test/factories.test.js +124 -50
  40. package/dist/dev/test/factories.test.js.map +1 -1
  41. package/dist/dev/test/functioncallexpressions.test.js +199 -164
  42. package/dist/dev/test/functioncallexpressions.test.js.map +1 -1
  43. package/dist/dev/test/functiondeclaration.test.js +439 -272
  44. package/dist/dev/test/functiondeclaration.test.js.map +1 -1
  45. package/dist/dev/test/imports.test.js +273 -221
  46. package/dist/dev/test/imports.test.js.map +1 -1
  47. package/dist/dev/test/memberexpressions.test.js +1237 -972
  48. package/dist/dev/test/memberexpressions.test.js.map +1 -1
  49. package/dist/dev/test/methoddeclaration.test.js +142 -78
  50. package/dist/dev/test/methoddeclaration.test.js.map +1 -1
  51. package/dist/dev/test/namepolicies.test.js +130 -94
  52. package/dist/dev/test/namepolicies.test.js.map +1 -1
  53. package/dist/dev/test/propertydeclaration.test.js +88 -59
  54. package/dist/dev/test/propertydeclaration.test.js.map +1 -1
  55. package/dist/dev/test/pydanticclassdeclarations.test.js +299 -347
  56. package/dist/dev/test/pydanticclassdeclarations.test.js.map +1 -1
  57. package/dist/dev/test/pydocs.test.js +888 -715
  58. package/dist/dev/test/pydocs.test.js.map +1 -1
  59. package/dist/dev/test/references.test.js +42 -35
  60. package/dist/dev/test/references.test.js.map +1 -1
  61. package/dist/dev/test/sourcefiles.test.js +1109 -841
  62. package/dist/dev/test/sourcefiles.test.js.map +1 -1
  63. package/dist/dev/test/staticmethoddeclaration.test.js +21 -10
  64. package/dist/dev/test/staticmethoddeclaration.test.js.map +1 -1
  65. package/dist/dev/test/type-checking-imports.test.js +408 -359
  66. package/dist/dev/test/type-checking-imports.test.js.map +1 -1
  67. package/dist/dev/test/typereference.test.js +55 -40
  68. package/dist/dev/test/typereference.test.js.map +1 -1
  69. package/dist/dev/test/uniontypeexpression.test.js +222 -146
  70. package/dist/dev/test/uniontypeexpression.test.js.map +1 -1
  71. package/dist/dev/test/utils.js +39 -77
  72. package/dist/dev/test/utils.js.map +1 -1
  73. package/dist/dev/test/values.test.js +237 -101
  74. package/dist/dev/test/values.test.js.map +1 -1
  75. package/dist/dev/test/variables.test.js +321 -203
  76. package/dist/dev/test/variables.test.js.map +1 -1
  77. package/dist/dev/test/vitest.setup.js +2 -0
  78. package/dist/dev/test/vitest.setup.js.map +1 -0
  79. package/dist/src/components/CallSignature.d.ts.map +1 -1
  80. package/dist/src/components/CallSignature.js.map +1 -1
  81. package/dist/src/components/ConstructorDeclaration.d.ts.map +1 -1
  82. package/dist/src/components/ConstructorDeclaration.js.map +1 -1
  83. package/dist/src/components/DataclassDeclaration.d.ts.map +1 -1
  84. package/dist/src/components/DataclassDeclaration.js.map +1 -1
  85. package/dist/src/components/FunctionBase.d.ts.map +1 -1
  86. package/dist/src/components/FunctionBase.js.map +1 -1
  87. package/dist/src/components/PropertyDeclaration.d.ts.map +1 -1
  88. package/dist/src/components/PropertyDeclaration.js.map +1 -1
  89. package/dist/src/components/PyDoc.d.ts.map +1 -1
  90. package/dist/src/components/PyDoc.js.map +1 -1
  91. package/dist/src/components/PydanticClassDeclaration.d.ts.map +1 -1
  92. package/dist/src/components/PydanticClassDeclaration.js.map +1 -1
  93. package/dist/src/components/SourceFile.d.ts +2 -2
  94. package/dist/src/components/SourceFile.d.ts.map +1 -1
  95. package/dist/src/components/SourceFile.js +12 -0
  96. package/dist/src/components/SourceFile.js.map +1 -1
  97. package/dist/src/symbols/python-output-symbol.d.ts.map +1 -1
  98. package/dist/src/symbols/python-output-symbol.js.map +1 -1
  99. package/dist/test/callsignatures.test.js +346 -272
  100. package/dist/test/callsignatures.test.js.map +1 -1
  101. package/dist/test/class-method-declaration.test.js +7 -4
  102. package/dist/test/class-method-declaration.test.js.map +1 -1
  103. package/dist/test/classdeclarations.test.js +302 -288
  104. package/dist/test/classdeclarations.test.js.map +1 -1
  105. package/dist/test/classinstantiations.test.js +112 -103
  106. package/dist/test/classinstantiations.test.js.map +1 -1
  107. package/dist/test/constructordeclaration.test.js +7 -4
  108. package/dist/test/constructordeclaration.test.js.map +1 -1
  109. package/dist/test/dataclassdeclarations.test.js +134 -184
  110. package/dist/test/dataclassdeclarations.test.js.map +1 -1
  111. package/dist/test/decoratorlist.test.js +59 -36
  112. package/dist/test/decoratorlist.test.js.map +1 -1
  113. package/dist/test/dundermethoddeclaration.test.js +7 -4
  114. package/dist/test/dundermethoddeclaration.test.js.map +1 -1
  115. package/dist/test/enums.test.js +161 -159
  116. package/dist/test/enums.test.js.map +1 -1
  117. package/dist/test/externals.test.js +24 -24
  118. package/dist/test/externals.test.js.map +1 -1
  119. package/dist/test/factories.test.js +75 -33
  120. package/dist/test/factories.test.js.map +1 -1
  121. package/dist/test/functioncallexpressions.test.js +117 -106
  122. package/dist/test/functioncallexpressions.test.js.map +1 -1
  123. package/dist/test/functiondeclaration.test.js +247 -180
  124. package/dist/test/functiondeclaration.test.js.map +1 -1
  125. package/dist/test/imports.test.js +171 -143
  126. package/dist/test/imports.test.js.map +1 -1
  127. package/dist/test/memberexpressions.test.js +582 -453
  128. package/dist/test/memberexpressions.test.js.map +1 -1
  129. package/dist/test/methoddeclaration.test.js +66 -46
  130. package/dist/test/methoddeclaration.test.js.map +1 -1
  131. package/dist/test/namepolicies.test.js +90 -78
  132. package/dist/test/namepolicies.test.js.map +1 -1
  133. package/dist/test/propertydeclaration.test.js +25 -20
  134. package/dist/test/propertydeclaration.test.js.map +1 -1
  135. package/dist/test/pydanticclassdeclarations.test.js +134 -190
  136. package/dist/test/pydanticclassdeclarations.test.js.map +1 -1
  137. package/dist/test/pydocs.test.js +573 -532
  138. package/dist/test/pydocs.test.js.map +1 -1
  139. package/dist/test/references.test.js +31 -28
  140. package/dist/test/references.test.js.map +1 -1
  141. package/dist/test/sourcefiles.test.js +700 -580
  142. package/dist/test/sourcefiles.test.js.map +1 -1
  143. package/dist/test/staticmethoddeclaration.test.js +7 -4
  144. package/dist/test/staticmethoddeclaration.test.js.map +1 -1
  145. package/dist/test/type-checking-imports.test.js +297 -284
  146. package/dist/test/type-checking-imports.test.js.map +1 -1
  147. package/dist/test/typereference.test.js +29 -22
  148. package/dist/test/typereference.test.js.map +1 -1
  149. package/dist/test/uniontypeexpression.test.js +124 -88
  150. package/dist/test/uniontypeexpression.test.js.map +1 -1
  151. package/dist/test/utils.d.ts +10 -17
  152. package/dist/test/utils.d.ts.map +1 -1
  153. package/dist/test/utils.js +32 -74
  154. package/dist/test/utils.js.map +1 -1
  155. package/dist/test/values.test.js +135 -67
  156. package/dist/test/values.test.js.map +1 -1
  157. package/dist/test/variables.test.js +201 -151
  158. package/dist/test/variables.test.js.map +1 -1
  159. package/dist/test/vitest.setup.d.ts +2 -0
  160. package/dist/test/vitest.setup.d.ts.map +1 -0
  161. package/dist/test/vitest.setup.js +2 -0
  162. package/dist/test/vitest.setup.js.map +1 -0
  163. package/dist/tsconfig.tsbuildinfo +1 -1
  164. package/docs/api/components/FunctionalEnumDeclaration.md +3 -6
  165. package/docs/api/components/MemberExpression.md +1 -5
  166. package/docs/api/components/SourceFile.md +20 -8
  167. package/docs/api/components/index.md +0 -2
  168. package/docs/api/functions/isTypeRefContext.md +1 -1
  169. package/docs/api/index.md +2 -2
  170. package/docs/api/types/ReferenceProps.md +7 -0
  171. package/docs/api/types/TypeRefContextProps.md +7 -0
  172. package/docs/api/types/index.md +2 -0
  173. package/package.json +11 -10
  174. package/src/components/CallSignature.tsx +4 -2
  175. package/src/components/ConstructorDeclaration.tsx +4 -2
  176. package/src/components/DataclassDeclaration.tsx +1 -2
  177. package/src/components/FunctionBase.tsx +1 -2
  178. package/src/components/PropertyDeclaration.tsx +8 -4
  179. package/src/components/PyDoc.tsx +12 -6
  180. package/src/components/PydanticClassDeclaration.tsx +1 -2
  181. package/src/components/SourceFile.tsx +6 -1
  182. package/src/symbols/python-output-symbol.ts +1 -2
  183. package/temp/api.json +107 -61
  184. package/test/callsignatures.test.tsx +309 -283
  185. package/test/class-method-declaration.test.tsx +3 -4
  186. package/test/classdeclarations.test.tsx +263 -248
  187. package/test/classinstantiations.test.tsx +115 -109
  188. package/test/constructordeclaration.test.tsx +9 -6
  189. package/test/dataclassdeclarations.test.tsx +243 -361
  190. package/test/decoratorlist.test.tsx +78 -59
  191. package/test/dundermethoddeclaration.test.tsx +3 -4
  192. package/test/enums.test.tsx +65 -81
  193. package/test/externals.test.tsx +25 -25
  194. package/test/factories.test.tsx +64 -22
  195. package/test/functioncallexpressions.test.tsx +123 -109
  196. package/test/functiondeclaration.test.tsx +209 -148
  197. package/test/imports.test.tsx +119 -91
  198. package/test/memberexpressions.test.tsx +265 -207
  199. package/test/methoddeclaration.test.tsx +84 -63
  200. package/test/namepolicies.test.tsx +69 -69
  201. package/test/propertydeclaration.test.tsx +7 -8
  202. package/test/pydanticclassdeclarations.test.tsx +355 -487
  203. package/test/pydocs.test.tsx +531 -579
  204. package/test/references.test.tsx +24 -23
  205. package/test/sourcefiles.test.tsx +527 -492
  206. package/test/staticmethoddeclaration.test.tsx +3 -4
  207. package/test/type-checking-imports.test.tsx +206 -218
  208. package/test/typereference.test.tsx +15 -12
  209. package/test/uniontypeexpression.test.tsx +74 -61
  210. package/test/utils.tsx +26 -110
  211. package/test/values.test.tsx +82 -32
  212. package/test/variables.test.tsx +162 -142
  213. package/test/vitest.setup.ts +1 -0
  214. package/tsdoc-metadata.json +1 -1
  215. package/vitest.config.ts +4 -0
  216. package/docs/api/components/Reference.md +0 -31
  217. package/docs/api/components/TypeRefContext.md +0 -41
@@ -13,7 +13,11 @@ A Python source file component that represents a Python file in the source direc
13
13
  futureImports={Children[]}
14
14
  header={Children}
15
15
  headerComment="string"
16
+ insertFinalNewLine
16
17
  path="string"
18
+ printWidth={number}
19
+ tabWidth={number}
20
+ useTabs
17
21
  >
18
22
  {children}
19
23
  </SourceFile>
@@ -30,20 +34,28 @@ A Python source file component that represents a Python file in the source direc
30
34
  futureImports: Children[],
31
35
  header: Children,
32
36
  headerComment: string,
37
+ insertFinalNewLine: boolean,
33
38
  path: string,
39
+ printWidth: number,
40
+ tabWidth: number,
41
+ useTabs: boolean,
34
42
  }).children(children)
35
43
  ```
36
44
 
37
45
  ## Props
38
46
 
39
- | | | |
40
- | ------------- | ----------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
41
- | children | optional [Children](../../../core/types/children/) | Content to add to the file, such as function definitions, class definitions, and variable declarations. |
42
- | doc | optional [Children](../../../core/types/children/) | Documentation for this module, which will be rendered as a module-level docstring. |
43
- | futureImports | optional [Children](../../../core/types/children/)\[] | **future** imports to render after the docstring but before regular imports. |
44
- | header | optional [Children](../../../core/types/children/) | Content to render at the very top of the file, before everything else. Use this for shebang lines, encoding declarations, or license headers. |
45
- | headerComment | optional string | Comment to add at the top of the file, rendered as a Python comment block. This is a convenience prop for adding copyright notices or other comments. |
46
- | path | string | The path to the file relative to the source directory. |
47
+ | | | |
48
+ | ------------------ | ----------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
49
+ | children | optional [Children](../../../core/types/children/) | Content to add to the file, such as function definitions, class definitions, and variable declarations. |
50
+ | doc | optional [Children](../../../core/types/children/) | Documentation for this module, which will be rendered as a module-level docstring. |
51
+ | futureImports | optional [Children](../../../core/types/children/)\[] | **future** imports to render after the docstring but before regular imports. |
52
+ | header | optional [Children](../../../core/types/children/) | Content to render at the very top of the file, before everything else. Use this for shebang lines, encoding declarations, or license headers. |
53
+ | headerComment | optional string | Comment to add at the top of the file, rendered as a Python comment block. This is a convenience prop for adding copyright notices or other comments. |
54
+ | insertFinalNewLine | optional boolean | If files should end with a final new line. |
55
+ | path | string | The path to the file relative to the source directory. |
56
+ | printWidth | optional number | The number of characters the printer will wrap on. Defaults to 100 characters. |
57
+ | tabWidth | optional number | The number of spaces to use for indentation. Defaults to 2 spaces. |
58
+ | useTabs | optional boolean | Whether to use tabs instead of spaces for indentation. Defaults to false. |
47
59
 
48
60
  ## Examples
49
61
 
@@ -33,14 +33,12 @@
33
33
  - [PyDoc](PyDoc.md) — A PyDoc comment.
34
34
  - [PyDocExample](PyDocExample.md) — Create a PyDoc example, which is prepended by >>.
35
35
  - [PythonBlock](PythonBlock.md) — A Python block component that can be used to render a block of Python code.
36
- - [Reference](Reference.md) — A Python reference to a symbol, such as a variable, function, or class.
37
36
  - [SimpleCommentBlock](SimpleCommentBlock.md) — import { SimpleCommentBlock } from "@alloy-js/python";
38
37
  - [SimpleInlineComment](SimpleInlineComment.md) — import { SimpleInlineComment } from "@alloy-js/python";
39
38
  - [SourceFile](SourceFile.md) — A Python source file component that represents a Python file in the source directory.
40
39
  - [StatementList](StatementList.md) — A Python statement list, which is a list of statements that can be rendered in a Python source file.
41
40
  - [StaticMethodDeclaration](StaticMethodDeclaration.md) — A Python static method declaration component.
42
41
  - [TypeArguments](TypeArguments.md) — Render Python-style type arguments, e.g.
43
- - [TypeRefContext](TypeRefContext.md) — Set the current context of reference to be type reference.
44
42
  - [TypeReference](TypeReference.md) — A type reference like Foo\[T, P] or int.
45
43
  - [UnionTypeExpression](UnionTypeExpression.md) — import { UnionTypeExpression } from "@alloy-js/python";
46
44
  - [useSourceFile](useSourceFile.md) — import { useSourceFile } from "@alloy-js/python";
@@ -14,4 +14,4 @@ function isTypeRefContext(): boolean;
14
14
 
15
15
  ## Returns
16
16
 
17
- booleantrue’ if in a type context, ‘false’ if in a value context.
17
+ booleantrue’ if in a type context, ‘false’ if in a value context.
package/docs/api/index.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # @alloy-js/python API Reference
2
2
 
3
- - [components](components/index.md) (45 items)
3
+ - [components](components/index.md) (43 items)
4
4
  - [contexts](contexts/index.md) (1 items)
5
5
  - [functions](functions/index.md) (11 items)
6
- - [types](types/index.md) (30 items)
6
+ - [types](types/index.md) (32 items)
7
7
  - [variables](variables/index.md) (9 items)
@@ -0,0 +1,7 @@
1
+ # ReferenceProps
2
+
3
+ ## Members
4
+
5
+ | | | |
6
+ | ------ | ------------------------------------- | - |
7
+ | refkey | [Refkey](../../../core/types/refkey/) | |
@@ -0,0 +1,7 @@
1
+ # TypeRefContextProps
2
+
3
+ ## Members
4
+
5
+ | | | |
6
+ | -------- | ----------------------------------------- | -------- |
7
+ | children | [Children](../../../core/types/children/) | Children |
@@ -28,5 +28,7 @@
28
28
  - [PythonOutputScope](PythonOutputScope.md) — type PythonOutputScope = PythonLexicalScope | PythonModuleScope | PythonMemberScope;
29
29
  - [PythonOutputSymbol](PythonOutputSymbol.md) — Represents an ‘exported’ symbol from a .py file.
30
30
  - [PythonOutputSymbolOptions](PythonOutputSymbolOptions.md) — Extends [OutputSymbolOptions](../../../core/types/outputsymboloptions/)
31
+ - [ReferenceProps](ReferenceProps.md)
31
32
  - [RefOptions](RefOptions.md)
32
33
  - [SubscriptionProps](SubscriptionProps.md)
34
+ - [TypeRefContextProps](TypeRefContextProps.md)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alloy-js/python",
3
- "version": "0.5.0-dev.1",
3
+ "version": "0.5.0",
4
4
  "description": "Python bindings for Alloy",
5
5
  "repository": {
6
6
  "type": "git",
@@ -20,18 +20,19 @@
20
20
  "author": "",
21
21
  "license": "MIT",
22
22
  "dependencies": {
23
- "@alloy-js/core": "~0.23.1 || >= 0.24.0-dev.6",
24
23
  "change-case": "^5.4.4",
25
- "pathe": "^2.0.3"
24
+ "pathe": "^2.0.3",
25
+ "@alloy-js/core": "~0.24.0"
26
26
  },
27
27
  "devDependencies": {
28
- "@alloy-js/cli": "~0.23.0 || >= 0.24.0-dev.1",
29
- "@alloy-js/rollup-plugin": "~0.1.1 || >= 0.1.2-dev.2",
30
- "@microsoft/api-extractor": "~7.52.8",
31
- "@rollup/plugin-typescript": "^12.1.2",
32
- "concurrently": "^9.2.0",
33
- "typescript": "^5.8.3",
34
- "vitest": "3.2.4"
28
+ "@microsoft/api-extractor": "~7.58.8",
29
+ "@rollup/plugin-typescript": "^12.3.0",
30
+ "@types/node": "^25.9.2",
31
+ "concurrently": "^10.0.3",
32
+ "typescript": "^6.0.3",
33
+ "vitest": "4.1.8",
34
+ "@alloy-js/rollup-plugin": "~0.1.2",
35
+ "@alloy-js/cli": "~0.24.0"
35
36
  },
36
37
  "type": "module",
37
38
  "scripts": {
@@ -92,8 +92,10 @@ function parameter(param: DeclaredParameterDescriptor) {
92
92
  );
93
93
  }
94
94
 
95
- interface DeclaredParameterDescriptor
96
- extends Omit<ParameterDescriptor, "name"> {
95
+ interface DeclaredParameterDescriptor extends Omit<
96
+ ParameterDescriptor,
97
+ "name"
98
+ > {
97
99
  symbol: PythonOutputSymbol;
98
100
  TypeSlot?: SymbolSlot;
99
101
  }
@@ -18,8 +18,10 @@ import { MethodDeclarationBase } from "./MethodBase.js";
18
18
  * pass
19
19
  * ```
20
20
  */
21
- export interface ConstructorDeclarationProps
22
- extends Omit<CommonFunctionProps, "name"> {
21
+ export interface ConstructorDeclarationProps extends Omit<
22
+ CommonFunctionProps,
23
+ "name"
24
+ > {
23
25
  abstract?: boolean;
24
26
  }
25
27
 
@@ -109,8 +109,7 @@ export type DataclassDecoratorKwargs = Partial<
109
109
  >;
110
110
 
111
111
  export interface DataclassDeclarationProps
112
- extends ClassDeclarationProps,
113
- DataclassDecoratorKwargs {}
112
+ extends ClassDeclarationProps, DataclassDecoratorKwargs {}
114
113
 
115
114
  /**
116
115
  * Renders a Python dataclass.
@@ -16,8 +16,7 @@ import { PythonBlock } from "./PythonBlock.jsx";
16
16
  * metadata with call signature shape.
17
17
  */
18
18
  export interface CommonFunctionProps
19
- extends BaseDeclarationProps,
20
- CallSignatureProps {
19
+ extends BaseDeclarationProps, CallSignatureProps {
21
20
  /** Indicates that the function is async. */
22
21
  async?: boolean;
23
22
  /**
@@ -178,8 +178,10 @@ export function PropertyDeclaration(props: PropertyDeclarationProps) {
178
178
  );
179
179
  }
180
180
 
181
- export interface PropertyMethodDeclarationProps
182
- extends Omit<CommonFunctionProps, "name"> {
181
+ export interface PropertyMethodDeclarationProps extends Omit<
182
+ CommonFunctionProps,
183
+ "name"
184
+ > {
183
185
  abstract?: boolean;
184
186
  }
185
187
 
@@ -206,8 +208,10 @@ function PropertyMethodDeclaration(props: PropertyMethodDeclarationProps) {
206
208
  );
207
209
  }
208
210
 
209
- interface PropertyMethodBaseProps
210
- extends Omit<PropertyMethodDeclarationProps, "name"> {
211
+ interface PropertyMethodBaseProps extends Omit<
212
+ PropertyMethodDeclarationProps,
213
+ "name"
214
+ > {
211
215
  decoratorType: "setter" | "deleter";
212
216
  parameters?: (ParameterDescriptor | string)[];
213
217
  }
@@ -537,8 +537,10 @@ function GoogleStylePropertyDoc(props: GoogleStylePropertyDocProps) {
537
537
  return <PyDoc>{children}</PyDoc>;
538
538
  }
539
539
 
540
- interface GoogleStyleGeneratorDocProps
541
- extends Omit<GeneratorDocProps, "style"> {}
540
+ interface GoogleStyleGeneratorDocProps extends Omit<
541
+ GeneratorDocProps,
542
+ "style"
543
+ > {}
542
544
 
543
545
  /**
544
546
  * A component that creates a GoogleStyleGeneratorDoc block for generators.
@@ -577,8 +579,10 @@ function GoogleStyleGeneratorDoc(props: GoogleStyleGeneratorDocProps) {
577
579
  return <PyDoc>{children}</PyDoc>;
578
580
  }
579
581
 
580
- interface GoogleStyleExceptionDocProps
581
- extends Omit<ExceptionDocProps, "style"> {}
582
+ interface GoogleStyleExceptionDocProps extends Omit<
583
+ ExceptionDocProps,
584
+ "style"
585
+ > {}
582
586
 
583
587
  /**
584
588
  * A component that creates a GoogleStyleExceptionDoc block for exceptions.
@@ -612,8 +616,10 @@ function GoogleStyleExceptionDoc(props: GoogleStyleExceptionDocProps) {
612
616
  return <PyDoc>{children}</PyDoc>;
613
617
  }
614
618
 
615
- interface GoogleStyleAttributeDocProps
616
- extends Omit<AttributeDocProps, "style"> {}
619
+ interface GoogleStyleAttributeDocProps extends Omit<
620
+ AttributeDocProps,
621
+ "style"
622
+ > {}
617
623
 
618
624
  /**
619
625
  * A component that creates a GoogleStyleAttributeDoc block for attributes.
@@ -95,8 +95,7 @@ const PydanticModelConfigKeys = [
95
95
  ] as const satisfies readonly (keyof PydanticModelConfigDictProps)[];
96
96
 
97
97
  export interface PydanticClassDeclarationProps
98
- extends ClassDeclarationProps,
99
- PydanticModelConfigDictProps {
98
+ extends ClassDeclarationProps, PydanticModelConfigDictProps {
100
99
  /**
101
100
  * Canonical structured config object for `ConfigDict(...)`. Values here are
102
101
  * merged with top-level config props.
@@ -7,6 +7,7 @@ import {
7
7
  createScope,
8
8
  isComponentCreator,
9
9
  List,
10
+ PrintTreeOptions,
10
11
  Scope,
11
12
  Show,
12
13
  SourceDirectoryContext,
@@ -78,7 +79,7 @@ export function useSourceFile() {
78
79
  return useContext(PythonSourceFileContext)!;
79
80
  }
80
81
 
81
- export interface SourceFileProps {
82
+ export interface SourceFileProps extends PrintTreeOptions {
82
83
  /**
83
84
  * The path to the file relative to the source directory.
84
85
  */
@@ -200,6 +201,10 @@ export function SourceFile(props: SourceFileProps) {
200
201
  filetype="py"
201
202
  reference={Reference}
202
203
  header={props.header}
204
+ tabWidth={props.tabWidth ?? 4}
205
+ printWidth={props.printWidth}
206
+ useTabs={props.useTabs}
207
+ insertFinalNewLine={props.insertFinalNewLine}
203
208
  >
204
209
  {/* Extra blank line after header when followed by doc/futureImports/children (not headerComment) */}
205
210
  <Show
@@ -16,8 +16,7 @@ export interface PythonOutputSymbolOptions extends OutputSymbolOptions {
16
16
  typeOnly?: boolean;
17
17
  }
18
18
 
19
- export interface CreatePythonSymbolFunctionOptions
20
- extends PythonOutputSymbolOptions {
19
+ export interface CreatePythonSymbolFunctionOptions extends PythonOutputSymbolOptions {
21
20
  name: string;
22
21
  }
23
22