fix: updating pypi workflow with new base version formatting in pyproject.toml (#17366)

This commit is contained in:
Douglas Yang
2026-01-19 13:23:11 -08:00
committed by GitHub
parent e9a44ea607
commit 91d8c52d6d
+10 -5
View File
@@ -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: |