From 91d8c52d6d03a8838e21c706e999bdd305652ef1 Mon Sep 17 00:00:00 2001 From: Douglas Yang Date: Mon, 19 Jan 2026 13:23:11 -0800 Subject: [PATCH] fix: updating pypi workflow with new base version formatting in pyproject.toml (#17366) --- .github/workflows/release-pypi-pr.yml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release-pypi-pr.yml b/.github/workflows/release-pypi-pr.yml index 537a542d6..4f7341474 100644 --- a/.github/workflows/release-pypi-pr.yml +++ b/.github/workflows/release-pypi-pr.yml @@ -38,8 +38,11 @@ jobs: - name: Generate PR wheel version id: gen_version run: | - # Get base version from version.py - BASE_VERSION=$(cat python/sglang/version.py | cut -d'"' -f2) + # Get base version from setuptools_scm + cd python + pip install setuptools-scm + BASE_VERSION=$(python -c "from setuptools_scm import get_version; print(get_version(root='..'))" | cut -d'+' -f1) + cd .. # Get commit info COMMIT_HASH=$(git rev-parse --short HEAD) @@ -68,15 +71,17 @@ jobs: - name: Update pyproject.toml with PR wheel version run: | cd python - BASE_VERSION=$(cat sglang/version.py | cut -d'"' -f2) WHEEL_VERSION="${{ steps.gen_version.outputs.wheel_version }}" - # Update version (temporary, not committed) - sed -i "s/version = \"${BASE_VERSION}\"/version = \"${WHEEL_VERSION}\"/" pyproject.toml + # Update pyproject.toml to use static version instead of dynamic + # Remove 'version' from dynamic list and add static version + sed -i 's/dynamic = \["version"\]/dynamic = []/' pyproject.toml + sed -i "/^name = \"sglang\"/a version = \"${WHEEL_VERSION}\"" pyproject.toml # Verify update echo "Updated version in pyproject.toml:" grep "^version" pyproject.toml + grep "^dynamic" pyproject.toml - name: Install build dependencies run: |