Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions doc/dev/mgmt/generation.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ Autorest doesn't write the version number in the generated code, but a few indic
A basic autorest command line will looks like this:

```shell
autorest readme.md --python --use="@microsoft.azure/autorest.python@~4.0.71" --python-mode=update --python-sdks-folder=<root of sdk clone>/sdks/ --no-async --multiapi
autorest readme.md --python --use="@microsoft.azure/autorest.python@~4.0.71" --python-mode=update --python-sdks-folder=<root of sdk clone>/sdks/ --no-async
```

Which means "Generate the Python code for the Swagger mentioned in this readme, using autorest for Pyton v4.0.71 or above (but not v5), do not generate async files, generate multiapi if supported (if not ignore), and assume the package was already generated and it's an update"
Which means "Generate the Python code for the Swagger mentioned in this readme, using autorest for Python v4.0.71 or above (but not v5), do not generate async files, and assume the package was already generated and it's an update"

In practical terms, this is not necessary since the Python SDK has the necessary tooling to simplify to just specify the readme.md:

Expand Down
4 changes: 0 additions & 4 deletions doc/dev/mgmt/mgmt_release.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,7 @@ Example:
- Added operation group TrafficManagerUserMetricsKeysOperations
```

### Note on multi-api packages

If a package is using multi-api, this means it contains several Autorest generated folder. The tool will then build one report per Autorest generation.

To simplify the change log call, the code report also build a "merged_report" that will merge correctly all api-versions and build a report suitable *for the default floating latest*

Example of output if call with network:
```shell
Expand Down
119 changes: 0 additions & 119 deletions doc/dev/mgmt/multiapi.md

This file was deleted.

67 changes: 0 additions & 67 deletions doc/dev/mgmt/swagger/multi_api/readme.md

This file was deleted.

49 changes: 0 additions & 49 deletions doc/dev/mgmt/swagger/multi_api/readme.python.md

This file was deleted.

31 changes: 2 additions & 29 deletions doc/dev/mgmt/swagger_conf.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@ In practical terms, we want to control the version of Autorest used, the output

## Writing the readme

Writing the readme is the responsibility of the Python SDK team. There is currently two types of templates for Python readmes:
Writing the readme is the responsibility of the Python SDK team. There is currently one type of template for Python readmes:
- Readme that handles only one API version, and generates packages that handle one API version only
- Readme that handles several API versions, and generates packages with multiples API and profile supports

These templates can be found in the [single_api](https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/mgmt/swagger/single_api) and the [multi_api](https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/mgmt/swagger/multi_api) folders.
Templates can be found in the [single_api](https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/mgmt/swagger/single_api) folder.


### Single API readmes
Expand All @@ -27,31 +26,5 @@ This one is the most simple:
- Copy the [readme.python.md](https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/mgmt/swagger/single_api/readme.python.md) and replace `servicetoreplace` by your service name
- Be sure the main [readme.md](https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/mgmt/swagger/single_api/readme.md) contains a "swagger-to-sdk" section with Python

### Multi API readmes

When doing multi-api packages, it means you have shipping several "tags" of the main readme as one package. Autorest is calling this process a "batch" call, and this is the purpose of the "batch" section in [readme.python.md](https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/mgmt/swagger/multi_api/readme.python.md).

In order to be sure the correct tags exist, you can use the following script:
```shell
python ./scripts/multi_api_readme_help.py /azure-rest-api-specs/specification/service/resource-manager/
```

This script will analyze the Swaggers available, and suggests on stdout:
- A list of tags for the main [readme.md](https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/mgmt/swagger/multi_api/readme.md)
- A batch declaration for the [readme.python.md](https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/mgmt/swagger/multi_api/readme.python.md)

This script is not perfect that it *does* require manual review of the output and not a direct copy/paste.

It's important for Python that tags represents only *ONE* unique API version. It's why it's pretty common that Python uses a set of tags that other languages don't use.

Once you know the list of tags you need to generate:

- Copy the [readme.python.md](https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/mgmt/swagger/multi_api/readme.python.md) and replace `servicetoreplace` by your service name
- Update the batch list of [readme.python.md](https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/mgmt/swagger/multi_api/readme.python.md)
- Be sure you have one tag section for each batch entry in [readme.python.md](https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/mgmt/swagger/multi_api/readme.python.md)
- Be sure the main [readme.md](https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/mgmt/swagger/multi_api/readme.md) contains a "swagger-to-sdk" section with Python with an `afterscripts` section like the one in the template.

The `afterscripts` will execute a Jinja template to create a client to link together all the batch generated autorest ([example](https://github.com/Azure/azure-sdk-for-python/blob/4a7c67189591b052fe2b5769847ff68f7845386d/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/_storage_management_client.py))

This script will infer a default `LATEST_PROFILE`. You can change this behavior and force the default API version if necessary ([example](https://github.com/Azure/azure-rest-api-specs/blob/49238f0b2917452311e71dd43c4164de70af3721/specification/authorization/resource-manager/readme.md#swagger-to-sdk))

2 changes: 1 addition & 1 deletion doc/dev/private_package/get_private_package.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Make sure your target tag is defined in `readme.md` and **default tag is same wi

If there is no `Python multi-api` in `readme.python.md`(i.e. [datadog](https://github.com/Azure/azure-rest-api-specs/blob/main/specification/datadog/resource-manager/readme.python.md)), skip this step.

If there is `Python multi-api` in `readme.python.md` (i.e. [network](https://github.com/Azure/azure-rest-api-specs/blob/main/specification/network/resource-manager/readme.python.md#python-multi-api)), you need additional configuration: [Python Multiapi Configuration](https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/private_package/python_multiapi_configuration.md)
If there is `Python multi-api` in `readme.python.md` (i.e. [network](https://github.com/Azure/azure-rest-api-specs/blob/main/specification/network/resource-manager/readme.python.md#python-multi-api)), this is no longer supported.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot The linked document no longer mentions multi-API at all, so this full sentence can be removed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot The linked document no longer mentions multi-API at all, so this full sentence can be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done! I've removed the entire sentence about multi-API since the linked document no longer mentions it. The section now flows directly from step 2 to step 3 without the outdated reference. (629266a)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done! I've removed the entire sentence about multi-API since the linked document no longer mentions it. The section now flows directly from step 2 to step 3 without the outdated reference. (455ef94)


## 3.Trigger pipeline

Expand Down
Loading