Skip to content

{Core} Read latest CLI versions from pyproject.toml in AME storage - #34360

Merged
Ethan Yang (necusjz) merged 1 commit into
Azure:devfrom
necusjz:fix-version-retrieval
Nov 5, 2026
Merged

Ethan Yang (necusjz) merged 1 commit into
Azure:devfrom
necusjz:fix-version-retrieval

Conversation

@necusjz

@necusjz Ethan Yang (necusjz) commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

🤖 PR Validation — ⚠️ Review suggested

Breaking Changes Tests Suppressions
️✔️ None ️✔️ 130/130 ⚠️ 1 added

This PR adds warning or check suppressions. Fix the underlying warning where possible and justify each remaining suppression in a code comment or the PR description.

1 added suppression
File Line Kind Code
src/azure-cli-core/azure/cli/core/util.py 315 pylint except Exception as ex: # pylint: disable=broad-except

Related command

Description

resolve: https://github.com/Azure/CLIPS/issues/987

get_latest_version_from_ame_storage finds the latest released versions of azure-cli, azure-cli-core and azure-cli-telemetry. It does this by fetching {package}/setup.py from the AME storage account and parsing the VERSION = "..." line. The packages have moved to pyproject.toml, so setup.py no longer exists in the repo.

Changes:

  • Read version = "..." from {AME_STORAGE_BASE_URL}/{package}/pyproject.toml first.
  • Fall back to the legacy setup.py (VERSION = "...") when pyproject.toml can't be fetched or has no version line. Only setup.py is in storage today, so this keeps az version / az upgrade working until the release pipeline uploads pyproject.toml. The fallback can be removed after that.
  • Simplify the parsing: one regex over the response text instead of a line-by-line scan.
  • Add unit tests in TestGetLatestVersionFromAmeStorage covering:
    • reading the version from pyproject.toml
    • falling back to setup.py on a 404
    • falling back when pyproject.toml has no version line
    • returning None when both requests fail

Testing Guide

History Notes

[Component Name 1] BREAKING CHANGE: az command a: Make some customer-facing breaking change
[Component Name 2] az command b: Add some customer-facing feature


This checklist is used to make sure that common guidelines for a pull request are followed.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues are identified for the version-lookup update.

No open issues 🎉

What changed in this PR

Updates Azure CLI’s latest-version lookup to support package metadata in pyproject.toml, while preserving compatibility with AME storage that still contains only setup.py.

Changes:

  • Fetches pyproject.toml first and falls back to setup.py if fetching fails or no version is found.
  • Replaces line-by-line parsing with a regex over the response text.
  • Adds unit tests for successful lookup, fallback behavior, and request failures.
File Description
src/​azure-cli-core/​azure/​cli/​core/​util.py Adds pyproject.toml version lookup with legacy fallback and updates storage documentation.
src/​azure-cli-core/​azure/​cli/​core/​tests/​test_util.py Adds four unit tests covering version lookup and fallback behavior.

Review effort: Balanced

@x-engineering-agent

Copy link
Copy Markdown
Contributor

Hi Ethan Yang (@necusjz),
Since the current milestone time is less than 7 days, this pr will be reviewed in the next milestone.

@necusjz
Ethan Yang (necusjz) marked this pull request as ready for review November 5, 2026 02:22
@yonzhan

Copy link
Copy Markdown
Collaborator

Core

@necusjz
Ethan Yang (necusjz) merged commit 577cea4 into Azure:dev Nov 5, 2026
65 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants