Skip to content

[CI/Build] Build NPU wheels for prerelease tags - #4574

Open
Manifold68575 wants to merge 7 commits into
kvcache-ai:mainfrom
Manifold68575:fix/npu-prerelease-wheels
Open

Manifold68575 wants to merge 7 commits into
kvcache-ai:mainfrom
Manifold68575:fix/npu-prerelease-wheels

Conversation

@Manifold68575

@Manifold68575 Manifold68575 commented Oct 11, 2026 •

Copy link
Copy Markdown

Description

NPU release jobs currently skip hyphenated tags, so v0.3.14-rc1 produces no NPU wheels. This change preserves the repository-wide rule that tags without a hyphen follow the stable path. Hyphenated tags must pass the existing testpypi_wheel_gate.py normalize-version public prerelease check; tags such as v0.3.13-1 and v0.3.13-post1 fail before any publication outputs are written. Both push and manual runs use this classification. The workflow builds prerelease wheels with a normalized PEP 440 version (v0.3.14-rc1 -> 0.3.14rc1), and uploads them to the corresponding GitHub Release with prerelease=true and make_latest=false.

Production PyPI publication is a separate job restricted to stable releases in the upstream repository. GitHub uploads no longer depend on the protected pypi environment. The native build matrix and stable wheel version handling are unchanged. Stable GitHub uploads leave make_latest empty to preserve the existing Latest flag; prerelease uploads explicitly set it to false.

Fixes #4405. A maintainer will still need to run the updated workflow manually to backfill the missing rc1 assets after merge; no release assets have been uploaded by this PR.

Related work: #3970 migrates wheel assembly to the root scikit-build backend and changes the same workflow's build steps. This PR addresses prerelease tag handling and publication policy, which #3970 does not cover. If that migration lands first, the prerelease version override will need to use its version interface.

Module

  • Transfer Engine (mooncake-transfer-engine)
  • Mooncake Store (mooncake-store)
  • Mooncake Conductor (mooncake-conductor)
  • Reshard (mooncake-reshard)
  • Mooncake EP (mooncake-ep)
  • Mooncake PG (mooncake-pg)
  • Integration (mooncake-integration)
  • P2P Store (mooncake-p2p-store)
  • Python Wheel (mooncake-wheel)
  • Common (mooncake-common)
  • Mooncake RL (mooncake-rl)
  • CI/CD
  • Docs
  • Other

Type of Change

  • Bug fix
  • New feature
  • Refactor
  • Breaking change
  • Documentation update
  • Performance improvement
  • Other

How Has This Been Tested?

Test commands:

# WSL Ubuntu 24.04, Python 3.12 virtual environment with packaging, PyYAML and pytest.
python -m unittest discover -s scripts/ci/tests -v
python -m pytest -q mooncake-wheel/tests/test_testpypi_wheel_gate.py --confcutdir=mooncake-wheel/tests
pre-commit run --files .github/workflows/release-npu.yaml scripts/ci/tests/test_npu_release.py
actionlint -shellcheck= -pyflakes= .github/workflows/release-npu.yaml
git diff --check origin/main...HEAD

Test results:

  • Unit tests pass: 21 CI script tests (including 3 new NPU release tests) and 6 existing wheel gate tests.
  • Integration tests pass (if applicable): full Ascend/CANN wheel builds and real publication were not run locally.
  • Manual testing done: scoped pre-commit, actionlint 1.7.12 and whitespace checks pass. Shellcheck/pyflakes were unavailable and their actionlint subchecks were disabled.

The new tests execute the workflow's actual tag parser and version override commands. They cover seven accepted tags and eight rejected inputs, including the two hyphenated post-release tags raised in review and rejection before exporting outputs. They also execute the temporary wheel version override. Exact-expression workflow assertions were removed following review; the normalization command uses the existing shared prerelease gate. The regression cases failed against the previous PR revision and passed after the classification fix. The tests failed against the original workflow before the implementation was added. The final committed files were compared byte-for-byte with the independently checked WSL copies.

Ordinary PR CI discovers these unit tests; the tag/manual NPU release workflow still needs maintainer validation for the full build matrix and publication.

Checklist

  • I have performed a self-review of my own code
  • I have formatted my code using ./scripts/code_format.sh (not applicable: no C/C++ changes; Python formatting passed through pre-commit)
  • I have run pre-commit on the files changed in this PR and all hooks pass
  • I have updated the documentation (not applicable: scoped release workflow fix)
  • I have added tests to prove my changes are effective
  • For changes >500 LOC: I have filed an RFC issue (not applicable: 2 files, 181 insertions and 15 deletions; no architecture change)

AI Assistance Disclosure

  • No AI tools were used
  • AI tools were used (specify below)

OpenAI Codex assisted with issue and workflow investigation, implementation, regression tests, local validation, and PR preparation. The human submitter confirmed reviewing every changed line and being able to explain and defend the initial fix, and authorized the follow-up changes addressing the three maintainer review comments. Codex implemented and tested those follow-up changes.

Copilot AI balanced review requested due to automatic review settings October 11, 2026 07:05

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@Aionw Aionw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for picking up #4405. The direction looks right to me: prerelease NPU wheels go to the GitHub Pre-release, and PyPI publication stays limited to stable releases in the upstream repo. A few notes before merging.

Blocking: NPU's stable/prerelease classification no longer matches the other release workflows

Today every release workflow uses the same coarse rule: a tag containing - is never a stable release. release.yaml, release-cuda13, release-non-cuda and the three EFA workflows all gate on !contains(github.ref_name, '-'). MUSA and ROCm reject *-* tags in their dispatch validation. pre-release.yaml only matches v*-rc*, v*-alpha*, v*-beta* and v*-pre*. The rule is crude, but all workflows agree on it, so a tag is either published to PyPI by all of them or by none.

This PR switches NPU to "whatever packaging.Version accepts". As a result, NPU disagrees with the other workflows on hyphenated tags that PEP 440 normalizes to stable versions:

Tag Other release workflows NPU after this PR
v0.3.14-rc1 GitHub Pre-release (CUDA family) GitHub Pre-release ✅
v0.3.13-1, v0.3.13-post1 all skipped published to PyPI as stable

For the second row, packaging parses both tags as 0.3.13.post1 with is_prerelease=False. The NPU wheel would then go to production PyPI on its own, while every other package skips the tag. Because the stable path doesn't override the version, that wheel also carries whatever version pyproject.toml has, not the tag's. A PyPI filename can't be reused even after deletion, so a mistaken tag like this can't be undone.

Historically every patch release has used .postN and every hyphenated tag has been alpha/beta/rc, so this is unlikely to happen. But the cost is irreversible and the fix is small. I'd suggest keeping the repo-wide rule and adding prerelease handling only on the hyphenated branch:

  • no - in the tag: stable, exactly as before;
  • - in the tag: must pass scripts/ci/testpypi_wheel_gate.py normalize-version, the same check pre-release.yaml uses (it requires is_prerelease and rejects local versions); otherwise fail.

This also removes the duplicated normalization logic: pre-release.yaml and this workflow would share one definition of "prerelease tag" instead of two slightly different ones. The cost is one checkout step in version-stamp.

Non-blocking

  • make_latest: 'legacy' changes stable behavior; see the inline comment.
  • Most of the new tests assert the workflow's exact expression strings; see the inline comment.

Also note that after merging, a maintainer still needs to dispatch the workflow manually to backfill the v0.3.14-rc1 NPU wheels.

- name: Install version parser
run: python -m pip install packaging

- name: Normalize release tag

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This accepts any tag that packaging.Version parses, so v0.3.13-1 and v0.3.13-post1 (both parse as 0.3.13.post1) are classified as stable and reach publish-pypi, while every other release workflow skips hyphenated tags. See the review summary.

Suggest keeping the stable path for tags without -, and requiring hyphenated tags to pass the existing check, so NPU and pre-release.yaml share one rule:

if [[ "$RELEASE_TAG" == *-* ]]; then
  version=$(python scripts/ci/testpypi_wheel_gate.py normalize-version --tag "$RELEASE_TAG")
  echo "is_prerelease=true" >> "$GITHUB_OUTPUT"
else
  # stable: unchanged behavior
  ...
fi

Comment thread .github/workflows/release-npu.yaml Outdated
tag_name: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref_name }}
tag_name: ${{ needs.version-stamp.outputs.release_tag }}
prerelease: ${{ needs.version-stamp.outputs.is_prerelease == 'true' }}
make_latest: ${{ needs.version-stamp.outputs.is_prerelease == 'true' && 'false' || 'legacy' }}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nit: on stable releases this used to omit make_latest. The release is usually created first by release.yaml (still on softprops/action-gh-release@v1), and an update without make_latest leaves the Latest flag alone. Now NPU always sends legacy on update. Passing an empty string keeps the old behavior, because softprops drops the field when the input is empty:

make_latest: ${{ needs.version-stamp.outputs.is_prerelease == 'true' && 'false' || '' }}

Comment thread scripts/ci/tests/test_npu_release.py Outdated
self.assertNotEqual(result.returncode, 0)
self.assertEqual(values, {})

def test_build_uses_validated_tag_for_push_and_manual_runs(self):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nit: the tests that run the normalizer and the sed override check real behavior, which is useful. This test and test_github_prereleases_are_separate_from_production_pypi mostly restate the workflow's if: / needs: expressions verbatim, so any refactor (e.g. #3970) breaks them even when the behavior is unchanged. I'd keep only the behavioral tests. If the classification moves into testpypi_wheel_gate.py as suggested, those tests can import the function directly instead of extracting a run: block from YAML.

@Manifold68575

Copy link
Copy Markdown
Author

@Aionw Thank you for the careful review and for catching the publication-policy mismatch. I have pushed three small follow-up commits addressing all three points:

  • 8ab94dba: removed the tests that compared workflow expressions verbatim, retained the command-level behavioral tests, and added regression cases for the hyphenated post-release tags and the repository's no-hyphen classification rule.
  • e88442d2: added the release-gate checkout and reused scripts/ci/testpypi_wheel_gate.py normalize-version for hyphenated tags. v0.3.13-1 and v0.3.13-post1 now fail before exporting publication outputs; tags without a hyphen keep the existing stable path.
  • d670195b: changed the stable make_latest input to an empty string so the existing Latest flag is preserved. Prerelease uploads still pass false.

Local validation passed: all 21 CI script tests (including 3 NPU behavioral tests), all 6 existing wheel-gate tests, scoped pre-commit, actionlint, and git diff --check. The newly added classification regressions failed against the previous revision before the fix. I also updated the PR description and test counts to match the final changes.

The updated PR CI has been triggered. Full Ascend/CANN builds and real publication remain unvalidated locally, and the historical rc1 backfill still needs a maintainer dispatch after merge. I would appreciate another look when you have time. Thank you again for helping keep this aligned with the other release workflows.

Signed-off-by: Manifold68575 <14250491@cumt.edu.cn>

This branch has not been deployed

No deployments
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.

[Feature Request]: NPU wheels for pre-release versions

3 participants