Skip to content

Commit ce9c90f

Browse files
authored
Support Python 3.15 (#317)
Upgrade pybind11 to 3.1.0, the first release tested on Python 3.15, and add Python 3.15 to the wheel build and PR validation matrices. The Ubuntu and Windows runners ship CMake 3.31, whose FindPython does not know Python 3.15 and fails with "Could NOT find Python3 (missing: Python3_INCLUDE_DIRS Development.Module)". Instead of installing a newer CMake, those jobs pass the interpreter, include directory and (on Windows) import library to FindPython, taken from the Python that setup-python installed.
1 parent bd46d51 commit ce9c90f

7 files changed

Lines changed: 33 additions & 12 deletions

File tree

‎.github/workflows/ci-build-release-wheels.yaml‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ jobs:
4646
- {version: '3.12', spec: 'cp312-cp312'}
4747
- {version: '3.13', spec: 'cp313-cp313'}
4848
- {version: '3.14', spec: 'cp314-cp314'}
49+
- {version: '3.15', spec: 'cp315-cp315'}
4950
cpu:
5051
- {arch: 'x86_64', platform: 'x86_64', runner: 'ubuntu-latest'}
5152
- {arch: 'aarch64', platform: 'arm64', runner: 'ubuntu-24.04-arm'}
@@ -102,6 +103,7 @@ jobs:
102103
- {version: '3.12', version_long: '3.12.8'}
103104
- {version: '3.13', version_long: '3.13.1'}
104105
- {version: '3.14', version_long: '3.14.0'}
106+
- {version: '3.15', version_long: '3.15.0'}
105107

106108
steps:
107109
- name: checkout
@@ -132,6 +134,7 @@ jobs:
132134
- {version: '3.12'}
133135
- {version: '3.13'}
134136
- {version: '3.14'}
137+
- {version: '3.15'}
135138

136139
steps:
137140
- uses: actions/checkout@v3
@@ -161,9 +164,16 @@ jobs:
161164
tar zxf v${PYBIND11_VERSION}.tar.gz
162165
rm -rf pybind11
163166
mv pybind11-${PYBIND11_VERSION} pybind11
167+
# CMake 3.31 on the runner predates Python 3.15, so FindPython needs the paths
168+
PY_EXE=$(python -c 'import pathlib, sys; print(pathlib.Path(sys.executable).as_posix())')
169+
PY_INCLUDE=$(python -c 'import pathlib, sysconfig; print(pathlib.Path(sysconfig.get_paths()["include"]).as_posix())')
170+
PY_LIB=$(python -c 'import pathlib, sys; print(pathlib.Path(sys.base_prefix, "libs", "python%d%d.lib" % sys.version_info[:2]).as_posix())')
164171
cmake -B build -A x64 \
165172
-DCMAKE_PREFIX_PATH=${{ env.PULSAR_CPP_DIR }} \
166-
-DLINK_STATIC=ON
173+
-DLINK_STATIC=ON \
174+
-DPython3_EXECUTABLE="$PY_EXE" \
175+
-DPython3_INCLUDE_DIR="$PY_INCLUDE" \
176+
-DPython3_LIBRARY="$PY_LIB"
167177
168178
- name: Build Python wheel
169179
shell: bash

‎.github/workflows/ci-pr-validation.yaml‎

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ jobs:
5858
strategy:
5959
fail-fast: false
6060
matrix:
61-
version: ['3.10', '3.14']
61+
version: ['3.10', '3.15']
6262

6363
steps:
6464
- name: checkout
@@ -71,8 +71,12 @@ jobs:
7171
- name: Install Pulsar C++ client
7272
run: build-support/install-dependencies.sh
7373

74+
# CMake 3.31 on the runner predates Python 3.15, so FindPython needs the paths
7475
- name: CMake
75-
run: cmake .
76+
run: |
77+
cmake . \
78+
-DPython3_EXECUTABLE="$(which python3)" \
79+
-DPython3_INCLUDE_DIR="$(python3 -c 'import sysconfig; print(sysconfig.get_paths()["include"])')"
7680
7781
- name: Build
7882
run: make -j8
@@ -119,7 +123,7 @@ jobs:
119123
- {name: 'manylinux', py_suffix: ''}
120124
- {name: 'manylinux_musl', py_suffix: '-alpine'}
121125
python:
122-
- {version: '3.14', spec: 'cp314-cp314'}
126+
- {version: '3.15', spec: 'cp315-cp315'}
123127
cpu:
124128
- {arch: 'x86_64', platform: 'x86_64'}
125129

@@ -166,7 +170,7 @@ jobs:
166170
strategy:
167171
matrix:
168172
py:
169-
- {version: '3.14', version_long: '3.14.0'}
173+
- {version: '3.15', version_long: '3.15.0'}
170174

171175
steps:
172176
- name: checkout
@@ -188,7 +192,7 @@ jobs:
188192
fail-fast: false
189193
matrix:
190194
python:
191-
- version: '3.14'
195+
- version: '3.15'
192196

193197
steps:
194198
- uses: actions/checkout@v3
@@ -218,9 +222,16 @@ jobs:
218222
tar zxf v${PYBIND11_VERSION}.tar.gz
219223
rm -rf pybind11
220224
mv pybind11-${PYBIND11_VERSION} pybind11
225+
# CMake 3.31 on the runner predates Python 3.15, so FindPython needs the paths
226+
PY_EXE=$(python -c 'import pathlib, sys; print(pathlib.Path(sys.executable).as_posix())')
227+
PY_INCLUDE=$(python -c 'import pathlib, sysconfig; print(pathlib.Path(sysconfig.get_paths()["include"]).as_posix())')
228+
PY_LIB=$(python -c 'import pathlib, sys; print(pathlib.Path(sys.base_prefix, "libs", "python%d%d.lib" % sys.version_info[:2]).as_posix())')
221229
cmake -B build -A x64 \
222230
-DCMAKE_PREFIX_PATH=${{ env.PULSAR_CPP_DIR }} \
223-
-DLINK_STATIC=ON
231+
-DLINK_STATIC=ON \
232+
-DPython3_EXECUTABLE="$PY_EXE" \
233+
-DPython3_INCLUDE_DIR="$PY_INCLUDE" \
234+
-DPython3_LIBRARY="$PY_LIB"
224235
225236
- name: Build Python wheel
226237
shell: bash

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Pulsar Python clients support a variety of Pulsar features to enable building ap
2525

2626
## Requirements
2727

28-
- Python 3.10, 3.11, 3.12, 3.13 or 3.14
28+
- Python 3.10, 3.11, 3.12, 3.13, 3.14 or 3.15
2929
- A C++ compiler that supports C++11
3030
- CMake >= 3.18
3131
- [Pulsar C++ client library](https://github.com/apache/pulsar-client-cpp)

‎RELEASE.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ stay open for at least 72 hours ***
132132
Python wheels:
133133
https://dist.apache.org/repos/dist/dev/pulsar/pulsar-client-python-X.Y.Z-candidate-N/
134134
135-
The supported python versions are 3.10, 3.11, 3.12, 3.13 and 3.14. The
135+
The supported python versions are 3.10, 3.11, 3.12, 3.13, 3.14 and 3.15. The
136136
supported platforms and architectures are:
137137
- Windows x86_64 (windows/)
138138
- glibc-based Linux x86_64 (linux-glibc-x86_64/)

‎dependencies.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@
1818
#
1919

2020
pulsar-cpp: 4.2.0
21-
pybind11: 3.0.1
21+
pybind11: 3.1.0
2222
# The OpenSSL dependency is only used when building Python from source
2323
openssl: 1.1.1q

‎pulsar/__init__.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
The Pulsar Python client library is based on the existing C++ client library.
2222
All the same features are exposed through the Python interface.
2323
24-
Currently, the supported Python versions are 3.10, 3.11, 3.12, 3.13 and 3.14.
24+
Currently, the supported Python versions are 3.10, 3.11, 3.12, 3.13, 3.14 and 3.15.
2525
2626
=================
2727
Install from PyPI

‎pybind11‎

Submodule pybind11 updated 193 files

0 commit comments

Comments
 (0)