Skip to content

build pygloo to support multi python version #33

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 11 additions & 16 deletions .github/workflows/manylinux_basic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@ on:
jobs:
build-wheels:
timeout-minutes: 60
runs-on: ubuntu-latest
container: quay.io/pypa/manylinux2014_x86_64
runs-on: ubuntu-20.04
container: quay.io/pypa/manylinux_2_28_x86_64

steps:
- uses: actions/checkout@v2

- name: Install bazel
- name: Build Wheels
run: |
yum -y install wget
yum -y install java-1.8.0-openjdk java-1.8.0-openjdk-devel
Expand All @@ -24,16 +23,12 @@ jobs:
./bazel-5.1.0-installer-linux-x86_64.sh --user
export PATH=$PATH:~/.bazel/bin
export PYTHON_BIN_PATH='/opt/python/cp38-cp38/bin/python'
bazel build //pygloo:all
echo "Built successfully1."

- name: Build wheels
run: |
# bazel build //pygloo:all
echo "Built successfully."
bash build_wheels.sh
echo "Built successfully."
echo `pwd`

# - name: Archive pygloo-wheel
# uses: actions/upload-artifact@v1
# with:
# name: pygloo_python39_wheel_on_manylinux
# path: dist/
- name: Archive pygloo-wheels
uses: actions/upload-artifact@v4
with:
name: pygloo_python3X_wheels_on_manylinux
path: dist/*
33 changes: 17 additions & 16 deletions build_wheels.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,21 @@

# Assuming in docker "quay.io/pypa/manylinux2014_x86_64".

# Build py36 manylinux wheels
PYTHON_BIN_PATH='/opt/python/cp36-cp36m/bin/python' /opt/python/cp36-cp36m/bin/python setup.py bdist_wheel
auditwheel repair --plat manylinux2014_x86_64 dist/pygloo-0.2.0-cp36-cp36m-linux_x86_64.whl
bazel clean --expunge
/opt/python/cp36-cp36m/bin/python setup.py clean --all
PYGLOO_VERSION="0.2.1"
# 定义 Python 版本数组
PYTHON_VERSIONS=("cp38-cp38" "cp39-cp39" "cp310-cp310" "cp311-cp311" "cp312-cp312")

# Build py37 manylinux wheels
PYTHON_BIN_PATH='/opt/python/cp37-cp37m/bin/python' /opt/python/cp37-cp37m/bin/python setup.py bdist_wheel
auditwheel repair --plat manylinux2014_x86_64 dist/pygloo-0.2.0-cp37-cp37m-linux_x86_64.whl
bazel clean --expunge
/opt/python/cp37-cp37m/bin/python setup.py clean --all

# Build py38 manylinux wheels
PYTHON_BIN_PATH='/opt/python/cp38-cp38/bin/python' /opt/python/cp38-cp38/bin/python setup.py bdist_wheel
auditwheel repair --plat manylinux2014_x86_64 dist/pygloo-0.2.0-cp38-cp38-linux_x86_64.whl
bazel clean --expunge
/opt/python/cp38-cp38/bin/python setup.py clean --all
# 遍历每个版本
for VERSION in "${PYTHON_VERSIONS[@]}"; do
# 设置 Python 路径
PYTHON_BIN_PATH="/opt/python/${VERSION}/bin/python"

export PYTHON_BIN_PATH=$PYTHON_BIN_PATH
# 执行构建和修复
$PYTHON_BIN_PATH setup.py bdist_wheel
auditwheel repair --plat manylinux2014_x86_64 "dist/pygloo-${PYGLOO_VERSION}-${VERSION}-linux_x86_64.whl"

# 清理构建环境
bazel clean --expunge
$PYTHON_BIN_PATH setup.py clean --all
done
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

logger = logging.getLogger(__name__)

SUPPORTED_PYTHONS = [(3, 6), (3, 7), (3, 8), (3, 9), (3, 10)]
SUPPORTED_PYTHONS = [(3, 8), (3, 9), (3, 10), (3, 11), (3, 12)]
SUPPORTED_BAZEL = (3, 2, 0)

ROOT_DIR = os.path.dirname(__file__)
Expand Down Expand Up @@ -93,7 +93,7 @@ def build():
bazel_targets = ["//pygloo:all"]
return bazel_invoke(
subprocess.check_call,
["build", "--verbose_failures", "--"] + bazel_targets,
["build", "--verbose_failures", "-j", "4", "--"] + bazel_targets,
env=bazel_env)


Expand Down Expand Up @@ -130,7 +130,7 @@ def finalize_options(self):

setuptools.setup(
name="pygloo",
version="0.2.0",
version="0.2.1",
author="Ray Team",
author_email="ray-dev@googlegroups.com",
description=("A python binding for gloo"),
Expand Down
Loading