Skip to content

Fix build on py11 #36

New issue

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

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

Already on GitHub? Sign in to your account

Open
wants to merge 9 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
16 changes: 10 additions & 6 deletions .github/workflows/ubuntu_basic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,35 @@ jobs:
run-unit-tests:
timeout-minutes: 60
runs-on: ubuntu-latest
container: docker.io/library/ubuntu:20.04
container: docker.io/library/ubuntu:22.04

steps:
- uses: actions/checkout@v2

- name: Install bazel
run: |
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get install -yq wget gcc g++ python3.8 zlib1g-dev zip libuv1.dev
add-apt-repository ppa:deadsnakes/ppa
apt-get install -yq wget gcc g++ python3.11 zlib1g-dev zip libuv1.dev

apt-get install -yq pip
wget "https://github.com/bazelbuild/bazel/releases/download/5.1.0/bazel_5.1.0-linux-x86_64.deb" -O bazel_5.1.0-linux-x86_64.deb
dpkg -i bazel_5.1.0-linux-x86_64.deb
wget "https://github.com/bazelbuild/bazel/releases/download/6.5.0/bazel_6.5.0-linux-x86_64.deb" -O bazel_6.5.0-linux-x86_64.deb
dpkg -i bazel_6.5.0-linux-x86_64.deb

- name: Install dependencies
run: |
python3 -m pip install virtualenv
python3 -m virtualenv -p python3.8 py3
python3 -m virtualenv -p python3.11 py3
. py3/bin/activate
which python
python --version
pip install pytest torch
pip install ray==1.13.0
pip install ray

- name: Build and test
run: |
. py3/bin/activate
python --version
python3 setup.py install
cd tests && python3 -m pytest *
34 changes: 25 additions & 9 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,21 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
# Group the sources of the library so that CMake rule have access to it
all_content = """filegroup(name = "all", srcs = glob(["**"]), visibility = ["//visibility:public"])"""

http_archive(
name = "rules_python",
strip_prefix = "rules_python-0.30.0",
url = "https://wq-boost.oss-cn-beijing.aliyuncs.com/rules_python-0.30.0.tar.gz",
)
# if missing it will trig the error message of the OP
load("@rules_python//python:repositories.bzl", "py_repositories", "python_register_toolchains")
py_repositories()

python_register_toolchains(
name = "python_3_11",
python_version = "3.11",
ignore_root_user_error = True,
)

# Rule repository
http_archive(
name = "rules_foreign_cc",
Expand Down Expand Up @@ -42,18 +57,19 @@ http_archive(

http_archive(
name = "pybind11_bazel",
strip_prefix = "pybind11_bazel-f4f1bd4fa4b368b79dd6f003f8ef8c5a91fad36b",
urls = ["https://github.com/Ezra-H/pybind11_bazel/archive/f4f1bd4fa4b368b79dd6f003f8ef8c5a91fad36b.zip"],
sha256 = "6ea811e7a7348f7c9d5b59887aa0c65e42222e199049a1ee55db147d2e9ca4a7",
strip_prefix = "pybind11_bazel-2.13.6",
urls = ["https://github.com/pybind/pybind11_bazel/releases/download/v2.13.6/pybind11_bazel-2.13.6.zip"],
sha256 = "9df284330336958c837fb70dc34c0a6254dac52a5c983b3373a8c2bbb79ac35e",
)

# We still require the pybind library.
http_archive(
name = "pybind11",
build_file = "@pybind11_bazel//:pybind11.BUILD",
strip_prefix = "pybind11-2.6.1",
urls = ["https://github.com/pybind/pybind11/archive/v2.6.1.tar.gz"],
sha256 = "cdbe326d357f18b83d10322ba202d69f11b2f49e2d87ade0dc2be0c5c34f8e2a",
build_file = "@pybind11_bazel//:pybind11-BUILD.bazel",
strip_prefix = "pybind11-2.13.6",
# urls = ["https://github.com/pybind/pybind11/archive/v2.13.6.zip"],
urls = ["https://wq-boost.oss-cn-beijing.aliyuncs.com/pybind11-2.13.6.zip"],
# sha256 = "cdbe326d357f18b83d10322ba202d69f11b2f49e2d87ade0dc2be0c5c34f8e2a",
)

http_archive(
Expand Down Expand Up @@ -81,7 +97,7 @@ http_archive(
sha256 = "a146136bb6efdac0e3ede952d09aec44b771a87ebc713bd815c3a90a7428c908",
)

load("@pybind11_bazel//:python_configure.bzl", "python_configure_pybind")
python_configure_pybind(name = "local_config_python")
# load("@pybind11_bazel//:python_configure.bzl", "python_configure_pybind")
# python_configure_pybind(name = "local_config_python")


4 changes: 3 additions & 1 deletion pygloo/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ load("@rules_foreign_cc//tools/build_defs:cmake.bzl", "cmake_external")
load("@rules_foreign_cc//tools/build_defs:make.bzl", "make")
load("@pybind11_bazel//:build_defs.bzl", "pybind_library")
load("@pybind11_bazel//:build_defs.bzl", "pybind_extension")
load("@rules_python//python:defs.bzl", "py_library")


cmake_external(
name = "libuv",
Expand Down Expand Up @@ -72,7 +74,7 @@ pybind_library(
hdrs = glob(["include/*.h"]),
strip_include_prefix = "include",
visibility = ["//visibility:public"],
deps = [":gloo"]
deps = [":gloo", "@rules_python//python/cc:current_py_cc_libs"]
)

pybind_extension(
Expand Down
8 changes: 4 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@

logger = logging.getLogger(__name__)

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

ROOT_DIR = os.path.dirname(__file__)

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

setuptools.setup(
name="pygloo",
version="0.2.0",
version="0.2.2.dev0",
author="Ray Team",
author_email="[email protected]",
description=("A python binding for gloo"),
description=("A python binding for gloo."),
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/ray-project/pygloo",
Expand Down
Loading