Skip to content

Commit 9d1e21d

Browse files
committed
Add 3.13t build CI jobs for Linux
1 parent 09823ee commit 9d1e21d

File tree

4 files changed

+96
-21
lines changed

4 files changed

+96
-21
lines changed

.github/workflows/_build_linux.yml

+37-5
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ on:
66
python-version:
77
required: true
88
type: string
9+
free-threaded:
10+
description: 'Whether FT Python or not. Valid value is "ft" or not.'
11+
default: ''
12+
type: string
913
arch:
1014
required: true
1115
type: string
@@ -18,7 +22,7 @@ on:
1822
type: string
1923

2024
env:
21-
ARTIFACT: wheel-linux-py${{ inputs.python-version }}-${{ inputs.arch }}
25+
ARTIFACT: wheel-linux-py${{ inputs.python-version }}${{ inputs.free-threaded }}-${{ inputs.arch }}
2226

2327
jobs:
2428
build:
@@ -35,11 +39,22 @@ jobs:
3539
SPDL_BUILD_STUB: 1
3640
run: |
3741
set -ex
42+
43+
uv --version
3844
uv python list --only-installed
3945
40-
py_ver="$(echo '${{ inputs.python-version }}' | sed 's|[^0-9]*||g')"
41-
python_exe="/opt/python/cp${py_ver}-cp${py_ver}/bin/python"
46+
# note: 3.13t is in cp313-cp313t directory, others are in cp313-cp313 directory
47+
v=${{ inputs.python-version }}
48+
dir="cp${v//[.t]/}-cp${v//[.]/}"
49+
if [[ "${{ inputs.free-threaded }}" == 'ft' ]]; then
50+
dir="${dir}t"
51+
fi
52+
python_exe="/opt/python/${dir}/bin/python"
53+
"${python_exe}" --version
4254
uv venv --python "${python_exe}"
55+
if [[ "${{ inputs.free-threaded }}" == 'ft' ]]; then
56+
source .venv/bin/activate
57+
fi
4358
uv build --no-python-downloads --all-packages --wheel
4459
4560
./packaging/repair_wheels.sh manylinux_2_28_${{ inputs.arch }} ./dist ~/package
@@ -55,8 +70,12 @@ jobs:
5570

5671
- name: Check package
5772
run: |
58-
py_ver="$(echo '${{ inputs.python-version }}' | sed 's|[^0-9]*||g')"
59-
python_exe="/opt/python/cp${py_ver}-cp${py_ver}/bin/python"
73+
# CFFI is not available yet for 3.13t, which prevents the installation of twine
74+
# https://github.com/python-cffi/cffi/releases/tag/v1.17.0
75+
# So we use the regular 3.13
76+
v=${{ inputs.python-version }}
77+
dir="cp${v//[.t]/}-cp${v//[.t]/}"
78+
python_exe="/opt/python/${dir}/bin/python"
6079
"${python_exe}" -m pip install -r ./packaging/requirements.txt
6180
"${python_exe}" -m twine check --strict ~/package/*.whl
6281
@@ -83,12 +102,25 @@ jobs:
83102
path: ~/package
84103

85104
- uses: conda-incubator/setup-miniconda@v3
105+
if: ${{ inputs.free-threaded == 'ft' }}
106+
with:
107+
python-version: ${{ inputs.python-version }}t
108+
conda-remove-defaults: "true"
109+
110+
- uses: conda-incubator/setup-miniconda@v3
111+
if: ${{ inputs.free-threaded != 'ft' }}
86112
with:
87113
python-version: ${{ inputs.python-version }}
88114
conda-remove-defaults: "true"
89115

90116
- name: Unit test
91117
run: |
118+
set -ex
119+
120+
if [[ "${{ inputs.free-threaded }}" == 'ft' ]]; then
121+
conda install -q -c conda-forge python-freethreading
122+
fi
123+
92124
# Install SPDL
93125
pip install $(find "${HOME}/package" -name '*.whl' -depth -maxdepth 1)
94126

.github/workflows/_build_linux_cuda.yml

+44-8
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ on:
1818
python-version:
1919
required: true
2020
type: string
21+
free-threaded:
22+
description: 'Whether FT Python or not. Valid value is "ft" or not.'
23+
default: ''
24+
type: string
2125
cuda-version:
2226
required: true
2327
type: string
@@ -31,7 +35,7 @@ on:
3135
type: string
3236

3337
env:
34-
ARTIFACT: wheel-linux-py${{ inputs.python-version }}-cuda${{ inputs.cuda-version }}${{ inputs.use-nvdec }}
38+
ARTIFACT: wheel-linux-py${{ inputs.python-version }}${{ inputs.free-threaded }}-cuda${{ inputs.cuda-version }}${{ inputs.use-nvdec }}
3539
SPDL_USE_TRACING: 1
3640
SPDL_BUILD_STUB: 0
3741
SPDL_USE_CUDA: 1
@@ -64,11 +68,21 @@ jobs:
6468
6569
wget -qO- https://astral.sh/uv/install.sh | sh
6670
source $HOME/.local/bin/env
71+
uv --version
6772
uv python list --only-installed
6873
69-
py_ver="$(echo '${{ inputs.python-version }}' | sed 's|[^0-9]*||g')"
70-
python_exe="/opt/python/cp${py_ver}-cp${py_ver}/bin/python"
74+
# note: 3.13t is in cp313-cp313t directory, others are in cp313-cp313 directory
75+
v=${{ inputs.python-version }}
76+
dir="cp${v//[.t]/}-cp${v//[.]/}"
77+
if [[ "${{ inputs.free-threaded }}" == 'ft' ]]; then
78+
dir="${dir}t"
79+
fi
80+
python_exe="/opt/python/${dir}/bin/python"
81+
"${python_exe}" --version
7182
uv venv --python "${python_exe}"
83+
if [[ "${{ inputs.free-threaded }}" == 'ft' ]]; then
84+
source .venv/bin/activate
85+
fi
7286
uv build --no-python-downloads --all-packages --wheel
7387
7488
./packaging/repair_wheels.sh "manylinux_2_27_${{ inputs.arch }}" ./dist ~/package
@@ -84,9 +98,12 @@ jobs:
8498

8599
- name: Check package
86100
run: |
87-
py_ver="$(echo '${{ inputs.python-version }}' | sed 's|[^0-9]*||g')"
88-
python_exe="/opt/python/cp${py_ver}-cp${py_ver}/bin/python"
89-
101+
# CFFI is not available yet for 3.13t, which prevents the installation of twine
102+
# https://github.com/python-cffi/cffi/releases/tag/v1.17.0
103+
# So we use the regular 3.13
104+
v=${{ inputs.python-version }}
105+
dir="cp${v//[.t]/}-cp${v//[.t]/}"
106+
python_exe="/opt/python/${dir}/bin/python"
90107
"${python_exe}" -m pip install -r ./packaging/requirements.txt
91108
"${python_exe}" -m twine check --strict ~/package/*.whl
92109
@@ -113,14 +130,25 @@ jobs:
113130
path: ~/package
114131

115132
- uses: conda-incubator/setup-miniconda@v3
133+
if: ${{ inputs.free-threaded == 'ft' }}
116134
with:
117-
python-version: "${{ inputs.python-version }}"
135+
python-version: ${{ inputs.python-version }}t
136+
conda-remove-defaults: "true"
137+
138+
- uses: conda-incubator/setup-miniconda@v3
139+
if: ${{ inputs.free-threaded != 'ft' }}
140+
with:
141+
python-version: ${{ inputs.python-version }}
118142
conda-remove-defaults: "true"
119143

120144
- name: Unit test
121145
run: |
122146
set -ex
123147
148+
if [[ "${{ inputs.free-threaded }}" == 'ft' ]]; then
149+
conda install -q -c conda-forge python-freethreading
150+
fi
151+
124152
# Install SPDL
125153
pip install $(find "${HOME}/package" -name '*.whl' -depth -maxdepth 1)
126154
@@ -178,10 +206,18 @@ jobs:
178206
path: ~/package
179207

180208
- uses: conda-incubator/setup-miniconda@v3
209+
if: ${{ inputs.free-threaded == 'ft' }}
181210
with:
182-
python-version: ${{ inputs.python-version }}
211+
python-version: ${{ inputs.python-version }}t
212+
conda-remove-defaults: "true"
213+
214+
- uses: conda-incubator/setup-miniconda@v3
215+
if: ${{ inputs.free-threaded != 'ft' }}
216+
with:
217+
python-version: ${{ inputs.python-version }}t
183218
conda-remove-defaults: "true"
184219

220+
185221
- name: Unit test
186222
run: |
187223
# Install SPDL

.github/workflows/packaging.yml

+13-2
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,17 @@ jobs:
4343
fail-fast: false
4444
matrix:
4545
python-version: ["3.10", "3.11", "3.12", "3.13"]
46+
free-threaded: [""]
47+
include:
48+
- python-version: "3.13"
49+
free-threaded: "ft"
4650
uses: ./.github/workflows/_build_linux.yml
4751
with:
4852
os: ubuntu-24.04-arm
4953
arch: aarch64
5054
python-version: "${{ matrix.python-version }}"
51-
run-test: "${{ matrix.python-version == '3.10'}}"
55+
free-threaded: "${{ matrix.free-threaded }}"
56+
run-test: "${{ matrix.python-version == '3.10' || matrix.free-threaded == 'ft' }}"
5257

5358
#############################################################################
5459
# Linux (CUDA)
@@ -60,9 +65,15 @@ jobs:
6065
matrix:
6166
python-version: ["3.10", "3.11", "3.12", "3.13"]
6267
cuda-version: ["12.4"]
68+
free-threaded: [""]
69+
include:
70+
- python-version: "3.13"
71+
free-threaded: "ft"
72+
cuda-version: "12.4"
6373
uses: ./.github/workflows/_build_linux_cuda.yml
6474
with:
6575
build_container: "pytorch/manylinux2_28-builder:cuda${{ matrix.cuda-version }}"
6676
python-version: "${{ matrix.python-version }}"
77+
free-threaded: "${{ matrix.free-threaded }}"
6778
cuda-version: "${{ matrix.cuda-version }}"
68-
run-test: "${{ matrix.python-version == '3.11'}}"
79+
run-test: "${{ matrix.python-version == '3.11' || matrix.free-threaded == 'ft' }}"

src/CMakeLists.txt

+2-6
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,6 @@ find_package(gflags REQUIRED NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_PACKAGE_REGISTR
4343
find_package(glog REQUIRED NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_PACKAGE_REGISTRY NO_CMAKE_SYSTEM_PACKAGE_REGISTRY)
4444
find_package(libzip REQUIRED NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_PACKAGE_REGISTRY NO_CMAKE_SYSTEM_PACKAGE_REGISTRY)
4545

46-
set(deps fmt::fmt gflags glog::glog libzip::zip)
47-
foreach(dep IN LISTS deps)
48-
get_target_property(location "${dep}" IMPORTED_LOCATION_RELEASE)
49-
message(STATUS "Found ${dep}: ${location}")
50-
endforeach()
51-
5246
add_subdirectory(third_party/ffmpeg/multi)
5347
if (SPDL_USE_TRACING)
5448
add_subdirectory(third_party/perfetto)
@@ -64,6 +58,8 @@ endif ()
6458
add_subdirectory(libspdl)
6559

6660
if (SPDL_BUILD_PYTHON_BINDING)
61+
message(STATUS "Python_EXECUTABLE: ${Python_EXECUTABLE}")
62+
message(STATUS "Python_INCLUDE_DIR: ${Python_INCLUDE_DIR}")
6763
find_package(Python COMPONENTS Interpreter Development.Module REQUIRED)
6864
add_subdirectory(third_party/nanobind)
6965
add_subdirectory(spdl/io/lib)

0 commit comments

Comments
 (0)