{Packaging} Keep py3 model files #21145
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
An alternative solution to #21143
Symptom
When building Windows MSI,
_models_py3.py
files are removed to reduce package size._models.py
are both Python 2 and 3 compatible_models_py3.py
are only Python 3 compatibleSince 2022-01, Python 2 support has been dropped by Python SDK (Azure/azure-sdk-for-python#20691).
_models.py
files are removed from new version Python SDKs_models_py3.py
files are kept in Python SDKsSo far, this change has been done on
azure-mgmt-netapp
andazure-mgmt-trafficmanager
.However, because CLI's build pipeline removes
_models_py3.py
files, no model files will exist in the MSI package. This leads to CI failure:https://dev.azure.com/azure-sdk/public/_build/results?buildId=1332093&view=logs&j=fec5ba3f-cada-52e0-3c40-eb322e7bf2a6&t=50bad18b-08a9-5298-0f82-721960fdcd1c
Full log: 557.txt
Test guide
C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\Lib\site-packages\azure\mgmt\trafficmanager\models
to make sure_models_py3.pyc
existsaz self-test
Pros and Cons
_models.py
files from SDKs in the future, the MSI size will decrease gradually_models_py3.py
to_models.py
in the future, no action will be required on CLI sideTODO
The CI job
TestWindowsMSI
fails to detect this issue when there is no version update, possibly due to old_models_py3.py
files not being removed when installing MSI with the same version. This requires further investigation.