{Misc.} Escape percent sign to comply with Python 3.14's argparse#33087
{Misc.} Escape percent sign to comply with Python 3.14's argparse#33087
argparse#33087Conversation
️✔️AzureCLI-FullTest
|
|
Hi @jiasli, |
️✔️AzureCLI-BreakingChangeTest
|
|
Thank you for your contribution! We will review the pull request and get back to you soon. |
|
The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR. Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions). pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>
|
There was a problem hiding this comment.
Pull request overview
This PR updates Azure CLI argument help strings to escape literal % characters (as %%) so command loading/help rendering works under Python 3.14’s stricter argparse help-string validation.
Changes:
- Escaped
%in date-format examples (e.g.,%Y-%m-%d...) to preventValueError: badly formed help string. - Escaped
%in percentage-related help text (e.g.,20%) and PowerShell--%operator references. - Escaped
%in URL-encoded examples (e.g.,%2C,%2528) used in help text.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/azure-cli/azure/cli/command_modules/role/_params.py | Escapes % in date/time format examples used in help strings. |
| src/azure-cli/azure/cli/command_modules/vm/_params.py | Escapes % in help strings referencing defaults like 20% and --% operator. |
| src/azure-cli/azure/cli/command_modules/vm/aaz/latest/vmss/_create.py | Escapes % in rolling upgrade policy help text (AAZ). |
| src/azure-cli/azure/cli/command_modules/vm/aaz/latest/vmss/_patch.py | Escapes % in rolling upgrade policy help text (AAZ). |
| src/azure-cli/azure/cli/command_modules/vm/aaz/latest/vmss/_update.py | Escapes % in rolling upgrade policy help text (AAZ). |
| src/azure-cli/azure/cli/command_modules/acr/_params.py | Escapes % in timestamp format examples for token expiration help. |
| src/azure-cli/azure/cli/command_modules/appconfig/_params.py | Escapes % in help text that describes % character restrictions. |
| src/azure-cli/azure/cli/command_modules/containerapp/_params.py | Escapes % in URL examples in help text. |
| src/azure-cli/azure/cli/command_modules/netappfiles/custom.py | Escapes % in “% of RAM” help text. |
| src/azure-cli/azure/cli/command_modules/monitor/aaz/latest/monitor/metrics/_list.py | Escapes % in URL-encoding examples within metric filter help text. |
| src/azure-cli/azure/cli/command_modules/monitor/aaz/latest/monitor/autoscale/_show_predictive_metric.py | Escapes % in URL-encoding examples within metric name help text. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Related command
az ad sp create-for-rbacaz vmss updateDescription
Fix #32832
Fix #32356
Python 3.14's
argparsenow validates help strings via%-formatting (python/cpython#124899), raisingValueError: badly formed help stringwhen a help string contains an unescaped%. Per the argparse docs, literal%must be escaped as%%.This PR escapes all unescaped
%characters in argparse help strings across command modules.Changes
role%Y-%m-%ddate format specifiersvmDefault: 20%,--% operatorvm/aaz(vmss _create, _update, _patch)is 20%.acr%Y-%m-%dT%H:%M:%SZdate formatappconfigthe '%' charactercontainerapp%2CURL-encoded comma in URLnetappfiles% of RAMmonitor(metrics, autoscale)%2528,%2URL-encoded valuesTesting Guide
These are help string-only changes with no behavioral impact. The fix can be verified by running any of the previously failing commands on Python 3.14:
Additional information
🤖 This PR is assisted by VS Code GitHub Copilot, with Claude Opus 4.6 Medium model, and human-verified.
Prompt: