Skip to content

Fix Python emitter CI publish failure: stamp prerelease version in Build-Packages.ps1#10817

Merged
iscai-msft merged 11 commits into
microsoft:mainfrom
iscai-msft:fix/python-prerelease-version-stamping
May 29, 2026
Merged

Fix Python emitter CI publish failure: stamp prerelease version in Build-Packages.ps1#10817
iscai-msft merged 11 commits into
microsoft:mainfrom
iscai-msft:fix/python-prerelease-version-stamping

Conversation

@iscai-msft
Copy link
Copy Markdown
Member

Problem

The Python emitter's Build-Packages.ps1 script accepts a -Prerelease flag but never uses it to stamp the package version. Every CI build on main produces a package with the exact same version from package.json, causing npm publish to fail with a 409 conflict when publishing to the DevOps feed.

See failing build: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=6353671

Fix

Added prerelease version stamping that:

  1. Appends -alpha.{BuildNumber} (when -Prerelease) or -beta.{BuildNumber} to the version
  2. Updates package.json before npm pack so the tarball has the correct version

This matches the existing pattern used by the C# emitter's Build-Packages.ps1.

Changes

  • packages/http-client-python/eng/scripts/Build-Packages.ps1: Use -Prerelease and -BuildNumber params to stamp version before packaging

The Build-Packages.ps1 script accepted a -Prerelease flag but never used
it to stamp the package version. Every CI build on main produced a package
with the same version from package.json, causing npm publish to fail with
a 409 conflict when publishing to the DevOps feed.

Added prerelease version stamping (matching the pattern used by the C#
emitter) that appends -alpha.{BuildNumber} or -beta.{BuildNumber} to the
version and updates package.json before npm pack.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@microsoft-github-policy-service microsoft-github-policy-service Bot added the emitter:client:python Issue for the Python client emitter: @typespec/http-client-python label May 27, 2026
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 27, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@typespec/http-client-python@10817

commit: 08c6fdc

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 27, 2026

All changed packages have been documented.

  • @typespec/http-client-python
Show changes

@typespec/http-client-python - fix ✏️

Fix CI publish failures by stamping prerelease version in Build-Packages.ps1. The -Prerelease flag was accepted but unused, causing every CI build to produce the same version and fail with a 409 conflict on the DevOps feed.

@azure-sdk-automation
Copy link
Copy Markdown

azure-sdk-automation Bot commented May 27, 2026

You can try these changes here

🛝 Playground 🌐 Website 🛝 VSCode Extension

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@iscai-msft iscai-msft force-pushed the fix/python-prerelease-version-stamping branch from 24d3fa9 to 9e5527f Compare May 27, 2026 17:55
iscai-msft and others added 2 commits May 27, 2026 14:49
pnpm is not available in the CI build environment which only has npm/node.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add pnpm install step to the build-step template so chronus is available
in the CI environment.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
chronus is not in http-client-python's node_modules, so pnpm can't find
it. Install it globally alongside pnpm.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Comment thread packages/http-client-python/eng/scripts/Build-Packages.ps1 Outdated
Comment thread packages/http-client-python/eng/scripts/Build-Packages.ps1
Comment thread eng/emitters/pipelines/templates/steps/build-step.yml Outdated
iscai-msft and others added 6 commits May 28, 2026 13:59
…nus install

Address PR review comments:
- Remove global @chronus/chronus install from build-step.yml (pnpm chronus
  is already available)
- Replace chronus-based version stamping with direct package.json update
  using -alpha.$BuildNumber suffix, matching the C# emitter pattern
- This ensures each CI build produces a unique version, preventing 409
  conflicts on the DevOps feed

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Keep chronus-based prerelease (dev) versioning instead of alpha/BuildNumber.
Only run 'chronus version --prerelease' when there are pending change files
for @typespec/http-client-python, avoiding 409 conflicts when no changes
are queued.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Rewrite Build-Packages.ps1 to match C#'s proven approach:
- Use -alpha.$BuildNumber (prerelease) / -beta.$BuildNumber versioning
- Directly update package.json instead of using chronus
- Add Set-VersionVariable for ADO pipeline output variables
- Remove chronus dependency from build pipeline entirely

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add back the Linux-only lint step and package install verification
that were accidentally removed when aligning with C# pattern.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add -alpha.$BuildNumber (prerelease) or -beta.$BuildNumber version
stamping, matching the C# emitter pattern. The rest of the script
remains unchanged from main.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Neither Python nor C# build scripts use pnpm, so the global install
is unnecessary.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@iscai-msft
Copy link
Copy Markdown
Member Author

@timotheeguerin trying to align with csharp bc of concerns from @msyyc instead of using dev versions

@iscai-msft iscai-msft enabled auto-merge May 29, 2026 15:39
@iscai-msft iscai-msft added this pull request to the merge queue May 29, 2026
Merged via the queue into microsoft:main with commit 5020cb4 May 29, 2026
41 checks passed
@iscai-msft iscai-msft deleted the fix/python-prerelease-version-stamping branch May 29, 2026 17:49
msyyc added a commit to iscai-msft/typespec that referenced this pull request Jun 4, 2026
…on in Build-Packages.ps1" (microsoft#10881)

Reverts microsoft#10817

After discussion, we revert this PR to avoid duplicated alpha release
for same python emitter content.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

emitter:client:python Issue for the Python client emitter: @typespec/http-client-python eng

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants