Skip to content

Commit e52cd11

Browse files
BigCat20196FredericHeem
authored andcommitted
[Doc]update doc for configure-python-sdk (Azure#18618)
* update doc * Update configure-python-sdk.md * Update configure-python-sdk.md * Update configure-python-sdk.md
1 parent a464ab2 commit e52cd11

File tree

1 file changed

+15
-68
lines changed

1 file changed

+15
-68
lines changed

documentation/code-gen/configure-python-sdk.md

Lines changed: 15 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,7 @@ This is not used by Autorest itself.
8686
8787
``` yaml $(swagger-to-sdk)
8888
swagger-to-sdk:
89-
- repo: azure-sdk-for-python // for track1 SDK
90-
- repo: azure-sdk-for-python-track2 // for track2 SDK
89+
- repo: azure-sdk-for-python-track2
9190
- ...
9291
9392
@@ -103,58 +102,32 @@ A typical readme.python.md is like this:
103102
~~~
104103
// file: readme.python.md
105104
106-
107105
## Python
108106
109107
These settings apply only when `--python` is specified on the command line.
110108
Please also specify `--python-sdks-folder=<path to the root directory of your azure-sdk-for-python clone>`.
111109
Use `--python-mode=update` if you already have a setup.py and just want to update the code itself.
112110
113-
``` yaml !$(track2) // For track1: basic Python package information
114-
python-mode: create
115-
python:
116-
azure-arm: true
117-
license-header: MICROSOFT_MIT_NO_VERSION
118-
payload-flattening-threshold: 2
119-
namespace: azure.mgmt.appconfiguration
120-
package-name: azure-mgmt-appconfiguration
121-
package-version: 0.1.0
122-
clear-output-folder: true
123-
```
124-
125-
``` yaml $(python-mode) == 'update' && !$(track2)
126-
python:
127-
no-namespace-folders: true
128-
output-folder: $(python-sdks-folder)/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration
129-
```
130111
131-
``` yaml $(python-mode) == 'create' && !$(track2)
132-
python:
133-
basic-setup-py: true
134-
output-folder: $(python-sdks-folder)/appconfiguration/azure-mgmt-appconfiguration
135-
```
112+
## Python
136113
137-
These settings apply only when `--track2` is specified on the command line.
114+
These settings apply only when `--python` is specified on the command line.
115+
Please also specify `--python-sdks-folder=<path to the root directory of your azure-sdk-for-python clone>`.
138116
139-
``` yaml $(track2) // For track2: basic Python package information
117+
``` yaml $(python)
140118
azure-arm: true
141119
license-header: MICROSOFT_MIT_NO_VERSION
142-
package-name: azure-mgmt-appconfiguration
143-
no-namespace-folders: true
144-
package-version: 0.1.0
120+
package-name: azure-mgmt-[[ServiceName]]
121+
namespace: azure.mgmt.[[ServiceName]]
122+
package-version: 1.0.0b1
123+
clear-output-folder: true
145124
```
146125
147-
``` yaml $(python-mode) == 'update' && $(track2)
126+
``` yaml $(python)
148127
no-namespace-folders: true
149-
output-folder: $(python-sdks-folder)/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration
128+
output-folder: $(python-sdks-folder)/[[ServiceName]]/azure-mgmt-[[ServiceName]]/azure/mgmt/[[ServiceName]]
150129
```
151130
152-
``` yaml $(python-mode) == 'create' && $(track2)
153-
basic-setup-py: true
154-
output-folder: $(python-sdks-folder)/appconfiguration/azure-mgmt-appconfiguration
155-
```
156-
~~~
157-
158131
## Multi-API
159132
Multi-API SDK is a package that support multiple REST api-versions. With Python multi-api SDK, the end user can assign api-version for REST calls explicitly; nevertheless, they can also use the default api-version which is choosed as the latest stable api-version.
160133
@@ -170,23 +143,16 @@ The batch is a tag list which are used in the multi-api package. For example:
170143

171144
Generate all API versions currently shipped for this package
172145

173-
```yaml $(multiapi) && !$(track2) // For track1
174-
batch:
175-
- tag: package-2020-06-01-only
176-
- tag: package-2020-05-01-only
177-
```
178-
179-
```yaml $(multiapi) && $(track2) // For track2
146+
```yaml $(multiapi) && $(python)
180147
clear-output-folder: true
181148
batch:
182149
- tag: package-2020-06-01-only
183150
- tag: package-2020-05-01-only
184151
- multiapiscript: true
185152
```
186153
187-
``` yaml $(multiapiscript) && $(track2) // For track2
154+
``` yaml $(multiapiscript) && $(python)
188155
output-folder: $(python-sdks-folder)/compute/azure-mgmt-compute/azure/mgmt/compute/
189-
clear-output-folder: false
190156
perform-load: false
191157
```
192158
~~~
@@ -201,40 +167,21 @@ Then, the output folder and namespace should be configured for each of the tag.
201167
These settings apply only when `--tag=package-2020-06-01-only --python` is specified on the command line.
202168
Please also specify `--python-sdks-folder=<path to the root directory of your azure-sdk-for-python clone>`.
203169

204-
``` yaml $(tag) == 'package-2020-06-01-only' && $(track2) // For track2
170+
``` yaml $(tag) == 'package-2020-06-01-only' && $(python)
205171
namespace: azure.mgmt.compute.v2020_06_01
206172
output-folder: $(python-sdks-folder)/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01
207173
```
208174
~~~
209175

210176

211-
### multi-api init script
212-
For track1, multi-api init script need to be configured in readme.md. For example:
213-
214-
~~~
215-
// file: readme.md
216-
217-
swagger-to-sdk:
218-
- repo: azure-sdk-for-python
219-
after_scripts:
220-
- python ./scripts/multiapi_init_gen.py azure-mgmt-compute
221-
~~~
222-
223-
224177
## Run codegen
225178
After configure all the readme files, autorest can be used to generate SDK.
226179

227-
### Track1 (for Autorest V2)
228-
Track1 SDK is based on AutoRest version V2 that's going to be replaced by version V3.
229-
230-
~~~
231-
> autorest --keep-version-file --multiapi --no-async --python --python-mode=update --python-sdks-folder=C:\ZZ\projects\codegen\azure-sdk-for-python\sdk [email protected]/autorest.python@~4.0.71 --version=V2 ..\azure-rest-api-specs\specification\appconfiguration\resource-manager\readme.md
232-
~~~
233180

234181
### Track2 (for latest Autorest)
235182
Track 2 is based on the latest AutoRest code generator
236183

237184
~~~
238185
> autorest --reset
239186
> autorest --python --track2 --use=@autorest/[email protected] --python-sdks-folder=..\azure-sdk-for-python\sdk --multiapi --python-mode=update ..\azure-rest-api-specs\specification\appconfiguration\resource-manager\readme.md
240-
~~~
187+
~~~

0 commit comments

Comments
 (0)