Skip to content

Commit c806cba

Browse files
authored
[Python] Support python3.11/12 (#1064)
1 parent 678c134 commit c806cba

File tree

13 files changed

+76
-44
lines changed

13 files changed

+76
-44
lines changed

.bazelrc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ build:macos --force_pic
1313
build:clang-cl --compiler=clang-cl
1414
build:msvc --compiler=msvc-cl
1515

16-
# for abi issue
17-
build --cxxopt="-D_GLIBCXX_USE_CXX11_ABI=0"
18-
1916
# test config
2017
test --build_tests_only
2118
test --cache_test_results=no

.github/workflows/ci.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ jobs:
3636
java:
3737
name: Java CI
3838
runs-on: ubuntu-latest
39+
env:
40+
MY_VAR: "PATH"
3941
strategy:
4042
matrix:
4143
java-version: ["8", "11", "17"]
@@ -53,7 +55,7 @@ jobs:
5355
- name: Install pyfury
5456
run: ./ci/run_ci.sh install_pyfury
5557
- name: Run CI with Maven
56-
run: PATH="$HOME/miniconda/bin:$PATH" ./ci/run_ci.sh java${{ matrix.java-version }}
58+
run: ./ci/run_ci.sh java${{ matrix.java-version }}
5759
java21:
5860
name: Java CI
5961
runs-on: ubuntu-latest
@@ -74,7 +76,7 @@ jobs:
7476
- name: Install pyfury
7577
run: ./ci/run_ci.sh install_pyfury
7678
- name: Run CI with Maven
77-
run: PATH="$HOME/miniconda/bin:$PATH" ./ci/run_ci.sh java${{ matrix.java-version }}
79+
run: ./ci/run_ci.sh java${{ matrix.java-version }}
7880
scala:
7981
name: Scala CI
8082
runs-on: ubuntu-latest
@@ -143,7 +145,7 @@ jobs:
143145
runs-on: ubuntu-20.04
144146
strategy:
145147
matrix:
146-
python-version: [3.6, 3.9]
148+
python-version: [3.7, 3.12]
147149
steps:
148150
- uses: actions/checkout@v3
149151
- name: Set up Python ${{ matrix.python-version }}
@@ -175,7 +177,7 @@ jobs:
175177
- name: Install pyfury
176178
run: ./ci/run_ci.sh install_pyfury
177179
- name: Run Golang CI
178-
run: PATH="$HOME/miniconda/bin:$PATH" ./ci/run_ci.sh go
180+
run: ./ci/run_ci.sh go
179181
lint:
180182
name: Code Style Check
181183
runs-on: ubuntu-latest

.github/workflows/release-java.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
server-username: MAVEN_USERNAME
3434
server-password: MAVEN_PASSWORD
3535
- name: Publish java packages
36-
run: export PATH="$HOME/miniconda/bin:$PATH" && cd java && mvn --batch-mode -q deploy -Dgpg.skip -DskipTests -Prelease
36+
run: cd java && mvn --batch-mode -q deploy -Dgpg.skip -DskipTests -Prelease
3737
env:
3838
MAVEN_USERNAME: ${{ secrets.OSSRH_ID }}
3939
MAVEN_PASSWORD: ${{ secrets.OSSRH_KEY }}

.github/workflows/release.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
url: https://pypi.org/project/pyfury
2929
strategy:
3030
matrix:
31-
python-version: [3.6, 3.7, 3.8, 3.9, 3.10.12]
31+
python-version: [3.7, 3.8, 3.9, 3.10.12, 3.11, 3.12]
3232
steps:
3333
- uses: actions/checkout@v3
3434
- name: Set up Python ${{ matrix.python-version }}
@@ -47,7 +47,8 @@ jobs:
4747
ci/deploy.sh bump_py_version $version
4848
- name: Build a binary wheel
4949
run: |
50-
pip install pyarrow==6.0.1 Cython wheel numpy pytest
50+
../ci/deploy.sh install_pyarrow
51+
pip install setuptools wheel Cython numpy pytest
5152
cd python
5253
pip list
5354
export PATH=~/bin:$PATH

bazel/arrow/pyarrow_configure.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ def _get_pyarrow_include(repository_ctx, python_bin="python"):
186186
def _get_pyarrow_shared_library(repository_ctx, library_name, python_bin="python"):
187187
"""Gets the pyarrow shared library path."""
188188
code = """import pyarrow, os, glob;print(glob.glob(os.path.join(""" +\
189-
"""os.path.dirname(pyarrow.__file__), 'lib{}.*.*'))[0])""".format(library_name)
189+
"""os.path.dirname(pyarrow.__file__), 'lib{}.*'))[0])""".format(library_name)
190190
result = _execute(
191191
repository_ctx, [
192192
python_bin, "-c", code

bazel/fury.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
COPTS = ["-pthread","-std=c++17", "-D_GLIBCXX_USE_CXX11_ABI=0"]
1+
COPTS = ["-pthread","-std=c++17"]

bazel/fury_deps_setup.bzl

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,14 @@ def auto_http_archive(
113113
)
114114

115115
def setup_deps():
116-
auto_http_archive(
116+
# Fix @platforms error, see https://groups.google.com/g/bazel-discuss/c/iQyt08ZaNek
117+
http_archive(
117118
name = "bazel_skylib",
118-
strip_prefix = None,
119-
url = "https://github.com/bazelbuild/bazel-skylib/releases/download/1.0.2/bazel-skylib-1.0.2.tar.gz",
120-
sha256 = "97e70364e9249702246c0e9444bccdc4b847bed1eb03c5a3ece4f83dfe6abc44",
119+
sha256 = "74d544d96f4a5bb630d465ca8bbcfe231e3594e5aae57e1edbf17a6eb3ca2506",
120+
urls = [
121+
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.3.0/bazel-skylib-1.3.0.tar.gz",
122+
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.3.0/bazel-skylib-1.3.0.tar.gz",
123+
],
121124
)
122125
http_archive(
123126
name = "rules_python",
@@ -150,6 +153,9 @@ def setup_deps():
150153
)
151154
auto_http_archive(
152155
name = "com_google_absl",
153-
url = "https://github.com/abseil/abseil-cpp/archive/refs/tags/20211102.0.tar.gz",
154-
sha256 = "dcf71b9cba8dc0ca9940c4b316a0c796be8fab42b070bb6b7cab62b48f0e66c4",
155-
)
156+
sha256 = "5366d7e7fa7ba0d915014d387b66d0d002c03236448e1ba9ef98122c13b35c36",
157+
strip_prefix = "abseil-cpp-20230125.3",
158+
urls = [
159+
"https://github.com/abseil/abseil-cpp/archive/20230125.3.tar.gz",
160+
],
161+
)

ci/deploy.sh

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,19 @@ ROOT="$(git rev-parse --show-toplevel)"
3030
cd "$ROOT"
3131
WHEEL_DIR="$ROOT/.whl"
3232

33-
PYTHONS=("cp36-cp36m"
34-
"cp37-cp37m"
33+
PYTHONS=("cp37-cp37m"
3534
"cp38-cp38"
36-
"cp39-cp39")
35+
"cp39-cp39"
36+
"cp310-cp310"
37+
"cp310-cp311"
38+
"cp312-cp312")
3739

38-
VERSIONS=("3.6"
39-
"3.7"
40+
VERSIONS=("3.7"
4041
"3.8"
41-
"3.9")
42+
"3.9"
43+
"3.10"
44+
"3.11"
45+
"3.12")
4246

4347
source $(conda info --base)/etc/profile.d/conda.sh
4448

@@ -128,11 +132,12 @@ deploy_python() {
128132
git clean -f -f -x -d -e .whl
129133
# Ensure bazel select the right version of python
130134
bazel clean --expunge
131-
pip install --ignore-installed twine cython pyarrow==6.0.1 numpy
135+
install_pyarrow
136+
pip install --ignore-installed twine setuptools cython numpy
132137
pyarrow_dir=$(python -c "import importlib.util; import os; print(os.path.dirname(importlib.util.find_spec('pyarrow').origin))")
133138
# ensure pyarrow is clean
134139
rm -rf "$pyarrow_dir"
135-
pip install --ignore-installed pyarrow==6.0.1
140+
pip install --ignore-installed pyarrow==$pyarrow_version
136141
python setup.py clean
137142
python setup.py bdist_wheel
138143
mv dist/pyfury*.whl "$WHEEL_DIR"
@@ -144,6 +149,17 @@ deploy_python() {
144149
twine upload -r pypi "$WHEEL_DIR"/pyfury*.whl
145150
}
146151

152+
install_pyarrow() {
153+
pyversion=$(python -V | cut -d' ' -f2)
154+
if [[ $pyversion == 3.7* ]]; then
155+
pyarrow_version=12.0.0
156+
sed -i -E "s/pyarrow_version = .*/pyarrow_version = \"12.0.0\"/" "$ROOT"/python/setup.py
157+
else
158+
pyarrow_version=14.0.0
159+
fi
160+
pip install pyarrow==$pyarrow_version
161+
}
162+
147163
case "$1" in
148164
java) # Deploy jars to maven repository.
149165
deploy_jars

ci/run_ci.sh

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,27 +25,30 @@ install_python() {
2525
wget -q https://repo.anaconda.com/miniconda/Miniconda3-py38_23.5.2-0-Linux-x86_64.sh -O Miniconda3.sh
2626
bash Miniconda3.sh -b -p $HOME/miniconda && rm -f miniconda.*
2727
which python
28-
echo "Python version $(python -V)"
28+
echo "Python version $(python -V), path $(which python)"
2929
}
3030

3131
install_pyfury() {
32-
export PATH="$HOME/miniconda/bin:$PATH"
33-
echo "Python version $(python -V)"
34-
pip install pyarrow==6.0.1 Cython wheel numpy pytest
32+
echo "Python version $(python -V), path $(which python)"
33+
"$ROOT"/ci/deploy.sh install_pyarrow
34+
pip install Cython wheel numpy pytest
3535
pushd "$ROOT/python"
3636
pip list
3737
export PATH=~/bin:$PATH
3838
echo "Install pyfury"
39+
# Fix strange installed deps not found
40+
pip install setuptools
3941
pip install -v -e .
4042
popd
4143
}
4244

4345
install_bazel() {
44-
if command -v java >/dev/null; then
46+
if command -v bazel >/dev/null; then
4547
echo "existing bazel location $(which bazel)"
4648
echo "existing bazel version $(bazel version)"
4749
fi
48-
URL="https://github.com/bazelbuild/bazel/releases/download/4.2.0/bazel-4.2.0-installer-linux-x86_64.sh"
50+
# GRPC support bazel 6.3.2 https://grpc.github.io/grpc/core/md_doc_bazel_support.html
51+
URL="https://github.com/bazelbuild/bazel/releases/download/6.3.2/bazel-6.3.2-installer-linux-x86_64.sh"
4952
wget -q -O install.sh $URL
5053
chmod +x install.sh
5154
set +x
@@ -188,7 +191,7 @@ case $1 in
188191
;;
189192
cpp)
190193
echo "Install pyarrow"
191-
pip install pyarrow==6.0.1
194+
"$ROOT"/ci/deploy.sh install_pyarrow
192195
export PATH=~/bin:$PATH
193196
echo "bazel version: $(bazel version)"
194197
set +e

docs/guide/DEVELOPMENT.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ mvn clean compile -DskipTests
2626

2727
```bash
2828
cd python
29-
pip install pyarrow==6.0.1 Cython wheel numpy pytest
29+
pip install pyarrow==14.0.0 Cython wheel numpy pytest
3030
pip install -v -e .
3131
```
3232

@@ -45,7 +45,7 @@ bazel build //src/fury/util:fury_util
4545
Build fury row format:
4646

4747
```bash
48-
pip install pyarrow==6.0.1
48+
pip install pyarrow==14.0.0
4949
bazel build //src/fury/row:fury_row_format
5050
```
5151

0 commit comments

Comments
 (0)