Skip to content

Commit 6c536a0

Browse files
committed
ci: Customize wheel filename to improve version identification
- Parse generated wheel filenames in the build step. - Append CUDA version (cuXXX) and AVX level (basic/avx2) to the version string. - New format: package-ver+cuXXX.avxver-pyver-plat.whl (e.g., llama_cpp_python-0.3.22+cu130.basic-cp310-win_amd64.whl). - Keep the git release tag clean (without local version identifiers).
1 parent f7e5307 commit 6c536a0

7 files changed

Lines changed: 128 additions & 67 deletions

.github/workflows/build-wheels-cu124-cu126-win.yml

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,27 @@ jobs:
9595
exit 1
9696
}
9797
98+
$wheelFile = Get-Item '.\dist\*.whl' | Select-Object -First 1
99+
100+
# Split wheel filename: name-ver-py-abi-plat.whl
101+
$parts = $wheelFile.Name.Split('-')
102+
$distName = $parts[0]
103+
$version = $parts[1]
104+
$pyTag = $parts[2]
105+
$abiTag = $parts[3]
106+
$platTag = $parts[4]
107+
108+
$newVersion = "$version+cu$cudaVersion.$($env:AVXVER.ToLower())"
109+
110+
$newName = "$distName-$newVersion-$pyTag-$platTag"
111+
112+
# Rename wheel file
113+
Rename-Item -Path $wheelFile.FullName -NewName $newName
114+
Write-Output "Renamed wheel to: $newName"
115+
98116
# write the build tag to the output
99117
Write-Output "CUDA_VERSION=$cudaVersion" >> $env:GITHUB_ENV
100-
101-
$wheel = (gi '.\dist\*.whl')[0]
102-
$tagVer = $wheel.name.split('-')[1]
103-
Write-Output "TAG_VERSION=$tagVer" >> $env:GITHUB_ENV
118+
Write-Output "TAG_VERSION=$version" >> $env:GITHUB_ENV
104119
105120
- name: Get Current Date
106121
id: get-date
@@ -113,7 +128,7 @@ jobs:
113128
uses: softprops/action-gh-release@v2
114129
with:
115130
files: dist/*
116-
# Set tag_name to <tag>-cu<cuda_version>-<date>-win
131+
# Set tag_name to <tag>-cu<cuda_version>-<avxver>-win-<date>
117132
tag_name: v${{ env.TAG_VERSION }}-cu${{ env.CUDA_VERSION }}-${{ env.AVXVER }}-win-${{ env.BUILD_DATE }}
118133
env:
119134
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/build-wheels-cu124-linux.yml

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ jobs:
5858
run: |
5959
echo "VERBOSE=1" >> $GITHUB_ENV # Enable verbose build output for troubleshooting
6060
find /usr/ -name 'libcuda.so.*'
61+
find /usr/ -name 'libcudart.so.*'
6162
echo $LD_LIBRARY_PATH
6263
6364
# Add project-specific and feature flags
@@ -88,25 +89,28 @@ jobs:
8889
8990
# Run the Python build command to generate the wheel
9091
uv pip install build setuptools wheel packaging
91-
# uv pip install -U torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu126
9292
CMAKE_ARGS=${CMAKE_ARGS} uv build --wheel
9393
94-
# --- Post-build steps to get info for release tag ---
94+
# --- Post-build steps to get info for rename wheel file and release tag ---
9595
96-
# Find the generated wheel file in the 'dist' directory using bash
97-
# Assumes only one wheel is generated per build configuration run
98-
wheel_file=$(ls dist/*.whl | head -n 1)
96+
cuda_ver_short=$(echo "${CUDAVER}" | cut -d'.' -f 1,2 | sed 's/\.//g')
97+
avx_ver=$(echo "${AVXVER}" | tr '[:upper:]' '[:lower:]')
9998
100-
# Extract the package version (e.g., 1.2.3) from the wheel filename
101-
# Filename format is typically: package_name-version-tag-specificators.whl
102-
# Using basename and cut to split by '-' and get the second field
103-
tag_ver=$(basename "$wheel_file" | cut -d'-' -f 2)
104-
echo "TAG_VERSION=$tag_ver" >> $GITHUB_ENV # Store version in env for release step
99+
wheel_path=$(ls dist/*.whl | head -n 1)
100+
filename=$(basename "$wheel_path")
105101
106-
# Extract the short CUDA version (e.g., 124) from the full version (e.g., 12.4.1) from the matrix variable
107-
cuda_ver_short=$(echo "${CUDAVER}" | cut -d'.' -f 1,2 | sed 's/\.//g')
108-
echo "CUDA_VERSION=$cuda_ver_short" >> $GITHUB_ENV # Store short CUDA version in env
102+
# Split wheel filename
103+
IFS='-' read -r dist_name version py_tag abi_tag plat_tag <<< "$filename"
109104
105+
new_version="${version}+cu${cuda_ver_short}.${avx_ver}"
106+
new_filename="${dist_name}-${new_version}-${py_tag}-${plat_tag}"
107+
108+
# Rename wheel file
109+
mv "$wheel_path" "dist/$new_filename"
110+
echo "Renamed wheel to: $new_filename"
111+
112+
echo "CUDA_VERSION=$cuda_ver_short" >> $GITHUB_ENV # Store short CUDA version in env
113+
echo "TAG_VERSION=$version" >> $GITHUB_ENV # Store version in env for release step
110114
111115
- name: Get Current Date # Step to get current date for the release tag
112116
id: get-date

.github/workflows/build-wheels-cu126-linux.yml

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ jobs:
5858
run: |
5959
echo "VERBOSE=1" >> $GITHUB_ENV # Enable verbose build output for troubleshooting
6060
find /usr/ -name 'libcuda.so.*'
61+
find /usr/ -name 'libcudart.so.*'
6162
echo $LD_LIBRARY_PATH
6263
6364
# Add project-specific and feature flags
@@ -88,25 +89,28 @@ jobs:
8889
8990
# Run the Python build command to generate the wheel
9091
uv pip install build setuptools wheel packaging
91-
# uv pip install -U torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu126
9292
CMAKE_ARGS=${CMAKE_ARGS} uv build --wheel
9393
94-
# --- Post-build steps to get info for release tag ---
94+
# --- Post-build steps to get info for rename wheel file and release tag ---
9595
96-
# Find the generated wheel file in the 'dist' directory using bash
97-
# Assumes only one wheel is generated per build configuration run
98-
wheel_file=$(ls dist/*.whl | head -n 1)
96+
cuda_ver_short=$(echo "${CUDAVER}" | cut -d'.' -f 1,2 | sed 's/\.//g')
97+
avx_ver=$(echo "${AVXVER}" | tr '[:upper:]' '[:lower:]')
9998
100-
# Extract the package version (e.g., 1.2.3) from the wheel filename
101-
# Filename format is typically: package_name-version-tag-specificators.whl
102-
# Using basename and cut to split by '-' and get the second field
103-
tag_ver=$(basename "$wheel_file" | cut -d'-' -f 2)
104-
echo "TAG_VERSION=$tag_ver" >> $GITHUB_ENV # Store version in env for release step
99+
wheel_path=$(ls dist/*.whl | head -n 1)
100+
filename=$(basename "$wheel_path")
105101
106-
# Extract the short CUDA version (e.g., 126) from the full version (e.g., 12.6.3) from the matrix variable
107-
cuda_ver_short=$(echo "${CUDAVER}" | cut -d'.' -f 1,2 | sed 's/\.//g')
108-
echo "CUDA_VERSION=$cuda_ver_short" >> $GITHUB_ENV # Store short CUDA version in env
102+
# Split wheel filename
103+
IFS='-' read -r dist_name version py_tag abi_tag plat_tag <<< "$filename"
109104
105+
new_version="${version}+cu${cuda_ver_short}.${avx_ver}"
106+
new_filename="${dist_name}-${new_version}-${py_tag}-${plat_tag}"
107+
108+
# Rename wheel file
109+
mv "$wheel_path" "dist/$new_filename"
110+
echo "Renamed wheel to: $new_filename"
111+
112+
echo "CUDA_VERSION=$cuda_ver_short" >> $GITHUB_ENV # Store short CUDA version in env
113+
echo "TAG_VERSION=$version" >> $GITHUB_ENV # Store version in env for release step
110114
111115
- name: Get Current Date # Step to get current date for the release tag
112116
id: get-date

.github/workflows/build-wheels-cu128-linux.yml

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ jobs:
5858
run: |
5959
echo "VERBOSE=1" >> $GITHUB_ENV # Enable verbose build output for troubleshooting
6060
find /usr/ -name 'libcuda.so.*'
61+
find /usr/ -name 'libcudart.so.*'
6162
echo $LD_LIBRARY_PATH
6263
6364
# Add project-specific and feature flags
@@ -88,25 +89,28 @@ jobs:
8889
8990
# Run the Python build command to generate the wheel
9091
uv pip install build setuptools wheel packaging
91-
# uv pip install -U torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu128
9292
CMAKE_ARGS=${CMAKE_ARGS} uv build --wheel
9393
94-
# --- Post-build steps to get info for release tag ---
94+
# --- Post-build steps to get info for rename wheel file and release tag ---
9595
96-
# Find the generated wheel file in the 'dist' directory using bash
97-
# Assumes only one wheel is generated per build configuration run
98-
wheel_file=$(ls dist/*.whl | head -n 1)
96+
cuda_ver_short=$(echo "${CUDAVER}" | cut -d'.' -f 1,2 | sed 's/\.//g')
97+
avx_ver=$(echo "${AVXVER}" | tr '[:upper:]' '[:lower:]')
9998
100-
# Extract the package version (e.g., 1.2.3) from the wheel filename
101-
# Filename format is typically: package_name-version-tag-specificators.whl
102-
# Using basename and cut to split by '-' and get the second field
103-
tag_ver=$(basename "$wheel_file" | cut -d'-' -f 2)
104-
echo "TAG_VERSION=$tag_ver" >> $GITHUB_ENV # Store version in env for release step
99+
wheel_path=$(ls dist/*.whl | head -n 1)
100+
filename=$(basename "$wheel_path")
105101
106-
# Extract the short CUDA version (e.g., 128) from the full version (e.g., 12.8.1) from the matrix variable
107-
cuda_ver_short=$(echo "${CUDAVER}" | cut -d'.' -f 1,2 | sed 's/\.//g')
108-
echo "CUDA_VERSION=$cuda_ver_short" >> $GITHUB_ENV # Store short CUDA version in env
102+
# Split wheel filename
103+
IFS='-' read -r dist_name version py_tag abi_tag plat_tag <<< "$filename"
109104
105+
new_version="${version}+cu${cuda_ver_short}.${avx_ver}"
106+
new_filename="${dist_name}-${new_version}-${py_tag}-${plat_tag}"
107+
108+
# Rename wheel file
109+
mv "$wheel_path" "dist/$new_filename"
110+
echo "Renamed wheel to: $new_filename"
111+
112+
echo "CUDA_VERSION=$cuda_ver_short" >> $GITHUB_ENV # Store short CUDA version in env
113+
echo "TAG_VERSION=$version" >> $GITHUB_ENV # Store version in env for release step
110114
111115
- name: Get Current Date # Step to get current date for the release tag
112116
id: get-date

.github/workflows/build-wheels-cu128-win.yml

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,27 @@ jobs:
9595
exit 1
9696
}
9797
98+
$wheelFile = Get-Item '.\dist\*.whl' | Select-Object -First 1
99+
100+
# Split file name: name-ver-py-abi-plat.whl
101+
$parts = $wheelFile.Name.Split('-')
102+
$distName = $parts[0]
103+
$version = $parts[1]
104+
$pyTag = $parts[2]
105+
$abiTag = $parts[3]
106+
$platTag = $parts[4]
107+
108+
$newVersion = "$version+cu$cudaVersion.$($env:AVXVER.ToLower())"
109+
110+
$newName = "$distName-$newVersion-$pyTag-$platTag"
111+
112+
# Rename wheel file
113+
Rename-Item -Path $wheelFile.FullName -NewName $newName
114+
Write-Output "Renamed wheel to: $newName"
115+
98116
# write the build tag to the output
99117
Write-Output "CUDA_VERSION=$cudaVersion" >> $env:GITHUB_ENV
100-
101-
$wheel = (gi '.\dist\*.whl')[0]
102-
$tagVer = $wheel.name.split('-')[1]
103-
Write-Output "TAG_VERSION=$tagVer" >> $env:GITHUB_ENV
118+
Write-Output "TAG_VERSION=$version" >> $env:GITHUB_ENV
104119
105120
- name: Get Current Date
106121
id: get-date
@@ -113,7 +128,7 @@ jobs:
113128
uses: softprops/action-gh-release@v2
114129
with:
115130
files: dist/*
116-
# Set tag_name to <tag>-cu<cuda_version>-<date>-win
131+
# Set tag_name to <tag>-cu<cuda_version>-<avxver>-win-<date>
117132
tag_name: v${{ env.TAG_VERSION }}-cu${{ env.CUDA_VERSION }}-${{ env.AVXVER }}-win-${{ env.BUILD_DATE }}
118133
env:
119134
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/build-wheels-cu130-linux.yml

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ jobs:
5858
run: |
5959
echo "VERBOSE=1" >> $GITHUB_ENV # Enable verbose build output for troubleshooting
6060
find /usr/ -name 'libcuda.so.*'
61+
find /usr/ -name 'libcudart.so.*'
6162
echo $LD_LIBRARY_PATH
6263
6364
# Add project-specific and feature flags
@@ -88,25 +89,28 @@ jobs:
8889
8990
# Run the Python build command to generate the wheel
9091
uv pip install build setuptools wheel packaging
91-
# uv pip install -U torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu130
9292
CMAKE_ARGS=${CMAKE_ARGS} uv build --wheel
9393
94-
# --- Post-build steps to get info for release tag ---
94+
# --- Post-build steps to get info for rename wheel file and release tag ---
9595
96-
# Find the generated wheel file in the 'dist' directory using bash
97-
# Assumes only one wheel is generated per build configuration run
98-
wheel_file=$(ls dist/*.whl | head -n 1)
96+
cuda_ver_short=$(echo "${CUDAVER}" | cut -d'.' -f 1,2 | sed 's/\.//g')
97+
avx_ver=$(echo "${AVXVER}" | tr '[:upper:]' '[:lower:]')
9998
100-
# Extract the package version (e.g., 1.2.3) from the wheel filename
101-
# Filename format is typically: package_name-version-tag-specificators.whl
102-
# Using basename and cut to split by '-' and get the second field
103-
tag_ver=$(basename "$wheel_file" | cut -d'-' -f 2)
104-
echo "TAG_VERSION=$tag_ver" >> $GITHUB_ENV # Store version in env for release step
99+
wheel_path=$(ls dist/*.whl | head -n 1)
100+
filename=$(basename "$wheel_path")
105101
106-
# Extract the short CUDA version (e.g., 130) from the full version (e.g., 13.0.2) from the matrix variable
107-
cuda_ver_short=$(echo "${CUDAVER}" | cut -d'.' -f 1,2 | sed 's/\.//g')
108-
echo "CUDA_VERSION=$cuda_ver_short" >> $GITHUB_ENV # Store short CUDA version in env
102+
# Split wheel filename
103+
IFS='-' read -r dist_name version py_tag abi_tag plat_tag <<< "$filename"
109104
105+
new_version="${version}+cu${cuda_ver_short}.${avx_ver}"
106+
new_filename="${dist_name}-${new_version}-${py_tag}-${plat_tag}"
107+
108+
# Rename wheel file
109+
mv "$wheel_path" "dist/$new_filename"
110+
echo "Renamed wheel to: $new_filename"
111+
112+
echo "CUDA_VERSION=$cuda_ver_short" >> $GITHUB_ENV # Store short CUDA version in env
113+
echo "TAG_VERSION=$version" >> $GITHUB_ENV # Store version in env for release step
110114
111115
- name: Get Current Date # Step to get current date for the release tag
112116
id: get-date

.github/workflows/build-wheels-cu130-win.yml

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,27 @@ jobs:
9595
exit 1
9696
}
9797
98+
$wheelFile = Get-Item '.\dist\*.whl' | Select-Object -First 1
99+
100+
# Split file name: name-ver-py-abi-plat.whl
101+
$parts = $wheelFile.Name.Split('-')
102+
$distName = $parts[0]
103+
$version = $parts[1]
104+
$pyTag = $parts[2]
105+
$abiTag = $parts[3]
106+
$platTag = $parts[4]
107+
108+
$newVersion = "$version+cu$cudaVersion.$($env:AVXVER.ToLower())"
109+
110+
$newName = "$distName-$newVersion-$pyTag-$platTag"
111+
112+
# Rename wheel file
113+
Rename-Item -Path $wheelFile.FullName -NewName $newName
114+
Write-Output "Renamed wheel to: $newName"
115+
98116
# write the build tag to the output
99117
Write-Output "CUDA_VERSION=$cudaVersion" >> $env:GITHUB_ENV
100-
101-
$wheel = (gi '.\dist\*.whl')[0]
102-
$tagVer = $wheel.name.split('-')[1]
103-
Write-Output "TAG_VERSION=$tagVer" >> $env:GITHUB_ENV
118+
Write-Output "TAG_VERSION=$version" >> $env:GITHUB_ENV
104119
105120
- name: Get Current Date
106121
id: get-date
@@ -113,7 +128,7 @@ jobs:
113128
uses: softprops/action-gh-release@v2
114129
with:
115130
files: dist/*
116-
# Set tag_name to <tag>-cu<cuda_version>-<date>-win
131+
# Set tag_name to <tag>-cu<cuda_version>-<avxver>-win-<date>
117132
tag_name: v${{ env.TAG_VERSION }}-cu${{ env.CUDA_VERSION }}-${{ env.AVXVER }}-win-${{ env.BUILD_DATE }}
118133
env:
119134
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)