@alloy-js/python 0.4.0-dev.5 → 0.4.0-dev.7

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 (113) hide show
  1. package/dist/dev/src/name-conflict-resolver.js +6 -2
  2. package/dist/dev/src/name-conflict-resolver.js.map +1 -1
  3. package/dist/dev/test/name-conflict.test.js +38 -0
  4. package/dist/dev/test/name-conflict.test.js.map +1 -0
  5. package/dist/src/name-conflict-resolver.d.ts +2 -2
  6. package/dist/src/name-conflict-resolver.d.ts.map +1 -1
  7. package/dist/src/name-conflict-resolver.js +6 -2
  8. package/dist/src/name-conflict-resolver.js.map +1 -1
  9. package/dist/test/name-conflict.test.d.ts +2 -0
  10. package/dist/test/name-conflict.test.d.ts.map +1 -0
  11. package/dist/test/name-conflict.test.js +38 -0
  12. package/dist/test/name-conflict.test.js.map +1 -0
  13. package/dist/tsconfig.tsbuildinfo +1 -1
  14. package/docs/api/components/AttributeDoc.md +36 -0
  15. package/docs/api/components/CallSignature.md +62 -0
  16. package/docs/api/components/CallSignatureParameters.md +49 -0
  17. package/docs/api/components/ClassDeclaration.md +67 -0
  18. package/docs/api/components/ClassDoc.md +55 -0
  19. package/docs/api/components/ClassEnumDeclaration.md +111 -0
  20. package/docs/api/components/ClassInstantiation.md +44 -0
  21. package/docs/api/components/ClassMethodDeclaration.md +31 -0
  22. package/docs/api/components/ConstructorDeclaration.md +27 -0
  23. package/docs/api/components/DataclassDeclaration.md +55 -0
  24. package/docs/api/components/Declaration.md +41 -0
  25. package/docs/api/components/DunderMethodDeclaration.md +31 -0
  26. package/docs/api/components/EnumMember.md +61 -0
  27. package/docs/api/components/ExceptionDoc.md +55 -0
  28. package/docs/api/components/FunctionCallExpression.md +43 -0
  29. package/docs/api/components/FunctionDeclaration.md +50 -0
  30. package/docs/api/components/FunctionDoc.md +61 -0
  31. package/docs/api/components/FunctionalEnumDeclaration.md +79 -0
  32. package/docs/api/components/FutureStatement.md +51 -0
  33. package/docs/api/components/GeneratorDoc.md +58 -0
  34. package/docs/api/components/InlineDoc.md +29 -0
  35. package/docs/api/components/LexicalScope.md +65 -0
  36. package/docs/api/components/MemberExpression.md +53 -0
  37. package/docs/api/components/MemberScope.md +28 -0
  38. package/docs/api/components/MethodDeclaration.md +49 -0
  39. package/docs/api/components/MethodDoc.md +61 -0
  40. package/docs/api/components/ModuleDoc.md +52 -0
  41. package/docs/api/components/PropertyDeclaration.md +46 -0
  42. package/docs/api/components/PropertyDoc.md +52 -0
  43. package/docs/api/components/PyDoc.md +29 -0
  44. package/docs/api/components/PyDocExample.md +29 -0
  45. package/docs/api/components/PythonBlock.md +47 -0
  46. package/docs/api/components/Reference.md +31 -0
  47. package/docs/api/components/SimpleCommentBlock.md +27 -0
  48. package/docs/api/components/SimpleInlineComment.md +27 -0
  49. package/docs/api/components/SourceFile.md +83 -0
  50. package/docs/api/components/StatementList.md +47 -0
  51. package/docs/api/components/StaticMethodDeclaration.md +31 -0
  52. package/docs/api/components/TypeArguments.md +27 -0
  53. package/docs/api/components/TypeRefContext.md +41 -0
  54. package/docs/api/components/TypeReference.md +37 -0
  55. package/docs/api/components/UnionTypeExpression.md +27 -0
  56. package/docs/api/components/VariableDeclaration.md +87 -0
  57. package/docs/api/components/index.md +46 -0
  58. package/docs/api/components/useSourceFile.md +19 -0
  59. package/docs/api/contexts/PythonSourceFile-context.md +18 -0
  60. package/docs/api/contexts/index.md +3 -0
  61. package/docs/api/functions/createFunctionSymbol.md +23 -0
  62. package/docs/api/functions/createMethodSymbol.md +23 -0
  63. package/docs/api/functions/createModule.md +18 -0
  64. package/docs/api/functions/createPythonNamePolicy.md +17 -0
  65. package/docs/api/functions/getCallSignatureProps.md +21 -0
  66. package/docs/api/functions/index.md +13 -0
  67. package/docs/api/functions/isParameterDescriptor.md +18 -0
  68. package/docs/api/functions/isTypeRefContext.md +17 -0
  69. package/docs/api/functions/ref.md +25 -0
  70. package/docs/api/functions/usePythonLexicalScope.md +17 -0
  71. package/docs/api/functions/usePythonNamePolicy.md +17 -0
  72. package/docs/api/functions/usePythonScope.md +17 -0
  73. package/docs/api/index.md +7 -0
  74. package/docs/api/types/AddImportOptions.md +7 -0
  75. package/docs/api/types/BaseDeclarationProps.md +10 -0
  76. package/docs/api/types/CommonFunctionProps.md +15 -0
  77. package/docs/api/types/CreateModuleProps.md +8 -0
  78. package/docs/api/types/CreatePythonSymbolFunctionOptions.md +9 -0
  79. package/docs/api/types/DataclassDecoratorKey.md +5 -0
  80. package/docs/api/types/DataclassDecoratorKwargs.md +5 -0
  81. package/docs/api/types/EnumPropsBase.md +11 -0
  82. package/docs/api/types/GoogleStyleDocAttributeProps.md +9 -0
  83. package/docs/api/types/ImportRecordProps.md +7 -0
  84. package/docs/api/types/ImportRecords.md +8 -0
  85. package/docs/api/types/ImportedSymbol.md +10 -0
  86. package/docs/api/types/LexicalScopeProps.md +5 -0
  87. package/docs/api/types/MemberExpressionPartProps.md +13 -0
  88. package/docs/api/types/ModuleDescriptor.md +7 -0
  89. package/docs/api/types/ModuleRefkeys.md +7 -0
  90. package/docs/api/types/NamedMap.md +7 -0
  91. package/docs/api/types/ParameterDescriptor.md +13 -0
  92. package/docs/api/types/ParameterMarker.md +5 -0
  93. package/docs/api/types/PropertyMethodDeclarationProps.md +9 -0
  94. package/docs/api/types/PythonElements.md +5 -0
  95. package/docs/api/types/PythonLexicalScope.md +11 -0
  96. package/docs/api/types/PythonMemberScope.md +9 -0
  97. package/docs/api/types/PythonModuleScope.md +13 -0
  98. package/docs/api/types/PythonOutputScope.md +5 -0
  99. package/docs/api/types/PythonOutputSymbol.md +21 -0
  100. package/docs/api/types/PythonOutputSymbolOptions.md +10 -0
  101. package/docs/api/types/RefOptions.md +7 -0
  102. package/docs/api/types/SubscriptionProps.md +9 -0
  103. package/docs/api/types/index.md +31 -0
  104. package/docs/api/variables/abcModule.md +7 -0
  105. package/docs/api/variables/dataclassDecoratorKeySet.md +5 -0
  106. package/docs/api/variables/dataclassDecoratorKeys.md +7 -0
  107. package/docs/api/variables/dataclassesModule.md +7 -0
  108. package/docs/api/variables/enumModule.md +7 -0
  109. package/docs/api/variables/index.md +8 -0
  110. package/docs/api/variables/requestsModule.md +8 -0
  111. package/package.json +4 -4
  112. package/src/name-conflict-resolver.ts +9 -11
  113. package/test/name-conflict.test.ts +37 -0
@@ -0,0 +1,55 @@
1
+ # ExceptionDoc
2
+
3
+ A component that creates an ExceptionDoc block for custom exception classes.
4
+
5
+ * jsx
6
+
7
+ ```tsx
8
+ import { ExceptionDoc } from "@alloy-js/python";
9
+
10
+
11
+ <ExceptionDoc
12
+ attributes={GoogleStyleDocAttributeProps[]}
13
+ deprecated="string"
14
+ description={Children[]}
15
+ examples={Children[]}
16
+ note="string"
17
+ parameters={ParameterDescriptor[]}
18
+ seeAlso={string[]}
19
+ style={"google"}
20
+ warning="string"
21
+ />
22
+ ```
23
+
24
+ * stc
25
+
26
+ ```ts
27
+ import { ExceptionDoc } from "@alloy-js/python/stc";
28
+
29
+
30
+ ExceptionDoc({
31
+ attributes: GoogleStyleDocAttributeProps[],
32
+ deprecated: string,
33
+ description: Children[],
34
+ examples: Children[],
35
+ note: string,
36
+ parameters: ParameterDescriptor[],
37
+ seeAlso: string[],
38
+ style: "google",
39
+ warning: string,
40
+ }).children(children)
41
+ ```
42
+
43
+ ## Props
44
+
45
+ | | | |
46
+ | ----------- | ------------------------------------------------------------------------------------- | - |
47
+ | attributes | optional [GoogleStyleDocAttributeProps](../../types/googlestyledocattributeprops/)\[] | |
48
+ | deprecated | optional string | |
49
+ | description | [Children](../../../core/types/children/)\[] | |
50
+ | examples | optional [Children](../../../core/types/children/)\[] | |
51
+ | note | optional string | |
52
+ | parameters | optional [ParameterDescriptor](../../types/parameterdescriptor/)\[] | |
53
+ | seeAlso | optional string\[] | |
54
+ | style | optional “google” | |
55
+ | warning | optional string | |
@@ -0,0 +1,43 @@
1
+ # FunctionCallExpression
2
+
3
+ A Python function call expression.
4
+
5
+ * jsx
6
+
7
+ ```tsx
8
+ import { FunctionCallExpression } from "@alloy-js/python";
9
+
10
+
11
+ <FunctionCallExpression args={Children[]} target={Children} />
12
+ ```
13
+
14
+ * stc
15
+
16
+ ```ts
17
+ import { FunctionCallExpression } from "@alloy-js/python/stc";
18
+
19
+
20
+ FunctionCallExpression({
21
+ args: Children[],
22
+ target: Children,
23
+ }).children(children)
24
+ ```
25
+
26
+ ## Props
27
+
28
+ | | | |
29
+ | ------ | ----------------------------------------------------- | - |
30
+ | args | optional [Children](../../../core/types/children/)\[] | |
31
+ | target | [Children](../../../core/types/children/) | |
32
+
33
+ ## Example
34
+
35
+ ```tsx
36
+ <FunctionCallExpression target="foo" args={["arg1", "arg2"]} />
37
+ ```
38
+
39
+ This will generate:
40
+
41
+ ```python
42
+ foo(arg1, arg2)
43
+ ```
@@ -0,0 +1,50 @@
1
+ # FunctionDeclaration
2
+
3
+ A Python function declaration.
4
+
5
+ * jsx
6
+
7
+ ```tsx
8
+ import { FunctionDeclaration } from "@alloy-js/python";
9
+
10
+
11
+ <FunctionDeclaration async />
12
+ ```
13
+
14
+ * stc
15
+
16
+ ```ts
17
+ import { FunctionDeclaration } from "@alloy-js/python/stc";
18
+
19
+
20
+ FunctionDeclaration({ async: boolean }).children(children)
21
+ ```
22
+
23
+ ## Props
24
+
25
+ | | | |
26
+ | ----- | ---------------- | ------------------------------------- |
27
+ | async | optional boolean | Indicates that the function is async. |
28
+
29
+ ## Remarks
30
+
31
+ This component creates a Python function declaration with optional type annotations, parameters, and return types. It supports async functions and automatically handles symbol creation and emission.
32
+
33
+ ## Example
34
+
35
+ ```tsx
36
+ <FunctionDeclaration
37
+ name="my_function"
38
+ returnType="int"
39
+ parameters={[{ name: "a", type: { children: "int" } }, { name: "b", type: { children: "str" } }]}
40
+ >
41
+ return a + b
42
+ </FunctionDeclaration>
43
+ ```
44
+
45
+ This will generate:
46
+
47
+ ```python
48
+ def my_function(a: int, b: str) -> int:
49
+ return a + b
50
+ ```
@@ -0,0 +1,61 @@
1
+ # FunctionDoc
2
+
3
+ A component that creates a FunctionDoc block for functions.
4
+
5
+ * jsx
6
+
7
+ ```tsx
8
+ import { FunctionDoc } from "@alloy-js/python";
9
+
10
+
11
+ <FunctionDoc
12
+ deprecated="string"
13
+ description={Children[]}
14
+ examples={Children[]}
15
+ note="string"
16
+ parameters={ParameterDescriptor[]}
17
+ raises={string[]}
18
+ returns="string"
19
+ seeAlso={string[]}
20
+ style={"google"}
21
+ warning="string"
22
+ yields="string"
23
+ />
24
+ ```
25
+
26
+ * stc
27
+
28
+ ```ts
29
+ import { FunctionDoc } from "@alloy-js/python/stc";
30
+
31
+
32
+ FunctionDoc({
33
+ deprecated: string,
34
+ description: Children[],
35
+ examples: Children[],
36
+ note: string,
37
+ parameters: ParameterDescriptor[],
38
+ raises: string[],
39
+ returns: string,
40
+ seeAlso: string[],
41
+ style: "google",
42
+ warning: string,
43
+ yields: string,
44
+ }).children(children)
45
+ ```
46
+
47
+ ## Props
48
+
49
+ | | | |
50
+ | ----------- | ------------------------------------------------------------------- | - |
51
+ | deprecated | optional string | |
52
+ | description | [Children](../../../core/types/children/)\[] | |
53
+ | examples | optional [Children](../../../core/types/children/)\[] | |
54
+ | note | optional string | |
55
+ | parameters | optional [ParameterDescriptor](../../types/parameterdescriptor/)\[] | |
56
+ | raises | optional string\[] | |
57
+ | returns | optional string | |
58
+ | seeAlso | optional string\[] | |
59
+ | style | optional “google” | |
60
+ | warning | optional string | |
61
+ | yields | optional string | |
@@ -0,0 +1,79 @@
1
+ # FunctionalEnumDeclaration
2
+
3
+ Create a Python enum using the functional syntax.
4
+
5
+ This generates enums using the `Enum('Name', [...])` or `Enum('Name', {...})` syntax. The format depends on whether enum members have explicit values:
6
+
7
+ * Members without values: `Enum('Direction', ['NORTH', 'SOUTH', 'EAST', 'WEST'])`
8
+ * Members with values: `Enum('Direction', {'NORTH': 1, 'SOUTH': 2, 'EAST': 3, 'WEST': 4})`
9
+
10
+ - jsx
11
+
12
+ ```tsx
13
+ import { FunctionalEnumDeclaration } from "@alloy-js/python";
14
+
15
+
16
+ <FunctionalEnumDeclaration
17
+ baseType={"Enum" | "IntEnum" | "StrEnum" | "Flag" | "IntFlag"}
18
+ doc={Children}
19
+ members={Array<EnumMemberProps>}
20
+ />
21
+ ```
22
+
23
+ - stc
24
+
25
+ ```ts
26
+ import { FunctionalEnumDeclaration } from "@alloy-js/python/stc";
27
+
28
+
29
+ FunctionalEnumDeclaration({
30
+ baseType: "Enum" | "IntEnum" | "StrEnum" | "Flag" | "IntFlag",
31
+ doc: Children,
32
+ members: Array<EnumMemberProps>,
33
+ }).children(children)
34
+ ```
35
+
36
+ ## Props
37
+
38
+ | | | |
39
+ | -------- | ---------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
40
+ | baseType | optional “Enum” \| “IntEnum” \| “StrEnum” \| “Flag” \| “IntFlag” | The base type of the enum. One of: ‘Enum’, ‘IntEnum’, ‘StrEnum’, ‘Flag’, ‘IntFlag’. Defaults to ‘Enum’. |
41
+ | doc | optional [Children](../../../core/types/children/) | Optional docstring for the enum. |
42
+ | members | optional Array<[EnumMemberProps](../enummember/)> | Members of the enum as an array of objects. |
43
+
44
+ ## Examples
45
+
46
+ ```tsx
47
+ <FunctionalEnumDeclaration
48
+ name="Direction"
49
+ members={[
50
+ { name: "NORTH" },
51
+ { name: "SOUTH" },
52
+ { name: "EAST" },
53
+ { name: "WEST" }
54
+ ]}
55
+ />
56
+ ```
57
+
58
+ renders to:
59
+
60
+ ```python
61
+ Direction = Enum('Direction', ['NORTH', 'SOUTH', 'EAST', 'WEST'])
62
+ ```
63
+
64
+ ```tsx
65
+ <FunctionalEnumDeclaration
66
+ name="Status"
67
+ members={[
68
+ { name: "PENDING", value: 1 },
69
+ { name: "ACTIVE", value: 2 },
70
+ { name: "INACTIVE", value: 3 }
71
+ ]}
72
+ />
73
+ ```
74
+
75
+ renders to:
76
+
77
+ ```python
78
+ Status = Enum('Status', {'PENDING': 1, 'ACTIVE': 2, 'INACTIVE': 3})
79
+ ```
@@ -0,0 +1,51 @@
1
+ # FutureStatement
2
+
3
+ A future statement that imports features from **future**.
4
+
5
+ Future statements are directives to the compiler that a particular module should be compiled using syntax or semantics from a future Python release. They must appear near the top of the module, after the module docstring (if any).
6
+
7
+ Use this in the `futureImports` prop of SourceFile to ensure proper placement.
8
+
9
+ * jsx
10
+
11
+ ```tsx
12
+ import { FutureStatement } from "@alloy-js/python";
13
+
14
+
15
+ <FutureStatement feature="string" />
16
+ ```
17
+
18
+ * stc
19
+
20
+ ```ts
21
+ import { FutureStatement } from "@alloy-js/python/stc";
22
+
23
+
24
+ FutureStatement({ feature: string }).children(children)
25
+ ```
26
+
27
+ ## Props
28
+
29
+ | | | |
30
+ | ------- | ------ | -------------------------------------------------- |
31
+ | feature | string | The name of the feature to import from **future**. |
32
+
33
+ ## Example
34
+
35
+ ```tsx
36
+ <SourceFile path="models.py" futureImports={<FutureStatement feature="annotations" />}>
37
+ <ClassDeclaration name="User">
38
+ <PropertyDeclaration name="manager" type="User" />
39
+ </ClassDeclaration>
40
+ </SourceFile>
41
+ ```
42
+
43
+ renders to
44
+
45
+ ```py
46
+ from __future__ import annotations
47
+
48
+
49
+ class User:
50
+ manager: User
51
+ ```
@@ -0,0 +1,58 @@
1
+ # GeneratorDoc
2
+
3
+ A component that creates a GeneratorDoc block for generator functions.
4
+
5
+ * jsx
6
+
7
+ ```tsx
8
+ import { GeneratorDoc } from "@alloy-js/python";
9
+
10
+
11
+ <GeneratorDoc
12
+ deprecated="string"
13
+ description={Children[]}
14
+ examples={Children[]}
15
+ note="string"
16
+ parameters={ParameterDescriptor[]}
17
+ raises={string[]}
18
+ seeAlso={string[]}
19
+ style={"google"}
20
+ warning="string"
21
+ yields="string"
22
+ />
23
+ ```
24
+
25
+ * stc
26
+
27
+ ```ts
28
+ import { GeneratorDoc } from "@alloy-js/python/stc";
29
+
30
+
31
+ GeneratorDoc({
32
+ deprecated: string,
33
+ description: Children[],
34
+ examples: Children[],
35
+ note: string,
36
+ parameters: ParameterDescriptor[],
37
+ raises: string[],
38
+ seeAlso: string[],
39
+ style: "google",
40
+ warning: string,
41
+ yields: string,
42
+ }).children(children)
43
+ ```
44
+
45
+ ## Props
46
+
47
+ | | | |
48
+ | ----------- | ------------------------------------------------------------------- | - |
49
+ | deprecated | optional string | |
50
+ | description | [Children](../../../core/types/children/)\[] | |
51
+ | examples | optional [Children](../../../core/types/children/)\[] | |
52
+ | note | optional string | |
53
+ | parameters | optional [ParameterDescriptor](../../types/parameterdescriptor/)\[] | |
54
+ | raises | optional string\[] | |
55
+ | seeAlso | optional string\[] | |
56
+ | style | optional “google” | |
57
+ | warning | optional string | |
58
+ | yields | optional string | |
@@ -0,0 +1,29 @@
1
+ # InlineDoc
2
+
3
+ An inline documentation component for attribute docstrings. Unlike PyDoc, this doesn’t add a trailing line break after the closing quotes, which is appropriate for documenting consecutive attributes like enum members.
4
+
5
+ * jsx
6
+
7
+ ```tsx
8
+ import { InlineDoc } from "@alloy-js/python";
9
+
10
+
11
+ <InlineDoc >
12
+ {children}
13
+ </InlineDoc>
14
+ ```
15
+
16
+ * stc
17
+
18
+ ```ts
19
+ import { InlineDoc } from "@alloy-js/python/stc";
20
+
21
+
22
+ InlineDoc({ }).children(children)
23
+ ```
24
+
25
+ ## Props
26
+
27
+ | | | |
28
+ | -------- | ----------------------------------------- | - |
29
+ | children | [Children](../../../core/types/children/) | |
@@ -0,0 +1,65 @@
1
+ # LexicalScope
2
+
3
+ ## Overload 1
4
+
5
+ * jsx
6
+
7
+ ```tsx
8
+ import { LexicalScope } from "@alloy-js/python";
9
+
10
+
11
+ <LexicalScope value={OutputScope} />
12
+ ```
13
+
14
+ * stc
15
+
16
+ ```ts
17
+ import { LexicalScope } from "@alloy-js/python/stc";
18
+
19
+
20
+ LexicalScope({ value: OutputScope }).children(children)
21
+ ```
22
+
23
+ ### Props
24
+
25
+ | | | |
26
+ | -------- | -------------------------------------------------- | --------------------------------------------------------------- |
27
+ | children | optional [Children](../../../core/types/children/) | |
28
+ | value | [OutputScope](../../../core/types/outputscope/) | The scope to use. If not provided, a new scope will be created. |
29
+
30
+ ## Overload 2
31
+
32
+ * jsx
33
+
34
+ ```tsx
35
+ import { LexicalScope } from "@alloy-js/python";
36
+
37
+
38
+ <LexicalScope
39
+ metadata={Record<string, unknown>}
40
+ name="string"
41
+ ownerSymbol={OutputSymbol}
42
+ />
43
+ ```
44
+
45
+ * stc
46
+
47
+ ```ts
48
+ import { LexicalScope } from "@alloy-js/python/stc";
49
+
50
+
51
+ LexicalScope({
52
+ metadata: Record<string, unknown>,
53
+ name: string,
54
+ ownerSymbol: OutputSymbol,
55
+ }).children(children)
56
+ ```
57
+
58
+ ### Props
59
+
60
+ | | | |
61
+ | ----------- | ---------------------------------------------------------- | --------------------------------------------------------------------------- |
62
+ | children | optional [Children](../../../core/types/children/) | |
63
+ | metadata | optional Record\<string, unknown> | Additional metadata for the scope. |
64
+ | name | optional string | The name of this scope. |
65
+ | ownerSymbol | optional [OutputSymbol](../../../core/types/outputsymbol/) | Create a member scope with the owner symbol providing the in-scope symbols. |
@@ -0,0 +1,53 @@
1
+ # MemberExpression
2
+
3
+ Create a member expression from parts. Each part can provide one of the following:
4
+
5
+ * **id**: The identifier for the member expression part
6
+ * **refkey**: a refkey for a symbol whose name becomes the identifier
7
+ * **symbol**: a symbol whose name becomes the identifier part
8
+ * **args**: create a method call with the given args
9
+ * **children**: arbitrary contents for the identifier part.
10
+
11
+ - jsx
12
+
13
+ ```tsx
14
+ import { MemberExpression } from "@alloy-js/python";
15
+
16
+
17
+ <MemberExpression >
18
+ {children}
19
+ </MemberExpression>
20
+ ```
21
+
22
+ - stc
23
+
24
+ ```ts
25
+ import { MemberExpression } from "@alloy-js/python/stc";
26
+
27
+
28
+ MemberExpression({ }).children(children)
29
+ ```
30
+
31
+ ## Props
32
+
33
+ | | | |
34
+ | -------- | ----------------------------------------- | - |
35
+ | children | [Children](../../../core/types/children/) | |
36
+
37
+ ## Example
38
+
39
+ ```tsx
40
+ <MemberExpression>
41
+ <MemberExpression.Part id="base" />
42
+ <MemberExpression.Part refkey={rk} />
43
+ <MemberExpression.Part symbol={sym} />
44
+ <MemberExpression.Part args={["hello", "world"]} />
45
+ <MemberExpression.Part>SomeValue</MemberExpression.Part>
46
+ </MemberExpression>
47
+ ```
48
+
49
+ Assuming `rk` is a refkey to a symbol name “prop1”, and `sym` is a symbol with a name of “prop2”, this will render:
50
+
51
+ ```ts
52
+ base.prop1.prop2("hello", "world").SomeValue
53
+ ```
@@ -0,0 +1,28 @@
1
+ # MemberScope
2
+
3
+ * jsx
4
+
5
+ ```tsx
6
+ import { MemberScope } from "@alloy-js/python";
7
+
8
+
9
+ <MemberScope ownerSymbol={PythonOutputSymbol}>
10
+ {children}
11
+ </MemberScope>
12
+ ```
13
+
14
+ * stc
15
+
16
+ ```ts
17
+ import { MemberScope } from "@alloy-js/python/stc";
18
+
19
+
20
+ MemberScope({ ownerSymbol: PythonOutputSymbol }).children(children)
21
+ ```
22
+
23
+ ## Props
24
+
25
+ | | | |
26
+ | ----------- | ----------------------------------------------------- | - |
27
+ | children | [Children](../../../core/types/children/) | |
28
+ | ownerSymbol | [PythonOutputSymbol](../../types/pythonoutputsymbol/) | |
@@ -0,0 +1,49 @@
1
+ # MethodDeclaration
2
+
3
+ A Python instance method declaration component.
4
+
5
+ Shared base props for all method-like declarations.
6
+
7
+ * jsx
8
+
9
+ ```tsx
10
+ import { MethodDeclaration } from "@alloy-js/python";
11
+
12
+
13
+ <MethodDeclaration abstract async />
14
+ ```
15
+
16
+ * stc
17
+
18
+ ```ts
19
+ import { MethodDeclaration } from "@alloy-js/python/stc";
20
+
21
+
22
+ MethodDeclaration({ abstract: boolean, async: boolean }).children(children)
23
+ ```
24
+
25
+ ## Props
26
+
27
+ | | | |
28
+ | -------- | ---------------- | -------------------------------------- |
29
+ | abstract | optional boolean | Indicates that the method is abstract. |
30
+ | async | optional boolean | Indicates that the function is async. |
31
+
32
+ ## Remarks
33
+
34
+ Automatically injects the `self` parameter for instance methods and enforces that the declaration appears within a class body.
35
+
36
+ ## Example
37
+
38
+ ```tsx
39
+ <py.MethodDeclaration name="do_work" parameters={[{ name: "value", type: "int" }]}>
40
+ return value * 2
41
+ </py.MethodDeclaration>
42
+ ```
43
+
44
+ Generates:
45
+
46
+ ```python
47
+ def do_work(self, value: int) -> None:
48
+ return value * 2
49
+ ```
@@ -0,0 +1,61 @@
1
+ # MethodDoc
2
+
3
+ A component that creates a MethodDoc block for class methods. Automatically adds a note about not including ‘self’ parameter if no custom note is provided.
4
+
5
+ * jsx
6
+
7
+ ```tsx
8
+ import { MethodDoc } from "@alloy-js/python";
9
+
10
+
11
+ <MethodDoc
12
+ deprecated="string"
13
+ description={Children[]}
14
+ examples={Children[]}
15
+ note="string"
16
+ overrides="string"
17
+ parameters={ParameterDescriptor[]}
18
+ raises={string[]}
19
+ returns="string"
20
+ seeAlso={string[]}
21
+ style={"google"}
22
+ warning="string"
23
+ />
24
+ ```
25
+
26
+ * stc
27
+
28
+ ```ts
29
+ import { MethodDoc } from "@alloy-js/python/stc";
30
+
31
+
32
+ MethodDoc({
33
+ deprecated: string,
34
+ description: Children[],
35
+ examples: Children[],
36
+ note: string,
37
+ overrides: string,
38
+ parameters: ParameterDescriptor[],
39
+ raises: string[],
40
+ returns: string,
41
+ seeAlso: string[],
42
+ style: "google",
43
+ warning: string,
44
+ }).children(children)
45
+ ```
46
+
47
+ ## Props
48
+
49
+ | | | |
50
+ | ----------- | ------------------------------------------------------------------- | - |
51
+ | deprecated | optional string | |
52
+ | description | [Children](../../../core/types/children/)\[] | |
53
+ | examples | optional [Children](../../../core/types/children/)\[] | |
54
+ | note | optional string | |
55
+ | overrides | optional string | |
56
+ | parameters | optional [ParameterDescriptor](../../types/parameterdescriptor/)\[] | |
57
+ | raises | optional string\[] | |
58
+ | returns | optional string | |
59
+ | seeAlso | optional string\[] | |
60
+ | style | optional “google” | |
61
+ | warning | optional string | |