-
Notifications
You must be signed in to change notification settings - Fork 74
Preview SDK Generation
This guide explains how to generate resource provider SDKs locally using the same methods as official azure-sdk-for-python releases.
Important: This is a different procedure than we use to autorest vendored SDKs for inclusion in our extensions - this process is used to create intermediate "release candidate" builds of service SDKs (for CLI core, as an example) before they are officially released.
git clone https://github.com/Azure/azure-rest-api-specs
git clone https://github.com/Azure/azure-sdk-for-pythonThe SDK generation requires the azure-sdk-tools package from the Python SDK repo:
cd /path/to/azure-sdk-for-python
pip install eng/tools/azure-sdk-toolsRun once, or after pulling updates:
cd /path/to/azure-rest-api-specs
npm ciImportant:
- Make sure you check out the
azure-rest-api-specs(orazure-rest-api-specs-pr) repo at your desired branch or commit. - Ensure that the default
taginreadme.mdis the correct version of the SDK you wish to generate (bothapi-versionand SDK build version) - Verify provided paths are correct based on your local environment
cd /path/to/azure-rest-api-specs
npx spec-gen-sdk
--scp /path/to/azure-rest-api-specs
--sdp /path/to/azure-sdk-for-python
--wf /path/to/
-l azure-sdk-for-python
-c HEAD
--rm release
--readme-relative-path "specification/<service>/path/to/readme.md"
--sdk-release-type [beta | stable]The spec-gen-sdk tool will load specs / config and run autorest, followed by post-processing steps to determine breaking changes etc. Once the autorest step has completed, you can effectively cancel the process and proceed with building a wheel.
-
Diff generated code:
cd /path/to/azure-sdk-for-python/ git status git diffThe generated code will be in:
- DPS:
sdk/iothub/azure-mgmt-iothubprovisioningservices/ - IoT Hub:
sdk/iothub/azure-mgmt-iothub/
- DPS:
-
Build wheel
cd sdk/<service>/<package-name> python -m build --wheel
Wheel file will be in
./dist/
DPS:
# Generate SDK
cd ./src
npx spec-gen-sdk
--scp ./azure-rest-api-specs
--sdp ./azure-sdk-for-python
--wf ./
-l azure-sdk-for-python
-c HEAD
--rm release
--readme-relative-path "./azure-rest-api-specs/specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/DeviceProvisioningServices/readme.md"
--sdk-release-type beta
# Build distributable wheel
cd azure-sdk-for-python/sdk/iothub/azure-mgmt-iothubprovisioningservices
python -m build --wheel
# Wheel location:
# ./dist/azure_mgmt_iothubprovisioningservices-*.whlIoT Hub:
# Generate SDK
cd ./src
npx spec-gen-sdk
--scp ./azure-rest-api-specs
--sdp ./azure-sdk-for-python
--wf ./
-l azure-sdk-for-python
-c HEAD
--rm release
--readme-relative-path "./azure-rest-api-specs/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/readme.md"
--sdk-release-type beta
# Build distributable wheel
cd ./azure-sdk-for-python/sdk/iothub/azure-mgmt-iothub
python -m build --wheel
# Wheel location:
# ./dist/azure_mgmt_iothub-*.whl