@azure-tools/typespec-python 0.23.0 → 0.23.2

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 (2) hide show
  1. package/README.md +118 -1
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1 +1,118 @@
1
- # Cadl Python Client Emitter
1
+ # TypeSpec Python Client Emitter
2
+
3
+ ## Getting started
4
+
5
+ ### Initialize TypeSpec Project
6
+
7
+ Follow [TypeSpec Getting Started](https://typespec.io/docs) to initialize your TypeSpec project.
8
+
9
+ Make sure `npx tsp compile .` runs correctly.
10
+
11
+ ### Add typespec-python to your project
12
+
13
+ Include @azure-tools/typespec-python dependencies in `package.json`:
14
+
15
+ ```diff
16
+ "dependencies": {
17
+ + "@azure-tools/typespec-python": "latest"
18
+ },
19
+ ```
20
+
21
+ Run `npm install` to install the dependency.
22
+
23
+ ### Generate a Python client library
24
+
25
+ You can either specify typespec-python on the commandline or through tspconfig.yaml.
26
+
27
+ #### Generate with `--emit` command
28
+
29
+ Run command `npx tsp compile --emit @azure-tools/typespec-python <path-to-typespec-file>`
30
+
31
+ e.g.
32
+
33
+ ```cmd
34
+ npx tsp compile main.tsp --emit @azure-tools/typespec-python
35
+ ```
36
+
37
+ or
38
+
39
+ ```cmd
40
+ npx tsp compile client.tsp --emit @azure-tools/typespec-python
41
+ ```
42
+
43
+ #### Generate with tspconfig.yaml
44
+
45
+ Add the following configuration in tspconfig.yaml:
46
+
47
+ ```diff
48
+ emit:
49
+ - "@azure-tools/typespec-python"
50
+ options:
51
+ "@azure-tools/typespec-python":
52
+ + package-dir: "azure-contoso"
53
+ + package-name: "azure-contoso"
54
+ ```
55
+
56
+ Run the command to generate your library:
57
+
58
+ ```cmd
59
+ npx tsp compile main.tsp
60
+ ```
61
+
62
+ or
63
+
64
+ ```cmd
65
+ npx tsp compile client.tsp
66
+ ```
67
+
68
+ ## Configure the generated library
69
+
70
+ You can further configure the generated client library using the emitter options provided through @azure-tools/typespec-python.
71
+
72
+ You can set options in the command line directly via `--option @azure-tools/typespec-python.<optionName>=XXX`, e.g. `--option @azure-tools/typespec-python.package-name="azure-contoso"`
73
+
74
+ or
75
+
76
+ Modify `tspconfig.yaml` in the TypeSpec project to add emitter options under options/@azure-tools/typespec-python.
77
+
78
+ ```diff
79
+ emit:
80
+ - "@azure-tools/typespec-python"
81
+ options:
82
+ "@azure-tools/typespec-python":
83
+ + package-dir: "{package-dir}"
84
+ + package-name: "azure-contoso"
85
+ ```
86
+
87
+ ### Supported emitter options
88
+
89
+ Common emitter configuration example:
90
+
91
+ ```yaml
92
+ emit:
93
+ - "@azure-tools/typespec-python"
94
+ options:
95
+ "@azure-tools/typespec-python":
96
+ package-dir: "{package-dir}"
97
+ package-name: "azure-contoso"
98
+ ```
99
+
100
+ |Option|Type|Description|
101
+ |-|-|-|
102
+ |`package-version`|string|Specify the package version. Default version: `1.0.0b1`.|
103
+ |`package-name`|string|Specify the package name.|
104
+ |`package-dir`|string|Specify the output directory for the package.|
105
+ |`generate-packaging-files`|boolean|Indicate if packaging files, such as setup.py, should be generated.|
106
+ |`package-pprint-name`|string|Specify the pretty print name for the package.|
107
+ |`flavor`|string|Represents the type of SDK that will be generated. By default, there will be no branding in the generated client library. Specify `"azure"` to generate an SDK following Azure guidelines.|
108
+ |`company-name`|string|Specify the company name to be inserted into licensing data. For `"azure"` flavor, the default value inserted is `Microsoft`.|
109
+
110
+ **Advanced emitter options**
111
+
112
+ |Option|Type|Description|
113
+ |-|-|-|
114
+ |`head-as-boolean`|boolean|Generate head calls to return a boolean. Default: `true`.|
115
+ |`packaging-files-dir`|string|Pass in the path to a custom directory with SDK packaging files.|
116
+ |`packaging-files-config`|object|Specify configuration options that will be passed directly into the packaging files specified by the `packaging-files-dir` option.|
117
+ |`tracing`|boolean|Only available for the `"azure"` flavor of SDKs, provide tracing support in the generated client library. Default: `true`.|
118
+ |`debug`|boolean|Enable debugging.|
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azure-tools/typespec-python",
3
- "version": "0.23.0",
3
+ "version": "0.23.2",
4
4
  "author": "Microsoft Corporation",
5
5
  "description": "TypeSpec emitter for Python SDKs",
6
6
  "homepage": "https://github.com/Azure/autorest.python",
@@ -51,7 +51,7 @@
51
51
  "dependencies": {
52
52
  "js-yaml": "~4.1.0",
53
53
  "@typespec/openapi3": "latest",
54
- "@autorest/python": "^6.13.9"
54
+ "@autorest/python": "^6.13.11"
55
55
  },
56
56
  "devDependencies": {
57
57
  "@azure-tools/typespec-azure-resource-manager": "~0.41.0",