Skip to content

Commit 5e5ba62

Browse files
BewareMyPowerRobertIndie
authored andcommitted
Fix the incompatibility with Python 3.12 and drop the support for 3.7 (#181)
### Motivation The `avro` component cannot be installed with Python 3.12 because the depended `fastavro` dependency is 1.7.3, which is not compatible with Python 3.12. However, the newer fastavro dependencies all do not support Python 3.7, which has already reached the EOL (2023-06-27). ### Modifications - Upgrade the fastavro dependency to 1.9.2 - Add the workflows to run tests for the lowest and highest supported Python versions (3.8 and 3.12). - Fix the documents (cherry picked from commit daabc67)
1 parent cfe55b4 commit 5e5ba62

File tree

8 files changed

+50
-39
lines changed

8 files changed

+50
-39
lines changed

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

-3
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ jobs:
4141
- {name: 'manylinux2014', py_suffix: ''}
4242
- {name: 'manylinux_musl', py_suffix: '-alpine'}
4343
python:
44-
- {version: '3.7', spec: 'cp37-cp37m'}
4544
- {version: '3.8', spec: 'cp38-cp38'}
4645
- {version: '3.9', spec: 'cp39-cp39'}
4746
- {version: '3.10', spec: 'cp310-cp310'}
@@ -103,7 +102,6 @@ jobs:
103102
fail-fast: false
104103
matrix:
105104
py:
106-
- {version: '3.7', version_long: '3.7.15'}
107105
- {version: '3.8', version_long: '3.8.13'}
108106
- {version: '3.9', version_long: '3.9.14'}
109107
- {version: '3.10', version_long: '3.10.7'}
@@ -156,7 +154,6 @@ jobs:
156154
fail-fast: false
157155
matrix:
158156
python:
159-
- {version: '3.7'}
160157
- {version: '3.8'}
161158
- {version: '3.9'}
162159
- {version: '3.10'}

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

+16-6
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,22 @@ jobs:
4747
pulsar
4848
4949
unit-tests:
50-
name: Run unit tests
50+
name: Run unit tests for Python ${{matrix.version}}
5151
runs-on: ubuntu-22.04
5252
timeout-minutes: 120
5353

54+
strategy:
55+
fail-fast: false
56+
matrix:
57+
version: ['3.8', '3.12']
58+
5459
steps:
5560
- name: checkout
56-
uses: actions/checkout@v3
61+
uses: actions/checkout@v4
62+
63+
- uses: actions/setup-python@v5
64+
with:
65+
python-version: "${{matrix.version}}"
5766

5867
- name: Install Pulsar C++ client
5968
run: build-support/install-dependencies.sh
@@ -66,7 +75,8 @@ jobs:
6675

6776
- name: Python install
6877
run: |
69-
./setup.py bdist_wheel
78+
python3 -m pip install -U pip setuptools wheel requests
79+
python3 setup.py bdist_wheel
7080
WHEEL=$(find dist -name '*.whl')
7181
pip3 install ${WHEEL}[avro]
7282
@@ -90,7 +100,7 @@ jobs:
90100
- name: Test functions install
91101
run: |
92102
WHEEL=$(find dist -name '*.whl')
93-
pip3 install ${WHEEL}[functions] --force-reinstall
103+
pip3 install ${WHEEL}[all] --force-reinstall
94104
95105
linux-wheel:
96106
name: Wheel ${{matrix.image.name}} - Py ${{matrix.python.version}} - ${{matrix.cpu.platform}}
@@ -153,7 +163,7 @@ jobs:
153163
strategy:
154164
matrix:
155165
py:
156-
- {version: '3.11', version_long: '3.11.1'}
166+
- {version: '3.12', version_long: '3.12.0'}
157167

158168
steps:
159169
- name: checkout
@@ -199,7 +209,7 @@ jobs:
199209
fail-fast: false
200210
matrix:
201211
python:
202-
- version: '3.11'
212+
- version: '3.12'
203213

204214
steps:
205215
- uses: actions/checkout@v3

README.md

+1-1
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.7
28+
- Python 3.8, 3.9, 3.10, 3.11, 3.12
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

+1-1
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.7, 3.8, 3.9, 3.10, 3.11 and 3.12. The
135+
The supported python versions are 3.8, 3.9, 3.10, 3.11 and 3.12. The
136136
supported platforms and architectures are:
137137
- Windows x86_64 (windows/)
138138
- glibc-based Linux x86_64 (linux-glibc-x86_64/)

build-support/install-dependencies.sh

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ set -e -x
2222

2323
cd `dirname $0`
2424

25+
python3 -m pip install pyyaml
2526
CPP_CLIENT_VERSION=$(./dep-version.py pulsar-cpp ../dependencies.yaml)
2627
PYBIND11_VERSION=$(./dep-version.py pybind11 ../dependencies.yaml)
2728
source ./dep-url.sh

pkg/mac/build-dependencies.sh

+29-26
Original file line numberDiff line numberDiff line change
@@ -71,32 +71,6 @@ else
7171
echo "Using cached ZLib"
7272
fi
7373

74-
###############################################################################
75-
if [ ! -f Python-${PYTHON_VERSION_LONG}/.done ]; then
76-
echo "Building Python $PYTHON_VERSION_LONG"
77-
curl -O -L https://www.python.org/ftp/python/${PYTHON_VERSION_LONG}/Python-${PYTHON_VERSION_LONG}.tgz
78-
tar xfz Python-${PYTHON_VERSION_LONG}.tgz
79-
80-
pushd Python-${PYTHON_VERSION_LONG}
81-
if [ $PYTHON_VERSION = '3.7' ]; then
82-
patch -p1 < ${ROOT_DIR}/pkg/mac/python-3.7.patch
83-
fi
84-
85-
CFLAGS="-fPIC -O3 -mmacosx-version-min=${MACOSX_DEPLOYMENT_TARGET} -I${PREFIX}/include ${PY_CFLAGS}" \
86-
LDFLAGS=" ${PY_CFLAGS} -L${PREFIX}/lib" \
87-
./configure --prefix=$PREFIX --enable-shared --enable-universalsdk --with-universal-archs=universal2
88-
make -j16
89-
make install
90-
91-
curl -O -L https://files.pythonhosted.org/packages/27/d6/003e593296a85fd6ed616ed962795b2f87709c3eee2bca4f6d0fe55c6d00/wheel-0.37.1-py2.py3-none-any.whl
92-
$PREFIX/bin/pip3 install wheel-*.whl
93-
94-
touch .done
95-
popd
96-
else
97-
echo "Using cached Python $PYTHON_VERSION_LONG"
98-
fi
99-
10074
###############################################################################
10175
OPENSSL_VERSION_UNDERSCORE=$(echo $OPENSSL_VERSION | sed 's/\./_/g')
10276
if [ ! -f openssl-OpenSSL_${OPENSSL_VERSION_UNDERSCORE}.done ]; then
@@ -135,6 +109,35 @@ else
135109
echo "Using cached OpenSSL"
136110
fi
137111

112+
###############################################################################
113+
if [ ! -f Python-${PYTHON_VERSION_LONG}/.done ]; then
114+
echo "Building Python $PYTHON_VERSION_LONG"
115+
curl -O -L https://www.python.org/ftp/python/${PYTHON_VERSION_LONG}/Python-${PYTHON_VERSION_LONG}.tgz
116+
tar xfz Python-${PYTHON_VERSION_LONG}.tgz
117+
118+
pushd Python-${PYTHON_VERSION_LONG}
119+
if [ $PYTHON_VERSION = '3.7' ]; then
120+
patch -p1 < ${ROOT_DIR}/pkg/mac/python-3.7.patch
121+
fi
122+
123+
CFLAGS="-fPIC -O3 -mmacosx-version-min=${MACOSX_DEPLOYMENT_TARGET} -I${PREFIX}/include ${PY_CFLAGS}" \
124+
LDFLAGS=" ${PY_CFLAGS} -L${PREFIX}/lib" \
125+
./configure --prefix=$PREFIX --enable-shared --enable-universalsdk \
126+
--with-universal-archs=universal2 \
127+
--with-openssl=$PREFIX
128+
make -j16
129+
make install
130+
131+
curl -O -L https://files.pythonhosted.org/packages/27/d6/003e593296a85fd6ed616ed962795b2f87709c3eee2bca4f6d0fe55c6d00/wheel-0.37.1-py2.py3-none-any.whl
132+
$PREFIX/bin/pip3 install wheel setuptools
133+
$PREFIX/bin/pip3 install wheel-*.whl
134+
135+
touch .done
136+
popd
137+
else
138+
echo "Using cached Python $PYTHON_VERSION_LONG"
139+
fi
140+
138141
###############################################################################
139142
BOOST_VERSION_=${BOOST_VERSION//./_}
140143
if [ ! -f boost/.done ]; then

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def build_extension(self, ext):
9090
# avro dependencies
9191
extras_require["avro"] = sorted(
9292
{
93-
"fastavro==1.7.3"
93+
"fastavro>=1.9.2"
9494
}
9595
)
9696

tests/schema_test.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ class Example(Record):
449449

450450
self.assertIsNotNone(msg.schema_version())
451451

452-
self.assertEquals(b'\x00\x00\x00\x00\x00\x00\x00\x00', msg.schema_version().encode())
452+
self.assertEqual(b'\x00\x00\x00\x00\x00\x00\x00\x00', msg.schema_version().encode())
453453

454454
self.assertEqual(r, msg.value())
455455

0 commit comments

Comments
 (0)