From 4be853e1c6f890abfc46cae19a3268f49167fcd5 Mon Sep 17 00:00:00 2001 From: Kangyan-Zhou Date: Sat, 25 Apr 2026 22:14:45 -0700 Subject: [PATCH] [CI] release-whl-kernel: strip +cu129 local version before PyPI upload (#23749) Co-authored-by: Claude Opus 4.7 (1M context) --- .github/workflows/release-whl-kernel.yml | 33 +++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release-whl-kernel.yml b/.github/workflows/release-whl-kernel.yml index 128f79be2..98f6f24ea 100644 --- a/.github/workflows/release-whl-kernel.yml +++ b/.github/workflows/release-whl-kernel.yml @@ -78,11 +78,42 @@ jobs: BUILD_JOBS: 64 NVCC_THREADS: 8 + # rename_wheels.sh tags the cu129 wheel's METADATA Version with +cu129 + # (needed elsewhere — e.g. local install discrimination — see PR #23587), + # but PyPI rejects PEP 440 local version labels with HTTP 400. Repack a + # PyPI-clean copy with the +cu129 segment stripped into dist-pypi/, and + # upload that copy. dist/ is left untouched so the +cu129 wheel still + # flows through the upload-artifact -> sgl-project/whl index path below. + - name: Strip +cu129 local version for PyPI upload + working-directory: sgl-kernel + run: | + set -eux + pip install wheel + mkdir -p dist-pypi + for w in dist/*.whl; do + tmp=$(mktemp -d) + python3 -m wheel unpack "$w" --dest "$tmp" + unpacked=$(find "$tmp" -mindepth 1 -maxdepth 1 -type d | head -1) + info=$(find "$unpacked" -maxdepth 1 -type d -name "*.dist-info" | head -1) + meta="$info/METADATA" + orig=$(grep '^Version:' "$meta" | head -1 | sed 's/^Version:[[:space:]]*//') + new=$(echo "$orig" | sed 's/+cu[0-9]\+$//') + if [ "$orig" != "$new" ]; then + sed -i "s/^Version:.*/Version: ${new}/" "$meta" + old_base=$(basename "$info") + new_base="${old_base/${orig}/${new}}" + mv "$info" "$(dirname "$info")/${new_base}" + fi + python3 -m wheel pack "$unpacked" --dest-dir dist-pypi + rm -rf "$tmp" + done + ls -lh dist-pypi/ + - name: Upload to PyPI working-directory: sgl-kernel run: | pip install twine - python3 -m twine upload --skip-existing dist/* -u __token__ -p ${{ secrets.PYPI_TOKEN_SGLANG_KERNEL }} + python3 -m twine upload --skip-existing dist-pypi/* -u __token__ -p ${{ secrets.PYPI_TOKEN_SGLANG_KERNEL }} - name: Upload artifacts uses: actions/upload-artifact@v4