Skip to content

Fix invalid PyPI package versions after shared-script sync - #3985

Merged
msalaman merged 5 commits into
mainfrom
msalaman-pypi-packaging-failure
Oct 19, 2026
Merged

msalaman merged 5 commits into
mainfrom
msalaman-pypi-packaging-failure

Conversation

@msalaman

@msalaman msalaman commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Suppress the unused return value from SetupPythonConventions() in ConvertTo-PythonPackageVersion so the converter returns only the Python package version.

The shared engineering-script sync in #3939 changed SetupPythonConventions() from returning void to returning a regex string. The existing caller emitted that regex alongside the version, creating a System.Object[]. Calling .ToString() on the array then wrote version = "System.Object[]" into pyproject.toml, causing Hatchling to reject the wheel build.

This PR makes the one-line caller fix without modifying shared engineering scripts, adds five regression tests covering stable, beta, alpha, build-number, and invalid versions, and verifies generated pyproject.toml version metadata. No changelog entry is needed because this is an internal packaging change. MCP tool checklist sections below are not applicable: no tools or tool descriptions changed.

Validation

  • Invoke-Pester -Path .\eng\scripts\Pack-Pypi.Tests.ps1 -CI -Output Detailed — passed, 5 tests.
  • Confirmed in-memory reproduction: the original converter returns an array whose .ToString() is System.Object[]; the fixed converter returns the scalar string 1.2.3b4 for 1.2.3-beta.4.
  • git diff --cached --check — passed before committing.
  • dotnet build .\servers\Azure.Mcp.Server\src\Azure.Mcp.Server.csproj --no-restore --verbosity quiet — blocked: global.json requires SDK 10.0.401; this machine has 9.0.315 and 10.0.113. Retried after the changelog removal with the same result.
  • .\eng\scripts\Build-Local.ps1 -VerifyNpx — blocked by the same missing SDK during project-property discovery; npm package verification did not run.
  • .\eng\common\spelling\Invoke-Cspell.ps1 -FileList @('eng\scripts\Pack-Pypi.ps1', 'eng\scripts\Pack-Pypi.Tests.ps1', 'servers\Azure.Mcp.Server\changelog-entries\msalaman-fix-pypi-version.yaml') — blocked: CSpell requires Node.js >=22.18.0, but this machine has 22.16.0. The wrapper exited zero, but CSpell rejected the runtime, so this is not a successful spelling check. This attempt preceded removal of the changelog entry.
  • Full .NET test suites and end-to-end wheel packaging were not run; the targeted regression tests require neither server binaries nor Python dependency installation.

GitHub issue number?

No linked issue. Fixes a packaging regression introduced by #3939.

Pre-merge Checklist

  • Required for All PRs
    • Read contribution guidelines
    • PR title clearly describes the change
    • Commit history is clean with descriptive messages (cleanup guide)
    • Added comprehensive tests for new/modified functionality
    • Created a changelog entry if the change falls among the following: new feature, bug fix, UI/UX update, breaking change, or updated dependencies. Follow the changelog entry guide — N/A: internal packaging change; removed at the author's request.
  • For MCP tool changes:
    • One tool per PR: This PR adds or modifies only one MCP tool for faster review cycles
    • Updated servers/Azure.Mcp.Server/README.md and/or servers/Fabric.Mcp.Server/README.md documentation
    • Validate README.md changes running the script ./eng/scripts/Process-PackageReadMe.ps1. See Package README
    • For new or modified tool descriptions (excluding Fabric MCP tools), ran ToolDescriptionEvaluator and obtained a score of 0.4 or more and a top 3 ranking for all related test prompts
    • For tools with new names, including new tools or renamed tools, update consolidated-tools.json
    • For renamed tools, follow the Tool Rename Checklist and tag the PR with the breaking-change label
    • For new tools associated with Azure services or publicly available tools/APIs/products, add URL to documentation in the PR description
  • Extra steps for Azure MCP Server tool changes:
    • Updated command list in servers/Azure.Mcp.Server/docs/azmcp-commands.md
    • Ran ./eng/scripts/Update-AzCommandsMetadata.ps1 to update tool metadata in azmcp-commands.md (required for CI)
    • Updated test prompts in servers/Azure.Mcp.Server/docs/e2eTestPrompts.md
    • 👉 For Community (non-Microsoft team member) PRs:
      • Security review: Reviewed code for security vulnerabilities, malicious code, or suspicious activities before running tests (crypto mining, spam, data exfiltration, etc.)
      • Manual tests run: added comment /azp run mcp - pullrequest - live to run Live Test Pipeline

Invoking Livetests

Copilot submitted PRs are not trustworthy by default. Users with write access to the repo need to validate the contents of this PR before leaving a comment with the text /azp run mcp - pullrequest - live. This will trigger the necessary livetest workflows to complete required validation.

Discard the regex returned by SetupPythonConventions so package versions remain scalar strings. Add regression coverage for stable, prerelease, build-number, and invalid versions, including generated project metadata.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 8dc224e5-c470-4102-83cc-c5b85948aaf5
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
There may be pipelines that require an authorized user to comment /azp run to run.

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

The narrow fix directly addresses the regression, with targeted test coverage and no identified blocking issues.

No open issues 🎉

What changed in this PR

Fixes PyPI packaging after the shared-script sync by preventing an unused return value from corrupting package versions.

Changes:

  • Suppresses output from SetupPythonConventions().
  • Adds five regression tests covering version conversion and generated metadata.
  • Records the packaging fix in the changelog.
File Description
servers/​Azure.Mcp.Server/​changelog-entries/​msalaman-fix-pypi-version.yaml Documents the packaging fix.
eng/​scripts/​Pack-Pypi.Tests.ps1 Tests version conversion and metadata.
eng/​scripts/​Pack-Pypi.ps1 Prevents extra output from entering package versions.

Review effort: Balanced

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 8dc224e5-c470-4102-83cc-c5b85948aaf5
@msalaman

Copy link
Copy Markdown
Contributor Author

Copilot resolve the merge conflicts in this pull request

…ng-failure

# Conflicts:
#	eng/scripts/Pack-Pypi.Tests.ps1

Co-authored-by: msalaman <28122166+msalaman@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 8dc224e5-c470-4102-83cc-c5b85948aaf5
@msalaman
msalaman enabled auto-merge (squash) October 19, 2026 17:06
@msalaman
msalaman disabled auto-merge October 19, 2026 18:19
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 8dc224e5-c470-4102-83cc-c5b85948aaf5
@msalaman
msalaman enabled auto-merge (squash) October 19, 2026 19:07
@msalaman
msalaman merged commit 097c47d into main Oct 19, 2026
20 checks passed
@msalaman
msalaman deleted the msalaman-pypi-packaging-failure branch October 19, 2026 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

server-Azure.Mcp Azure.Mcp.Server

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants