From 16479872d495e056613744dd469a6f897bd6afbe Mon Sep 17 00:00:00 2001 From: He Sichao <1310722434@qq.com> Date: Sun, 25 Aug 2024 22:13:14 +0800 Subject: [PATCH 01/18] Fix macos ci --- .github/workflows/CI.yml | 7 ++++--- pyproject.toml | 3 ++- set_CIBW_BUILD.sh | 20 ++++++++++++++++++++ 3 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 set_CIBW_BUILD.sh diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index ce76919..7f5b31d 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -28,7 +28,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: [ "3.9", "3.10", "3.11", ] + python-version: [ "3.9", "3.10", "3.11", "3.12"] steps: - name: Cancel Previous Runs @@ -59,7 +59,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: [ "3.9", "3.10", "3.11", ] + python-version: [ "3.9", "3.10", "3.11", "3.12"] steps: - name: Cancel Previous Runs @@ -79,6 +79,7 @@ jobs: python -m pip install --upgrade pip setuptools --no-cache-dir python -m pip install -r requirements-dev.txt --no-cache-dir pip install cibuildwheel + sh set_CIBW_BUILD.sh cibuildwheel --platform macos pip install dist/* - name: Test with pytest @@ -91,7 +92,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: [ "3.9", "3.10", "3.11", ] + python-version: [ "3.9", "3.10", "3.11", "3.12"] steps: - name: Cancel Previous Runs diff --git a/pyproject.toml b/pyproject.toml index 81c5044..ef22ea9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -31,12 +31,13 @@ requires = [ "pybind11", "setuptools_scm[toml]>=3.4", "cmake", + "taichi", ] build-backend = "setuptools.build_meta" [project] -requires-python = ">=3.9" +requires-python = ">=3.8, <=3.12" name = "braintaichi" version = "0.0.1" diff --git a/set_CIBW_BUILD.sh b/set_CIBW_BUILD.sh new file mode 100644 index 0000000..626beeb --- /dev/null +++ b/set_CIBW_BUILD.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +# Get the current Python version +python_version=$(python -c "import sys; print('.'.join(map(str, sys.version_info[:2])))") + +# Set the CIBW_BUILD environment variable based on the Python version +if [[ $python_version == "3.8" ]]; then + export CIBW_BUILD="cp38-macosx_x86_64" +elif [[ $python_version == "3.9" ]]; then + export CIBW_BUILD="cp39-macosx_x86_64*" +elif [[ $python_version == "3.10" ]]; then + export CIBW_BUILD="cp310-macosx_x86_64*" +elif [[ $python_version == "3.11"]]; then + export CIBW_BUILD="cp311-macosx_x86_64" +elif [[ $python_version == "3.12"]]; then + export CIBW_BUILD="cp312-macosx_x86_64" +else + echo "Unsupported Python version: $python_version" + exit 1 +fi \ No newline at end of file From 829e6a0eaa8ec3a12972e2cecc2e1f0777aacfeb Mon Sep 17 00:00:00 2001 From: He Sichao <1310722434@qq.com> Date: Sun, 25 Aug 2024 22:15:07 +0800 Subject: [PATCH 02/18] Update set_CIBW_BUILD.sh --- set_CIBW_BUILD.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/set_CIBW_BUILD.sh b/set_CIBW_BUILD.sh index 626beeb..487a769 100644 --- a/set_CIBW_BUILD.sh +++ b/set_CIBW_BUILD.sh @@ -10,9 +10,9 @@ elif [[ $python_version == "3.9" ]]; then export CIBW_BUILD="cp39-macosx_x86_64*" elif [[ $python_version == "3.10" ]]; then export CIBW_BUILD="cp310-macosx_x86_64*" -elif [[ $python_version == "3.11"]]; then +elif [[ $python_version == "3.11" ]]; then export CIBW_BUILD="cp311-macosx_x86_64" -elif [[ $python_version == "3.12"]]; then +elif [[ $python_version == "3.12" ]]; then export CIBW_BUILD="cp312-macosx_x86_64" else echo "Unsupported Python version: $python_version" From 24c21f237fad7ccf1f2bda389069116159c70ad6 Mon Sep 17 00:00:00 2001 From: He Sichao <1310722434@qq.com> Date: Sun, 25 Aug 2024 22:18:54 +0800 Subject: [PATCH 03/18] Update copy_so_macOS.sh --- copy_so_macOS.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/copy_so_macOS.sh b/copy_so_macOS.sh index 537344a..2374416 100644 --- a/copy_so_macOS.sh +++ b/copy_so_macOS.sh @@ -1,6 +1,7 @@ #! /bin/sh pip install -r requirements.txt +pip install taichi chmod +x ./copy_so_macOS.py python copy_so_macOS.py From 880357ae7bd93158fedb0adc4aba29dd205b41d9 Mon Sep 17 00:00:00 2001 From: He Sichao <1310722434@qq.com> Date: Sun, 25 Aug 2024 22:24:29 +0800 Subject: [PATCH 04/18] update --- copy_so_macOS.sh | 3 +- pyproject copy.toml | 70 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+), 2 deletions(-) create mode 100644 pyproject copy.toml diff --git a/copy_so_macOS.sh b/copy_so_macOS.sh index 2374416..4846a36 100644 --- a/copy_so_macOS.sh +++ b/copy_so_macOS.sh @@ -1,7 +1,6 @@ #! /bin/sh -pip install -r requirements.txt -pip install taichi +pip install taichi==1.7.2 chmod +x ./copy_so_macOS.py python copy_so_macOS.py diff --git a/pyproject copy.toml b/pyproject copy.toml new file mode 100644 index 0000000..70d34d0 --- /dev/null +++ b/pyproject copy.toml @@ -0,0 +1,70 @@ +[tool.cibuildwheel] +build = "*" +skip = "" +test-skip = "" + +archs = ["auto"] +build-frontend = "pip" +config-settings = {} +dependency-versions = "pinned" +environment = {} +environment-pass = [] +build-verbosity = 1 + +before-all = "" +repair-wheel-command = "" + +test-command = "" +before-test = "" +test-requires = [] +test-extras = [] + +container-engine = "docker" + +manylinux-x86_64-image = "manylinux2014" + +[build-system] +requires = [ + "setuptools==68.2.0", + "wheel", + "Cython", + "pybind11", + "setuptools_scm[toml]>=3.4", + "cmake", + "taichi==1.7.2", +] + +build-backend = "setuptools.build_meta" + +[project] +requires-python = ">=3.8,<=3.12" +name = "brainpylib" +version = "0.3.2" + +[tool.cibuildwheel.linux] +before-all = "sh prepare_build_wheel_on_cuda.sh" +before-build = "sh copy_so_linux.sh" +#before-build = "pip install -r requirements-test.txt" +archs = ["x86_64"] +skip = ["pp*", "*-musllinux_x86_64"] +repair-wheel-command = """ + export LD_LIBRARY_PATH=/project/brainpylib:$LD_LIBRARY_PATH && + auditwheel repair -w {dest_dir} {wheel} +""" + +[tool.cibuildwheel.macos] +before-build = "sh copy_so_macOS.sh" +archs = ["x86_64", "arm64"] +skip = ["pp*"] +repair-wheel-command = """ + export LD_LIBRARY_PATH=/project/brainpylib:$LD_LIBRARY_PATH && + delocate-wheel -w {dest_dir} -v {wheel} +""" + +[tool.cibuildwheel.windows] +before-build = "copy_dll_windows.bat" +archs = ["AMD64", "x86"] +repair-wheel-command = """ + set PATH=brainpylib;%PATH% && delvewheel repair -w {dest_dir} {wheel} +""" +skip = ["pp*", "*-win32"] From 4796c6a905209d3631f6ff41618c97cbfe6b9e98 Mon Sep 17 00:00:00 2001 From: He Sichao <1310722434@qq.com> Date: Sun, 25 Aug 2024 22:37:01 +0800 Subject: [PATCH 05/18] another way to cibuildwheel with specific python version --- .github/workflows/CI.yml | 2 +- .../mac/arm64/pyproject3.10.toml | 16 ++--- ci/mac/arm64/pyproject3.11.toml | 70 +++++++++++++++++++ ci/mac/arm64/pyproject3.12.toml | 70 +++++++++++++++++++ ci/mac/arm64/pyproject3.9.toml | 70 +++++++++++++++++++ ci/mac/x86_64/pyproject3.10.toml | 70 +++++++++++++++++++ ci/mac/x86_64/pyproject3.11.toml | 70 +++++++++++++++++++ ci/mac/x86_64/pyproject3.12.toml | 70 +++++++++++++++++++ ci/mac/x86_64/pyproject3.9.toml | 70 +++++++++++++++++++ ...W_BUILD.sh => copy_pyproject_mac_x86_64.sh | 12 ++-- pyproject.toml | 2 +- 11 files changed, 505 insertions(+), 17 deletions(-) rename pyproject copy.toml => ci/mac/arm64/pyproject3.10.toml (78%) create mode 100644 ci/mac/arm64/pyproject3.11.toml create mode 100644 ci/mac/arm64/pyproject3.12.toml create mode 100644 ci/mac/arm64/pyproject3.9.toml create mode 100644 ci/mac/x86_64/pyproject3.10.toml create mode 100644 ci/mac/x86_64/pyproject3.11.toml create mode 100644 ci/mac/x86_64/pyproject3.12.toml create mode 100644 ci/mac/x86_64/pyproject3.9.toml rename set_CIBW_BUILD.sh => copy_pyproject_mac_x86_64.sh (57%) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 7f5b31d..70ced03 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -79,7 +79,7 @@ jobs: python -m pip install --upgrade pip setuptools --no-cache-dir python -m pip install -r requirements-dev.txt --no-cache-dir pip install cibuildwheel - sh set_CIBW_BUILD.sh + sh copy_pyproject.sh cibuildwheel --platform macos pip install dist/* - name: Test with pytest diff --git a/pyproject copy.toml b/ci/mac/arm64/pyproject3.10.toml similarity index 78% rename from pyproject copy.toml rename to ci/mac/arm64/pyproject3.10.toml index 70d34d0..d8cdb8c 100644 --- a/pyproject copy.toml +++ b/ci/mac/arm64/pyproject3.10.toml @@ -31,15 +31,15 @@ requires = [ "pybind11", "setuptools_scm[toml]>=3.4", "cmake", - "taichi==1.7.2", + "taichi", ] build-backend = "setuptools.build_meta" [project] -requires-python = ">=3.8,<=3.12" -name = "brainpylib" -version = "0.3.2" +requires-python = "==3.10" +name = "braintaichi" +version = "0.0.1" [tool.cibuildwheel.linux] before-all = "sh prepare_build_wheel_on_cuda.sh" @@ -48,16 +48,16 @@ before-build = "sh copy_so_linux.sh" archs = ["x86_64"] skip = ["pp*", "*-musllinux_x86_64"] repair-wheel-command = """ - export LD_LIBRARY_PATH=/project/brainpylib:$LD_LIBRARY_PATH && + export LD_LIBRARY_PATH=/project/braintaichi:$LD_LIBRARY_PATH && auditwheel repair -w {dest_dir} {wheel} """ [tool.cibuildwheel.macos] before-build = "sh copy_so_macOS.sh" -archs = ["x86_64", "arm64"] +archs = ["arm64"] skip = ["pp*"] repair-wheel-command = """ - export LD_LIBRARY_PATH=/project/brainpylib:$LD_LIBRARY_PATH && + export LD_LIBRARY_PATH=/project/braintaichi:$LD_LIBRARY_PATH && delocate-wheel -w {dest_dir} -v {wheel} """ @@ -65,6 +65,6 @@ repair-wheel-command = """ before-build = "copy_dll_windows.bat" archs = ["AMD64", "x86"] repair-wheel-command = """ - set PATH=brainpylib;%PATH% && delvewheel repair -w {dest_dir} {wheel} + set PATH=braintaichi;%PATH% && delvewheel repair -w {dest_dir} {wheel} """ skip = ["pp*", "*-win32"] diff --git a/ci/mac/arm64/pyproject3.11.toml b/ci/mac/arm64/pyproject3.11.toml new file mode 100644 index 0000000..ac7ccc9 --- /dev/null +++ b/ci/mac/arm64/pyproject3.11.toml @@ -0,0 +1,70 @@ +[tool.cibuildwheel] +build = "*" +skip = "" +test-skip = "" + +archs = ["auto"] +build-frontend = "pip" +config-settings = {} +dependency-versions = "pinned" +environment = {} +environment-pass = [] +build-verbosity = 1 + +before-all = "" +repair-wheel-command = "" + +test-command = "" +before-test = "" +test-requires = [] +test-extras = [] + +container-engine = "docker" + +manylinux-x86_64-image = "manylinux2014" + +[build-system] +requires = [ + "setuptools==68.2.0", + "wheel", + "Cython", + "pybind11", + "setuptools_scm[toml]>=3.4", + "cmake", + "taichi", +] + +build-backend = "setuptools.build_meta" + +[project] +requires-python = "==3.11" +name = "braintaichi" +version = "0.0.1" + +[tool.cibuildwheel.linux] +before-all = "sh prepare_build_wheel_on_cuda.sh" +before-build = "sh copy_so_linux.sh" +#before-build = "pip install -r requirements-test.txt" +archs = ["x86_64"] +skip = ["pp*", "*-musllinux_x86_64"] +repair-wheel-command = """ + export LD_LIBRARY_PATH=/project/braintaichi:$LD_LIBRARY_PATH && + auditwheel repair -w {dest_dir} {wheel} +""" + +[tool.cibuildwheel.macos] +before-build = "sh copy_so_macOS.sh" +archs = ["arm64"] +skip = ["pp*"] +repair-wheel-command = """ + export LD_LIBRARY_PATH=/project/braintaichi:$LD_LIBRARY_PATH && + delocate-wheel -w {dest_dir} -v {wheel} +""" + +[tool.cibuildwheel.windows] +before-build = "copy_dll_windows.bat" +archs = ["AMD64", "x86"] +repair-wheel-command = """ + set PATH=braintaichi;%PATH% && delvewheel repair -w {dest_dir} {wheel} +""" +skip = ["pp*", "*-win32"] diff --git a/ci/mac/arm64/pyproject3.12.toml b/ci/mac/arm64/pyproject3.12.toml new file mode 100644 index 0000000..f6f53a4 --- /dev/null +++ b/ci/mac/arm64/pyproject3.12.toml @@ -0,0 +1,70 @@ +[tool.cibuildwheel] +build = "*" +skip = "" +test-skip = "" + +archs = ["auto"] +build-frontend = "pip" +config-settings = {} +dependency-versions = "pinned" +environment = {} +environment-pass = [] +build-verbosity = 1 + +before-all = "" +repair-wheel-command = "" + +test-command = "" +before-test = "" +test-requires = [] +test-extras = [] + +container-engine = "docker" + +manylinux-x86_64-image = "manylinux2014" + +[build-system] +requires = [ + "setuptools==68.2.0", + "wheel", + "Cython", + "pybind11", + "setuptools_scm[toml]>=3.4", + "cmake", + "taichi", +] + +build-backend = "setuptools.build_meta" + +[project] +requires-python = "==3.12" +name = "braintaichi" +version = "0.0.1" + +[tool.cibuildwheel.linux] +before-all = "sh prepare_build_wheel_on_cuda.sh" +before-build = "sh copy_so_linux.sh" +#before-build = "pip install -r requirements-test.txt" +archs = ["x86_64"] +skip = ["pp*", "*-musllinux_x86_64"] +repair-wheel-command = """ + export LD_LIBRARY_PATH=/project/braintaichi:$LD_LIBRARY_PATH && + auditwheel repair -w {dest_dir} {wheel} +""" + +[tool.cibuildwheel.macos] +before-build = "sh copy_so_macOS.sh" +archs = ["arm64"] +skip = ["pp*"] +repair-wheel-command = """ + export LD_LIBRARY_PATH=/project/braintaichi:$LD_LIBRARY_PATH && + delocate-wheel -w {dest_dir} -v {wheel} +""" + +[tool.cibuildwheel.windows] +before-build = "copy_dll_windows.bat" +archs = ["AMD64", "x86"] +repair-wheel-command = """ + set PATH=braintaichi;%PATH% && delvewheel repair -w {dest_dir} {wheel} +""" +skip = ["pp*", "*-win32"] diff --git a/ci/mac/arm64/pyproject3.9.toml b/ci/mac/arm64/pyproject3.9.toml new file mode 100644 index 0000000..a01bb24 --- /dev/null +++ b/ci/mac/arm64/pyproject3.9.toml @@ -0,0 +1,70 @@ +[tool.cibuildwheel] +build = "*" +skip = "" +test-skip = "" + +archs = ["auto"] +build-frontend = "pip" +config-settings = {} +dependency-versions = "pinned" +environment = {} +environment-pass = [] +build-verbosity = 1 + +before-all = "" +repair-wheel-command = "" + +test-command = "" +before-test = "" +test-requires = [] +test-extras = [] + +container-engine = "docker" + +manylinux-x86_64-image = "manylinux2014" + +[build-system] +requires = [ + "setuptools==68.2.0", + "wheel", + "Cython", + "pybind11", + "setuptools_scm[toml]>=3.4", + "cmake", + "taichi", +] + +build-backend = "setuptools.build_meta" + +[project] +requires-python = "==3.9" +name = "braintaichi" +version = "0.0.1" + +[tool.cibuildwheel.linux] +before-all = "sh prepare_build_wheel_on_cuda.sh" +before-build = "sh copy_so_linux.sh" +#before-build = "pip install -r requirements-test.txt" +archs = ["x86_64"] +skip = ["pp*", "*-musllinux_x86_64"] +repair-wheel-command = """ + export LD_LIBRARY_PATH=/project/braintaichi:$LD_LIBRARY_PATH && + auditwheel repair -w {dest_dir} {wheel} +""" + +[tool.cibuildwheel.macos] +before-build = "sh copy_so_macOS.sh" +archs = ["arm64"] +skip = ["pp*"] +repair-wheel-command = """ + export LD_LIBRARY_PATH=/project/braintaichi:$LD_LIBRARY_PATH && + delocate-wheel -w {dest_dir} -v {wheel} +""" + +[tool.cibuildwheel.windows] +before-build = "copy_dll_windows.bat" +archs = ["AMD64", "x86"] +repair-wheel-command = """ + set PATH=braintaichi;%PATH% && delvewheel repair -w {dest_dir} {wheel} +""" +skip = ["pp*", "*-win32"] diff --git a/ci/mac/x86_64/pyproject3.10.toml b/ci/mac/x86_64/pyproject3.10.toml new file mode 100644 index 0000000..ffb5193 --- /dev/null +++ b/ci/mac/x86_64/pyproject3.10.toml @@ -0,0 +1,70 @@ +[tool.cibuildwheel] +build = "*" +skip = "" +test-skip = "" + +archs = ["auto"] +build-frontend = "pip" +config-settings = {} +dependency-versions = "pinned" +environment = {} +environment-pass = [] +build-verbosity = 1 + +before-all = "" +repair-wheel-command = "" + +test-command = "" +before-test = "" +test-requires = [] +test-extras = [] + +container-engine = "docker" + +manylinux-x86_64-image = "manylinux2014" + +[build-system] +requires = [ + "setuptools==68.2.0", + "wheel", + "Cython", + "pybind11", + "setuptools_scm[toml]>=3.4", + "cmake", + "taichi", +] + +build-backend = "setuptools.build_meta" + +[project] +requires-python = "==3.10" +name = "braintaichi" +version = "0.0.1" + +[tool.cibuildwheel.linux] +before-all = "sh prepare_build_wheel_on_cuda.sh" +before-build = "sh copy_so_linux.sh" +#before-build = "pip install -r requirements-test.txt" +archs = ["x86_64"] +skip = ["pp*", "*-musllinux_x86_64"] +repair-wheel-command = """ + export LD_LIBRARY_PATH=/project/braintaichi:$LD_LIBRARY_PATH && + auditwheel repair -w {dest_dir} {wheel} +""" + +[tool.cibuildwheel.macos] +before-build = "sh copy_so_macOS.sh" +archs = ["x86_64"] +skip = ["pp*"] +repair-wheel-command = """ + export LD_LIBRARY_PATH=/project/braintaichi:$LD_LIBRARY_PATH && + delocate-wheel -w {dest_dir} -v {wheel} +""" + +[tool.cibuildwheel.windows] +before-build = "copy_dll_windows.bat" +archs = ["AMD64", "x86"] +repair-wheel-command = """ + set PATH=braintaichi;%PATH% && delvewheel repair -w {dest_dir} {wheel} +""" +skip = ["pp*", "*-win32"] diff --git a/ci/mac/x86_64/pyproject3.11.toml b/ci/mac/x86_64/pyproject3.11.toml new file mode 100644 index 0000000..095821b --- /dev/null +++ b/ci/mac/x86_64/pyproject3.11.toml @@ -0,0 +1,70 @@ +[tool.cibuildwheel] +build = "*" +skip = "" +test-skip = "" + +archs = ["auto"] +build-frontend = "pip" +config-settings = {} +dependency-versions = "pinned" +environment = {} +environment-pass = [] +build-verbosity = 1 + +before-all = "" +repair-wheel-command = "" + +test-command = "" +before-test = "" +test-requires = [] +test-extras = [] + +container-engine = "docker" + +manylinux-x86_64-image = "manylinux2014" + +[build-system] +requires = [ + "setuptools==68.2.0", + "wheel", + "Cython", + "pybind11", + "setuptools_scm[toml]>=3.4", + "cmake", + "taichi", +] + +build-backend = "setuptools.build_meta" + +[project] +requires-python = "==3.11" +name = "braintaichi" +version = "0.0.1" + +[tool.cibuildwheel.linux] +before-all = "sh prepare_build_wheel_on_cuda.sh" +before-build = "sh copy_so_linux.sh" +#before-build = "pip install -r requirements-test.txt" +archs = ["x86_64"] +skip = ["pp*", "*-musllinux_x86_64"] +repair-wheel-command = """ + export LD_LIBRARY_PATH=/project/braintaichi:$LD_LIBRARY_PATH && + auditwheel repair -w {dest_dir} {wheel} +""" + +[tool.cibuildwheel.macos] +before-build = "sh copy_so_macOS.sh" +archs = ["x86_64"] +skip = ["pp*"] +repair-wheel-command = """ + export LD_LIBRARY_PATH=/project/braintaichi:$LD_LIBRARY_PATH && + delocate-wheel -w {dest_dir} -v {wheel} +""" + +[tool.cibuildwheel.windows] +before-build = "copy_dll_windows.bat" +archs = ["AMD64", "x86"] +repair-wheel-command = """ + set PATH=braintaichi;%PATH% && delvewheel repair -w {dest_dir} {wheel} +""" +skip = ["pp*", "*-win32"] diff --git a/ci/mac/x86_64/pyproject3.12.toml b/ci/mac/x86_64/pyproject3.12.toml new file mode 100644 index 0000000..ef33443 --- /dev/null +++ b/ci/mac/x86_64/pyproject3.12.toml @@ -0,0 +1,70 @@ +[tool.cibuildwheel] +build = "*" +skip = "" +test-skip = "" + +archs = ["auto"] +build-frontend = "pip" +config-settings = {} +dependency-versions = "pinned" +environment = {} +environment-pass = [] +build-verbosity = 1 + +before-all = "" +repair-wheel-command = "" + +test-command = "" +before-test = "" +test-requires = [] +test-extras = [] + +container-engine = "docker" + +manylinux-x86_64-image = "manylinux2014" + +[build-system] +requires = [ + "setuptools==68.2.0", + "wheel", + "Cython", + "pybind11", + "setuptools_scm[toml]>=3.4", + "cmake", + "taichi", +] + +build-backend = "setuptools.build_meta" + +[project] +requires-python = "==3.12" +name = "braintaichi" +version = "0.0.1" + +[tool.cibuildwheel.linux] +before-all = "sh prepare_build_wheel_on_cuda.sh" +before-build = "sh copy_so_linux.sh" +#before-build = "pip install -r requirements-test.txt" +archs = ["x86_64"] +skip = ["pp*", "*-musllinux_x86_64"] +repair-wheel-command = """ + export LD_LIBRARY_PATH=/project/braintaichi:$LD_LIBRARY_PATH && + auditwheel repair -w {dest_dir} {wheel} +""" + +[tool.cibuildwheel.macos] +before-build = "sh copy_so_macOS.sh" +archs = ["x86_64"] +skip = ["pp*"] +repair-wheel-command = """ + export LD_LIBRARY_PATH=/project/braintaichi:$LD_LIBRARY_PATH && + delocate-wheel -w {dest_dir} -v {wheel} +""" + +[tool.cibuildwheel.windows] +before-build = "copy_dll_windows.bat" +archs = ["AMD64", "x86"] +repair-wheel-command = """ + set PATH=braintaichi;%PATH% && delvewheel repair -w {dest_dir} {wheel} +""" +skip = ["pp*", "*-win32"] diff --git a/ci/mac/x86_64/pyproject3.9.toml b/ci/mac/x86_64/pyproject3.9.toml new file mode 100644 index 0000000..d40b70a --- /dev/null +++ b/ci/mac/x86_64/pyproject3.9.toml @@ -0,0 +1,70 @@ +[tool.cibuildwheel] +build = "*" +skip = "" +test-skip = "" + +archs = ["auto"] +build-frontend = "pip" +config-settings = {} +dependency-versions = "pinned" +environment = {} +environment-pass = [] +build-verbosity = 1 + +before-all = "" +repair-wheel-command = "" + +test-command = "" +before-test = "" +test-requires = [] +test-extras = [] + +container-engine = "docker" + +manylinux-x86_64-image = "manylinux2014" + +[build-system] +requires = [ + "setuptools==68.2.0", + "wheel", + "Cython", + "pybind11", + "setuptools_scm[toml]>=3.4", + "cmake", + "taichi", +] + +build-backend = "setuptools.build_meta" + +[project] +requires-python = "==3.9" +name = "braintaichi" +version = "0.0.1" + +[tool.cibuildwheel.linux] +before-all = "sh prepare_build_wheel_on_cuda.sh" +before-build = "sh copy_so_linux.sh" +#before-build = "pip install -r requirements-test.txt" +archs = ["x86_64"] +skip = ["pp*", "*-musllinux_x86_64"] +repair-wheel-command = """ + export LD_LIBRARY_PATH=/project/braintaichi:$LD_LIBRARY_PATH && + auditwheel repair -w {dest_dir} {wheel} +""" + +[tool.cibuildwheel.macos] +before-build = "sh copy_so_macOS.sh" +archs = ["x86_64"] +skip = ["pp*"] +repair-wheel-command = """ + export LD_LIBRARY_PATH=/project/braintaichi:$LD_LIBRARY_PATH && + delocate-wheel -w {dest_dir} -v {wheel} +""" + +[tool.cibuildwheel.windows] +before-build = "copy_dll_windows.bat" +archs = ["AMD64", "x86"] +repair-wheel-command = """ + set PATH=braintaichi;%PATH% && delvewheel repair -w {dest_dir} {wheel} +""" +skip = ["pp*", "*-win32"] diff --git a/set_CIBW_BUILD.sh b/copy_pyproject_mac_x86_64.sh similarity index 57% rename from set_CIBW_BUILD.sh rename to copy_pyproject_mac_x86_64.sh index 487a769..4b72fe2 100644 --- a/set_CIBW_BUILD.sh +++ b/copy_pyproject_mac_x86_64.sh @@ -4,16 +4,14 @@ python_version=$(python -c "import sys; print('.'.join(map(str, sys.version_info[:2])))") # Set the CIBW_BUILD environment variable based on the Python version -if [[ $python_version == "3.8" ]]; then - export CIBW_BUILD="cp38-macosx_x86_64" -elif [[ $python_version == "3.9" ]]; then - export CIBW_BUILD="cp39-macosx_x86_64*" +if [[ $python_version == "3.9" ]]; then + cp ci/mac/x86_64/pyproject3.9.toml pyproject.toml elif [[ $python_version == "3.10" ]]; then - export CIBW_BUILD="cp310-macosx_x86_64*" + cp ci/mac/x86_64/pyproject3.10.toml pyproject.toml elif [[ $python_version == "3.11" ]]; then - export CIBW_BUILD="cp311-macosx_x86_64" + cp ci/mac/x86_64/pyproject3.11.toml pyproject.toml elif [[ $python_version == "3.12" ]]; then - export CIBW_BUILD="cp312-macosx_x86_64" + cp ci/mac/x86_64/pyproject3.12.toml pyproject.toml else echo "Unsupported Python version: $python_version" exit 1 diff --git a/pyproject.toml b/pyproject.toml index ef22ea9..a53cdbd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,7 +25,7 @@ manylinux-x86_64-image = "manylinux2014" [build-system] requires = [ - "setuptools", + "setuptools==68.2.0", "wheel", "Cython", "pybind11", From 8a1d7d766b61072ad7f4eed100e067c7084bc5ff Mon Sep 17 00:00:00 2001 From: He Sichao <1310722434@qq.com> Date: Sun, 25 Aug 2024 22:38:13 +0800 Subject: [PATCH 06/18] Update CI.yml --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 70ced03..b118b66 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -79,7 +79,7 @@ jobs: python -m pip install --upgrade pip setuptools --no-cache-dir python -m pip install -r requirements-dev.txt --no-cache-dir pip install cibuildwheel - sh copy_pyproject.sh + sh copy_pyproject_mac_x86_64.sh cibuildwheel --platform macos pip install dist/* - name: Test with pytest From b164494d276a4ef2e4a9272ba305224bb86e0c5d Mon Sep 17 00:00:00 2001 From: He Sichao <1310722434@qq.com> Date: Sun, 25 Aug 2024 22:48:40 +0800 Subject: [PATCH 07/18] Update --- ci/mac/arm64/pyproject3.10.toml | 2 +- ci/mac/arm64/pyproject3.11.toml | 2 +- ci/mac/arm64/pyproject3.12.toml | 2 +- ci/mac/arm64/pyproject3.9.toml | 2 +- ci/mac/x86_64/pyproject3.10.toml | 2 +- ci/mac/x86_64/pyproject3.11.toml | 2 +- ci/mac/x86_64/pyproject3.12.toml | 2 +- ci/mac/x86_64/pyproject3.9.toml | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ci/mac/arm64/pyproject3.10.toml b/ci/mac/arm64/pyproject3.10.toml index d8cdb8c..c6823dc 100644 --- a/ci/mac/arm64/pyproject3.10.toml +++ b/ci/mac/arm64/pyproject3.10.toml @@ -37,7 +37,7 @@ requires = [ build-backend = "setuptools.build_meta" [project] -requires-python = "==3.10" +requires-python = "=3.10" name = "braintaichi" version = "0.0.1" diff --git a/ci/mac/arm64/pyproject3.11.toml b/ci/mac/arm64/pyproject3.11.toml index ac7ccc9..55f358b 100644 --- a/ci/mac/arm64/pyproject3.11.toml +++ b/ci/mac/arm64/pyproject3.11.toml @@ -37,7 +37,7 @@ requires = [ build-backend = "setuptools.build_meta" [project] -requires-python = "==3.11" +requires-python = "=3.11" name = "braintaichi" version = "0.0.1" diff --git a/ci/mac/arm64/pyproject3.12.toml b/ci/mac/arm64/pyproject3.12.toml index f6f53a4..513dc83 100644 --- a/ci/mac/arm64/pyproject3.12.toml +++ b/ci/mac/arm64/pyproject3.12.toml @@ -37,7 +37,7 @@ requires = [ build-backend = "setuptools.build_meta" [project] -requires-python = "==3.12" +requires-python = "=3.12" name = "braintaichi" version = "0.0.1" diff --git a/ci/mac/arm64/pyproject3.9.toml b/ci/mac/arm64/pyproject3.9.toml index a01bb24..01d4dd9 100644 --- a/ci/mac/arm64/pyproject3.9.toml +++ b/ci/mac/arm64/pyproject3.9.toml @@ -37,7 +37,7 @@ requires = [ build-backend = "setuptools.build_meta" [project] -requires-python = "==3.9" +requires-python = "=3.9" name = "braintaichi" version = "0.0.1" diff --git a/ci/mac/x86_64/pyproject3.10.toml b/ci/mac/x86_64/pyproject3.10.toml index ffb5193..0919b9a 100644 --- a/ci/mac/x86_64/pyproject3.10.toml +++ b/ci/mac/x86_64/pyproject3.10.toml @@ -37,7 +37,7 @@ requires = [ build-backend = "setuptools.build_meta" [project] -requires-python = "==3.10" +requires-python = "=3.10" name = "braintaichi" version = "0.0.1" diff --git a/ci/mac/x86_64/pyproject3.11.toml b/ci/mac/x86_64/pyproject3.11.toml index 095821b..930652f 100644 --- a/ci/mac/x86_64/pyproject3.11.toml +++ b/ci/mac/x86_64/pyproject3.11.toml @@ -37,7 +37,7 @@ requires = [ build-backend = "setuptools.build_meta" [project] -requires-python = "==3.11" +requires-python = "=3.11" name = "braintaichi" version = "0.0.1" diff --git a/ci/mac/x86_64/pyproject3.12.toml b/ci/mac/x86_64/pyproject3.12.toml index ef33443..bf9f1f0 100644 --- a/ci/mac/x86_64/pyproject3.12.toml +++ b/ci/mac/x86_64/pyproject3.12.toml @@ -37,7 +37,7 @@ requires = [ build-backend = "setuptools.build_meta" [project] -requires-python = "==3.12" +requires-python = "=3.12" name = "braintaichi" version = "0.0.1" diff --git a/ci/mac/x86_64/pyproject3.9.toml b/ci/mac/x86_64/pyproject3.9.toml index d40b70a..cd865f1 100644 --- a/ci/mac/x86_64/pyproject3.9.toml +++ b/ci/mac/x86_64/pyproject3.9.toml @@ -37,7 +37,7 @@ requires = [ build-backend = "setuptools.build_meta" [project] -requires-python = "==3.9" +requires-python = "=3.9" name = "braintaichi" version = "0.0.1" From 464740da8bb798bf4bfff68ebe5d496117228fc4 Mon Sep 17 00:00:00 2001 From: He Sichao <1310722434@qq.com> Date: Sun, 25 Aug 2024 22:50:46 +0800 Subject: [PATCH 08/18] Update --- ci/mac/arm64/pyproject3.10.toml | 2 +- ci/mac/arm64/pyproject3.11.toml | 2 +- ci/mac/arm64/pyproject3.12.toml | 2 +- ci/mac/arm64/pyproject3.9.toml | 2 +- ci/mac/x86_64/pyproject3.10.toml | 2 +- ci/mac/x86_64/pyproject3.11.toml | 2 +- ci/mac/x86_64/pyproject3.12.toml | 2 +- ci/mac/x86_64/pyproject3.9.toml | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ci/mac/arm64/pyproject3.10.toml b/ci/mac/arm64/pyproject3.10.toml index c6823dc..89e1bad 100644 --- a/ci/mac/arm64/pyproject3.10.toml +++ b/ci/mac/arm64/pyproject3.10.toml @@ -37,7 +37,7 @@ requires = [ build-backend = "setuptools.build_meta" [project] -requires-python = "=3.10" +requires-python = ">=3.10, <=3.10" name = "braintaichi" version = "0.0.1" diff --git a/ci/mac/arm64/pyproject3.11.toml b/ci/mac/arm64/pyproject3.11.toml index 55f358b..a1269fe 100644 --- a/ci/mac/arm64/pyproject3.11.toml +++ b/ci/mac/arm64/pyproject3.11.toml @@ -37,7 +37,7 @@ requires = [ build-backend = "setuptools.build_meta" [project] -requires-python = "=3.11" +requires-python = ">=3.11, <=3.11" name = "braintaichi" version = "0.0.1" diff --git a/ci/mac/arm64/pyproject3.12.toml b/ci/mac/arm64/pyproject3.12.toml index 513dc83..1e3bba9 100644 --- a/ci/mac/arm64/pyproject3.12.toml +++ b/ci/mac/arm64/pyproject3.12.toml @@ -37,7 +37,7 @@ requires = [ build-backend = "setuptools.build_meta" [project] -requires-python = "=3.12" +requires-python = ">=3.12, <=3.12" name = "braintaichi" version = "0.0.1" diff --git a/ci/mac/arm64/pyproject3.9.toml b/ci/mac/arm64/pyproject3.9.toml index 01d4dd9..b09c8a0 100644 --- a/ci/mac/arm64/pyproject3.9.toml +++ b/ci/mac/arm64/pyproject3.9.toml @@ -37,7 +37,7 @@ requires = [ build-backend = "setuptools.build_meta" [project] -requires-python = "=3.9" +requires-python = ">=3.9, <=3.9" name = "braintaichi" version = "0.0.1" diff --git a/ci/mac/x86_64/pyproject3.10.toml b/ci/mac/x86_64/pyproject3.10.toml index 0919b9a..5eadb5c 100644 --- a/ci/mac/x86_64/pyproject3.10.toml +++ b/ci/mac/x86_64/pyproject3.10.toml @@ -37,7 +37,7 @@ requires = [ build-backend = "setuptools.build_meta" [project] -requires-python = "=3.10" +requires-python = ">=3.10, <=3.10" name = "braintaichi" version = "0.0.1" diff --git a/ci/mac/x86_64/pyproject3.11.toml b/ci/mac/x86_64/pyproject3.11.toml index 930652f..7f2bfb3 100644 --- a/ci/mac/x86_64/pyproject3.11.toml +++ b/ci/mac/x86_64/pyproject3.11.toml @@ -37,7 +37,7 @@ requires = [ build-backend = "setuptools.build_meta" [project] -requires-python = "=3.11" +requires-python = ">=3.11, <=3.11" name = "braintaichi" version = "0.0.1" diff --git a/ci/mac/x86_64/pyproject3.12.toml b/ci/mac/x86_64/pyproject3.12.toml index bf9f1f0..d2cde2e 100644 --- a/ci/mac/x86_64/pyproject3.12.toml +++ b/ci/mac/x86_64/pyproject3.12.toml @@ -37,7 +37,7 @@ requires = [ build-backend = "setuptools.build_meta" [project] -requires-python = "=3.12" +requires-python = ">=3.12, <=3.12" name = "braintaichi" version = "0.0.1" diff --git a/ci/mac/x86_64/pyproject3.9.toml b/ci/mac/x86_64/pyproject3.9.toml index cd865f1..8e2aa5a 100644 --- a/ci/mac/x86_64/pyproject3.9.toml +++ b/ci/mac/x86_64/pyproject3.9.toml @@ -37,7 +37,7 @@ requires = [ build-backend = "setuptools.build_meta" [project] -requires-python = "=3.9" +requires-python = ">=3.9, <=3.9" name = "braintaichi" version = "0.0.1" From f8a85150e7b790e0e63b03a3d16303eca1c5b6a2 Mon Sep 17 00:00:00 2001 From: He Sichao <1310722434@qq.com> Date: Sun, 25 Aug 2024 22:57:49 +0800 Subject: [PATCH 09/18] Update --- ci/mac/x86_64/pyproject3.10.toml | 2 +- ci/mac/x86_64/pyproject3.11.toml | 2 +- ci/mac/x86_64/pyproject3.12.toml | 2 +- ci/mac/x86_64/pyproject3.9.toml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ci/mac/x86_64/pyproject3.10.toml b/ci/mac/x86_64/pyproject3.10.toml index 5eadb5c..627dfc4 100644 --- a/ci/mac/x86_64/pyproject3.10.toml +++ b/ci/mac/x86_64/pyproject3.10.toml @@ -37,7 +37,7 @@ requires = [ build-backend = "setuptools.build_meta" [project] -requires-python = ">=3.10, <=3.10" +requires-python = ">=3.10, <3.11" name = "braintaichi" version = "0.0.1" diff --git a/ci/mac/x86_64/pyproject3.11.toml b/ci/mac/x86_64/pyproject3.11.toml index 7f2bfb3..4f4fd35 100644 --- a/ci/mac/x86_64/pyproject3.11.toml +++ b/ci/mac/x86_64/pyproject3.11.toml @@ -37,7 +37,7 @@ requires = [ build-backend = "setuptools.build_meta" [project] -requires-python = ">=3.11, <=3.11" +requires-python = ">=3.11, <3.12" name = "braintaichi" version = "0.0.1" diff --git a/ci/mac/x86_64/pyproject3.12.toml b/ci/mac/x86_64/pyproject3.12.toml index d2cde2e..2236a19 100644 --- a/ci/mac/x86_64/pyproject3.12.toml +++ b/ci/mac/x86_64/pyproject3.12.toml @@ -37,7 +37,7 @@ requires = [ build-backend = "setuptools.build_meta" [project] -requires-python = ">=3.12, <=3.12" +requires-python = ">=3.12, <3.13" name = "braintaichi" version = "0.0.1" diff --git a/ci/mac/x86_64/pyproject3.9.toml b/ci/mac/x86_64/pyproject3.9.toml index 8e2aa5a..cf24642 100644 --- a/ci/mac/x86_64/pyproject3.9.toml +++ b/ci/mac/x86_64/pyproject3.9.toml @@ -37,7 +37,7 @@ requires = [ build-backend = "setuptools.build_meta" [project] -requires-python = ">=3.9, <=3.9" +requires-python = ">=3.9, <3.10" name = "braintaichi" version = "0.0.1" From 66af18838dd2cf89aee26c8e10f9e2a499d5d8a1 Mon Sep 17 00:00:00 2001 From: He Sichao <1310722434@qq.com> Date: Sun, 25 Aug 2024 23:01:57 +0800 Subject: [PATCH 10/18] Update copy_so_macOS.sh --- copy_so_macOS.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/copy_so_macOS.sh b/copy_so_macOS.sh index 4846a36..306771d 100644 --- a/copy_so_macOS.sh +++ b/copy_so_macOS.sh @@ -8,3 +8,5 @@ python copy_so_macOS.py source project/set_env.sh cp "$taichi_runtime_lib_dir"/libtaichi_c_api.dylib project/braintaichi/ +ll project/braintaichi/ + From 2df746d7c55e4d54f3db89060586f88eed6dfd6d Mon Sep 17 00:00:00 2001 From: He Sichao <1310722434@qq.com> Date: Sun, 25 Aug 2024 23:02:54 +0800 Subject: [PATCH 11/18] Update copy_so_macOS.sh --- copy_so_macOS.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/copy_so_macOS.sh b/copy_so_macOS.sh index 306771d..22d7160 100644 --- a/copy_so_macOS.sh +++ b/copy_so_macOS.sh @@ -8,5 +8,5 @@ python copy_so_macOS.py source project/set_env.sh cp "$taichi_runtime_lib_dir"/libtaichi_c_api.dylib project/braintaichi/ -ll project/braintaichi/ +ls project/braintaichi/ From 7347b5603b15c38e356d520f1a7f45de8488d2e3 Mon Sep 17 00:00:00 2001 From: He Sichao <1310722434@qq.com> Date: Sun, 25 Aug 2024 23:20:48 +0800 Subject: [PATCH 12/18] Update --- ci/mac/x86_64/pyproject3.10.toml | 6 ++++-- ci/mac/x86_64/pyproject3.11.toml | 6 ++++-- ci/mac/x86_64/pyproject3.12.toml | 6 ++++-- ci/mac/x86_64/pyproject3.9.toml | 6 ++++-- copy_so_macOS.sh | 16 +++++++++++++--- 5 files changed, 29 insertions(+), 11 deletions(-) diff --git a/ci/mac/x86_64/pyproject3.10.toml b/ci/mac/x86_64/pyproject3.10.toml index 627dfc4..a4b2f74 100644 --- a/ci/mac/x86_64/pyproject3.10.toml +++ b/ci/mac/x86_64/pyproject3.10.toml @@ -57,8 +57,10 @@ before-build = "sh copy_so_macOS.sh" archs = ["x86_64"] skip = ["pp*"] repair-wheel-command = """ - export LD_LIBRARY_PATH=/project/braintaichi:$LD_LIBRARY_PATH && - delocate-wheel -w {dest_dir} -v {wheel} + pwd && + export DYLD_LIBRARY_PATH=$project_path:$LD_LIBRARY_PATH && + delocate-wheel -w {dest_dir} -v {wheel} && + echo $DYLD_LIBRARY_PATH """ [tool.cibuildwheel.windows] diff --git a/ci/mac/x86_64/pyproject3.11.toml b/ci/mac/x86_64/pyproject3.11.toml index 4f4fd35..90d5f97 100644 --- a/ci/mac/x86_64/pyproject3.11.toml +++ b/ci/mac/x86_64/pyproject3.11.toml @@ -48,8 +48,10 @@ before-build = "sh copy_so_linux.sh" archs = ["x86_64"] skip = ["pp*", "*-musllinux_x86_64"] repair-wheel-command = """ - export LD_LIBRARY_PATH=/project/braintaichi:$LD_LIBRARY_PATH && - auditwheel repair -w {dest_dir} {wheel} + pwd && + export DYLD_LIBRARY_PATH=$project_path:$LD_LIBRARY_PATH && + delocate-wheel -w {dest_dir} -v {wheel} && + echo $DYLD_LIBRARY_PATH """ [tool.cibuildwheel.macos] diff --git a/ci/mac/x86_64/pyproject3.12.toml b/ci/mac/x86_64/pyproject3.12.toml index 2236a19..03e98e8 100644 --- a/ci/mac/x86_64/pyproject3.12.toml +++ b/ci/mac/x86_64/pyproject3.12.toml @@ -57,8 +57,10 @@ before-build = "sh copy_so_macOS.sh" archs = ["x86_64"] skip = ["pp*"] repair-wheel-command = """ - export LD_LIBRARY_PATH=/project/braintaichi:$LD_LIBRARY_PATH && - delocate-wheel -w {dest_dir} -v {wheel} + pwd && + export DYLD_LIBRARY_PATH=$project_path:$LD_LIBRARY_PATH && + delocate-wheel -w {dest_dir} -v {wheel} && + echo $DYLD_LIBRARY_PATH """ [tool.cibuildwheel.windows] diff --git a/ci/mac/x86_64/pyproject3.9.toml b/ci/mac/x86_64/pyproject3.9.toml index cf24642..37535fd 100644 --- a/ci/mac/x86_64/pyproject3.9.toml +++ b/ci/mac/x86_64/pyproject3.9.toml @@ -57,8 +57,10 @@ before-build = "sh copy_so_macOS.sh" archs = ["x86_64"] skip = ["pp*"] repair-wheel-command = """ - export LD_LIBRARY_PATH=/project/braintaichi:$LD_LIBRARY_PATH && - delocate-wheel -w {dest_dir} -v {wheel} + pwd && + export DYLD_LIBRARY_PATH=$project_path:$LD_LIBRARY_PATH && + delocate-wheel -w {dest_dir} -v {wheel} && + echo $DYLD_LIBRARY_PATH """ [tool.cibuildwheel.windows] diff --git a/copy_so_macOS.sh b/copy_so_macOS.sh index 22d7160..32ab771 100644 --- a/copy_so_macOS.sh +++ b/copy_so_macOS.sh @@ -5,8 +5,18 @@ chmod +x ./copy_so_macOS.py python copy_so_macOS.py # Ensure the set_env.sh script is actually created and is not empty -source project/set_env.sh -cp "$taichi_runtime_lib_dir"/libtaichi_c_api.dylib project/braintaichi/ +# Get the absolute path of the project/braintaichi directory +project_path="$(dirname "$(realpath "$0")")/project/braintaichi" -ls project/braintaichi/ +# Set the absolute path as an environment variable +export PROJECT_PATH="$project_path" + +# Source the set_env.sh script +source "$project_path/set_env.sh" + +# Copy the libtaichi_c_api.dylib file to the project/braintaichi directory +cp "$taichi_runtime_lib_dir"/libtaichi_c_api.dylib "$project_path/" + +# List the contents of the project/braintaichi directory +ls "$project_path" From 3da53b0c87f81db466b001dad11b64ea537f6580 Mon Sep 17 00:00:00 2001 From: He Sichao <1310722434@qq.com> Date: Sun, 25 Aug 2024 23:22:12 +0800 Subject: [PATCH 13/18] Revert "Update" This reverts commit 7347b5603b15c38e356d520f1a7f45de8488d2e3. --- ci/mac/x86_64/pyproject3.10.toml | 6 ++---- ci/mac/x86_64/pyproject3.11.toml | 6 ++---- ci/mac/x86_64/pyproject3.12.toml | 6 ++---- ci/mac/x86_64/pyproject3.9.toml | 6 ++---- copy_so_macOS.sh | 16 +++------------- 5 files changed, 11 insertions(+), 29 deletions(-) diff --git a/ci/mac/x86_64/pyproject3.10.toml b/ci/mac/x86_64/pyproject3.10.toml index a4b2f74..627dfc4 100644 --- a/ci/mac/x86_64/pyproject3.10.toml +++ b/ci/mac/x86_64/pyproject3.10.toml @@ -57,10 +57,8 @@ before-build = "sh copy_so_macOS.sh" archs = ["x86_64"] skip = ["pp*"] repair-wheel-command = """ - pwd && - export DYLD_LIBRARY_PATH=$project_path:$LD_LIBRARY_PATH && - delocate-wheel -w {dest_dir} -v {wheel} && - echo $DYLD_LIBRARY_PATH + export LD_LIBRARY_PATH=/project/braintaichi:$LD_LIBRARY_PATH && + delocate-wheel -w {dest_dir} -v {wheel} """ [tool.cibuildwheel.windows] diff --git a/ci/mac/x86_64/pyproject3.11.toml b/ci/mac/x86_64/pyproject3.11.toml index 90d5f97..4f4fd35 100644 --- a/ci/mac/x86_64/pyproject3.11.toml +++ b/ci/mac/x86_64/pyproject3.11.toml @@ -48,10 +48,8 @@ before-build = "sh copy_so_linux.sh" archs = ["x86_64"] skip = ["pp*", "*-musllinux_x86_64"] repair-wheel-command = """ - pwd && - export DYLD_LIBRARY_PATH=$project_path:$LD_LIBRARY_PATH && - delocate-wheel -w {dest_dir} -v {wheel} && - echo $DYLD_LIBRARY_PATH + export LD_LIBRARY_PATH=/project/braintaichi:$LD_LIBRARY_PATH && + auditwheel repair -w {dest_dir} {wheel} """ [tool.cibuildwheel.macos] diff --git a/ci/mac/x86_64/pyproject3.12.toml b/ci/mac/x86_64/pyproject3.12.toml index 03e98e8..2236a19 100644 --- a/ci/mac/x86_64/pyproject3.12.toml +++ b/ci/mac/x86_64/pyproject3.12.toml @@ -57,10 +57,8 @@ before-build = "sh copy_so_macOS.sh" archs = ["x86_64"] skip = ["pp*"] repair-wheel-command = """ - pwd && - export DYLD_LIBRARY_PATH=$project_path:$LD_LIBRARY_PATH && - delocate-wheel -w {dest_dir} -v {wheel} && - echo $DYLD_LIBRARY_PATH + export LD_LIBRARY_PATH=/project/braintaichi:$LD_LIBRARY_PATH && + delocate-wheel -w {dest_dir} -v {wheel} """ [tool.cibuildwheel.windows] diff --git a/ci/mac/x86_64/pyproject3.9.toml b/ci/mac/x86_64/pyproject3.9.toml index 37535fd..cf24642 100644 --- a/ci/mac/x86_64/pyproject3.9.toml +++ b/ci/mac/x86_64/pyproject3.9.toml @@ -57,10 +57,8 @@ before-build = "sh copy_so_macOS.sh" archs = ["x86_64"] skip = ["pp*"] repair-wheel-command = """ - pwd && - export DYLD_LIBRARY_PATH=$project_path:$LD_LIBRARY_PATH && - delocate-wheel -w {dest_dir} -v {wheel} && - echo $DYLD_LIBRARY_PATH + export LD_LIBRARY_PATH=/project/braintaichi:$LD_LIBRARY_PATH && + delocate-wheel -w {dest_dir} -v {wheel} """ [tool.cibuildwheel.windows] diff --git a/copy_so_macOS.sh b/copy_so_macOS.sh index 32ab771..22d7160 100644 --- a/copy_so_macOS.sh +++ b/copy_so_macOS.sh @@ -5,18 +5,8 @@ chmod +x ./copy_so_macOS.py python copy_so_macOS.py # Ensure the set_env.sh script is actually created and is not empty -# Get the absolute path of the project/braintaichi directory -project_path="$(dirname "$(realpath "$0")")/project/braintaichi" +source project/set_env.sh +cp "$taichi_runtime_lib_dir"/libtaichi_c_api.dylib project/braintaichi/ -# Set the absolute path as an environment variable -export PROJECT_PATH="$project_path" - -# Source the set_env.sh script -source "$project_path/set_env.sh" - -# Copy the libtaichi_c_api.dylib file to the project/braintaichi directory -cp "$taichi_runtime_lib_dir"/libtaichi_c_api.dylib "$project_path/" - -# List the contents of the project/braintaichi directory -ls "$project_path" +ls project/braintaichi/ From 45b4c4c712206d46e84f268a05fd80a029cb0e8b Mon Sep 17 00:00:00 2001 From: He Sichao <1310722434@qq.com> Date: Sun, 25 Aug 2024 23:23:24 +0800 Subject: [PATCH 14/18] Update --- ci/mac/arm64/pyproject3.10.toml | 2 +- ci/mac/arm64/pyproject3.11.toml | 2 +- ci/mac/arm64/pyproject3.12.toml | 4 ++-- ci/mac/arm64/pyproject3.9.toml | 2 +- ci/mac/x86_64/pyproject3.10.toml | 2 +- ci/mac/x86_64/pyproject3.11.toml | 4 ++-- ci/mac/x86_64/pyproject3.12.toml | 2 +- ci/mac/x86_64/pyproject3.9.toml | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/ci/mac/arm64/pyproject3.10.toml b/ci/mac/arm64/pyproject3.10.toml index 89e1bad..b152daf 100644 --- a/ci/mac/arm64/pyproject3.10.toml +++ b/ci/mac/arm64/pyproject3.10.toml @@ -57,7 +57,7 @@ before-build = "sh copy_so_macOS.sh" archs = ["arm64"] skip = ["pp*"] repair-wheel-command = """ - export LD_LIBRARY_PATH=/project/braintaichi:$LD_LIBRARY_PATH && + export DYLD_LIBRARY_PATH=/Users/runner/work/braintaichi/braintaichi/project/braintaichi:$DYLD_LIBRARY_PATH && delocate-wheel -w {dest_dir} -v {wheel} """ diff --git a/ci/mac/arm64/pyproject3.11.toml b/ci/mac/arm64/pyproject3.11.toml index a1269fe..d4273da 100644 --- a/ci/mac/arm64/pyproject3.11.toml +++ b/ci/mac/arm64/pyproject3.11.toml @@ -57,7 +57,7 @@ before-build = "sh copy_so_macOS.sh" archs = ["arm64"] skip = ["pp*"] repair-wheel-command = """ - export LD_LIBRARY_PATH=/project/braintaichi:$LD_LIBRARY_PATH && + export DYLD_LIBRARY_PATH=/Users/runner/work/braintaichi/braintaichi/project/braintaichi:$DYLD_LIBRARY_PATH && delocate-wheel -w {dest_dir} -v {wheel} """ diff --git a/ci/mac/arm64/pyproject3.12.toml b/ci/mac/arm64/pyproject3.12.toml index 1e3bba9..0be0eb3 100644 --- a/ci/mac/arm64/pyproject3.12.toml +++ b/ci/mac/arm64/pyproject3.12.toml @@ -48,8 +48,8 @@ before-build = "sh copy_so_linux.sh" archs = ["x86_64"] skip = ["pp*", "*-musllinux_x86_64"] repair-wheel-command = """ - export LD_LIBRARY_PATH=/project/braintaichi:$LD_LIBRARY_PATH && - auditwheel repair -w {dest_dir} {wheel} + export DYLD_LIBRARY_PATH=/Users/runner/work/braintaichi/braintaichi/project/braintaichi:$DYLD_LIBRARY_PATH && + delocate-wheel -w {dest_dir} -v {wheel} """ [tool.cibuildwheel.macos] diff --git a/ci/mac/arm64/pyproject3.9.toml b/ci/mac/arm64/pyproject3.9.toml index b09c8a0..0b9ed5f 100644 --- a/ci/mac/arm64/pyproject3.9.toml +++ b/ci/mac/arm64/pyproject3.9.toml @@ -57,7 +57,7 @@ before-build = "sh copy_so_macOS.sh" archs = ["arm64"] skip = ["pp*"] repair-wheel-command = """ - export LD_LIBRARY_PATH=/project/braintaichi:$LD_LIBRARY_PATH && + export DYLD_LIBRARY_PATH=/Users/runner/work/braintaichi/braintaichi/project/braintaichi:$DYLD_LIBRARY_PATH && delocate-wheel -w {dest_dir} -v {wheel} """ diff --git a/ci/mac/x86_64/pyproject3.10.toml b/ci/mac/x86_64/pyproject3.10.toml index 627dfc4..422afd9 100644 --- a/ci/mac/x86_64/pyproject3.10.toml +++ b/ci/mac/x86_64/pyproject3.10.toml @@ -57,7 +57,7 @@ before-build = "sh copy_so_macOS.sh" archs = ["x86_64"] skip = ["pp*"] repair-wheel-command = """ - export LD_LIBRARY_PATH=/project/braintaichi:$LD_LIBRARY_PATH && + export DYLD_LIBRARY_PATH=/Users/runner/work/braintaichi/braintaichi/project/braintaichi:$DYLD_LIBRARY_PATH && delocate-wheel -w {dest_dir} -v {wheel} """ diff --git a/ci/mac/x86_64/pyproject3.11.toml b/ci/mac/x86_64/pyproject3.11.toml index 4f4fd35..08fb85c 100644 --- a/ci/mac/x86_64/pyproject3.11.toml +++ b/ci/mac/x86_64/pyproject3.11.toml @@ -48,8 +48,8 @@ before-build = "sh copy_so_linux.sh" archs = ["x86_64"] skip = ["pp*", "*-musllinux_x86_64"] repair-wheel-command = """ - export LD_LIBRARY_PATH=/project/braintaichi:$LD_LIBRARY_PATH && - auditwheel repair -w {dest_dir} {wheel} + export DYLD_LIBRARY_PATH=/Users/runner/work/braintaichi/braintaichi/project/braintaichi:$DYLD_LIBRARY_PATH && + delocate-wheel -w {dest_dir} -v {wheel} """ [tool.cibuildwheel.macos] diff --git a/ci/mac/x86_64/pyproject3.12.toml b/ci/mac/x86_64/pyproject3.12.toml index 2236a19..c5290e2 100644 --- a/ci/mac/x86_64/pyproject3.12.toml +++ b/ci/mac/x86_64/pyproject3.12.toml @@ -57,7 +57,7 @@ before-build = "sh copy_so_macOS.sh" archs = ["x86_64"] skip = ["pp*"] repair-wheel-command = """ - export LD_LIBRARY_PATH=/project/braintaichi:$LD_LIBRARY_PATH && + export DYLD_LIBRARY_PATH=/Users/runner/work/braintaichi/braintaichi/project/braintaichi:$DYLD_LIBRARY_PATH && delocate-wheel -w {dest_dir} -v {wheel} """ diff --git a/ci/mac/x86_64/pyproject3.9.toml b/ci/mac/x86_64/pyproject3.9.toml index cf24642..5bacf9f 100644 --- a/ci/mac/x86_64/pyproject3.9.toml +++ b/ci/mac/x86_64/pyproject3.9.toml @@ -57,7 +57,7 @@ before-build = "sh copy_so_macOS.sh" archs = ["x86_64"] skip = ["pp*"] repair-wheel-command = """ - export LD_LIBRARY_PATH=/project/braintaichi:$LD_LIBRARY_PATH && + export DYLD_LIBRARY_PATH=/Users/runner/work/braintaichi/braintaichi/project/braintaichi:$DYLD_LIBRARY_PATH && delocate-wheel -w {dest_dir} -v {wheel} """ From 25063f80972c78350f58c87354b51abf044b8835 Mon Sep 17 00:00:00 2001 From: He Sichao <1310722434@qq.com> Date: Sun, 25 Aug 2024 23:28:34 +0800 Subject: [PATCH 15/18] Update --- .github/workflows/CI.yml | 34 +++++++++++++++++++++++++++++++++- copy_pyproject_mac_arm64.sh | 18 ++++++++++++++++++ 2 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 copy_pyproject_mac_arm64.sh diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index b118b66..a9e29b4 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -54,13 +54,45 @@ jobs: pytest tests/ - test_macos: + test_macos_arm64: runs-on: macos-latest strategy: fail-fast: false matrix: python-version: [ "3.9", "3.10", "3.11", "3.12"] + steps: + - name: Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.12.1 + with: + access_token: ${{ github.token }} + - uses: actions/checkout@v4 + - name: Print concurrency group + run: echo '${{ github.workflow }}-${{ github.ref }}' + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip cache purge + python -m pip install --upgrade pip setuptools --no-cache-dir + python -m pip install -r requirements-dev.txt --no-cache-dir + pip install cibuildwheel + sh copy_pyproject_mac_arm64.sh + cibuildwheel --platform macos + pip install dist/* + - name: Test with pytest + run: | + pytest tests/ + + test_macos_x86_64: + runs-on: macos-latest-large + strategy: + fail-fast: false + matrix: + python-version: [ "3.9", "3.10", "3.11", "3.12"] + steps: - name: Cancel Previous Runs uses: styfle/cancel-workflow-action@0.12.1 diff --git a/copy_pyproject_mac_arm64.sh b/copy_pyproject_mac_arm64.sh new file mode 100644 index 0000000..689502f --- /dev/null +++ b/copy_pyproject_mac_arm64.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +# Get the current Python version +python_version=$(python -c "import sys; print('.'.join(map(str, sys.version_info[:2])))") + +# Set the CIBW_BUILD environment variable based on the Python version +if [[ $python_version == "3.9" ]]; then + cp ci/mac/arm64/pyproject3.9.toml pyproject.toml +elif [[ $python_version == "3.10" ]]; then + cp ci/mac/arm64/pyproject3.10.toml pyproject.toml +elif [[ $python_version == "3.11" ]]; then + cp ci/mac/arm64/pyproject3.11.toml pyproject.toml +elif [[ $python_version == "3.12" ]]; then + cp ci/mac/arm64/pyproject3.12.toml pyproject.toml +else + echo "Unsupported Python version: $python_version" + exit 1 +fi \ No newline at end of file From e50a4d246a7ed635198f10ca12398bbacd573d0d Mon Sep 17 00:00:00 2001 From: He Sichao <1310722434@qq.com> Date: Sun, 25 Aug 2024 23:32:22 +0800 Subject: [PATCH 16/18] update --- .github/workflows/CI.yml | 34 +------------------------------- ci/mac/arm64/pyproject3.10.toml | 2 +- ci/mac/arm64/pyproject3.11.toml | 2 +- ci/mac/arm64/pyproject3.12.toml | 8 ++++---- ci/mac/arm64/pyproject3.9.toml | 2 +- ci/mac/x86_64/pyproject3.11.toml | 6 +++--- 6 files changed, 11 insertions(+), 43 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index a9e29b4..95200a9 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -54,7 +54,7 @@ jobs: pytest tests/ - test_macos_arm64: + test_macos: runs-on: macos-latest strategy: fail-fast: false @@ -86,38 +86,6 @@ jobs: run: | pytest tests/ - test_macos_x86_64: - runs-on: macos-latest-large - strategy: - fail-fast: false - matrix: - python-version: [ "3.9", "3.10", "3.11", "3.12"] - - steps: - - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.12.1 - with: - access_token: ${{ github.token }} - - uses: actions/checkout@v4 - - name: Print concurrency group - run: echo '${{ github.workflow }}-${{ github.ref }}' - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip cache purge - python -m pip install --upgrade pip setuptools --no-cache-dir - python -m pip install -r requirements-dev.txt --no-cache-dir - pip install cibuildwheel - sh copy_pyproject_mac_x86_64.sh - cibuildwheel --platform macos - pip install dist/* - - name: Test with pytest - run: | - pytest tests/ - test_windows: runs-on: windows-latest diff --git a/ci/mac/arm64/pyproject3.10.toml b/ci/mac/arm64/pyproject3.10.toml index b152daf..03f51ab 100644 --- a/ci/mac/arm64/pyproject3.10.toml +++ b/ci/mac/arm64/pyproject3.10.toml @@ -37,7 +37,7 @@ requires = [ build-backend = "setuptools.build_meta" [project] -requires-python = ">=3.10, <=3.10" +requires-python = ">=3.10, <3.11" name = "braintaichi" version = "0.0.1" diff --git a/ci/mac/arm64/pyproject3.11.toml b/ci/mac/arm64/pyproject3.11.toml index d4273da..ec4297d 100644 --- a/ci/mac/arm64/pyproject3.11.toml +++ b/ci/mac/arm64/pyproject3.11.toml @@ -37,7 +37,7 @@ requires = [ build-backend = "setuptools.build_meta" [project] -requires-python = ">=3.11, <=3.11" +requires-python = ">=3.11, <3.12" name = "braintaichi" version = "0.0.1" diff --git a/ci/mac/arm64/pyproject3.12.toml b/ci/mac/arm64/pyproject3.12.toml index 0be0eb3..3479c44 100644 --- a/ci/mac/arm64/pyproject3.12.toml +++ b/ci/mac/arm64/pyproject3.12.toml @@ -37,7 +37,7 @@ requires = [ build-backend = "setuptools.build_meta" [project] -requires-python = ">=3.12, <=3.12" +requires-python = ">=3.12, <3.13" name = "braintaichi" version = "0.0.1" @@ -48,8 +48,8 @@ before-build = "sh copy_so_linux.sh" archs = ["x86_64"] skip = ["pp*", "*-musllinux_x86_64"] repair-wheel-command = """ - export DYLD_LIBRARY_PATH=/Users/runner/work/braintaichi/braintaichi/project/braintaichi:$DYLD_LIBRARY_PATH && - delocate-wheel -w {dest_dir} -v {wheel} + export LD_LIBRARY_PATH=/project/braintaichi:$LD_LIBRARY_PATH && + auditwheel repair -w {dest_dir} {wheel} """ [tool.cibuildwheel.macos] @@ -57,7 +57,7 @@ before-build = "sh copy_so_macOS.sh" archs = ["arm64"] skip = ["pp*"] repair-wheel-command = """ - export LD_LIBRARY_PATH=/project/braintaichi:$LD_LIBRARY_PATH && + export DYLD_LIBRARY_PATH=/Users/runner/work/braintaichi/braintaichi/project/braintaichi:$DYLD_LIBRARY_PATH && delocate-wheel -w {dest_dir} -v {wheel} """ diff --git a/ci/mac/arm64/pyproject3.9.toml b/ci/mac/arm64/pyproject3.9.toml index 0b9ed5f..484bf27 100644 --- a/ci/mac/arm64/pyproject3.9.toml +++ b/ci/mac/arm64/pyproject3.9.toml @@ -37,7 +37,7 @@ requires = [ build-backend = "setuptools.build_meta" [project] -requires-python = ">=3.9, <=3.9" +requires-python = ">=3.9, <3.10" name = "braintaichi" version = "0.0.1" diff --git a/ci/mac/x86_64/pyproject3.11.toml b/ci/mac/x86_64/pyproject3.11.toml index 08fb85c..fc8d649 100644 --- a/ci/mac/x86_64/pyproject3.11.toml +++ b/ci/mac/x86_64/pyproject3.11.toml @@ -48,8 +48,8 @@ before-build = "sh copy_so_linux.sh" archs = ["x86_64"] skip = ["pp*", "*-musllinux_x86_64"] repair-wheel-command = """ - export DYLD_LIBRARY_PATH=/Users/runner/work/braintaichi/braintaichi/project/braintaichi:$DYLD_LIBRARY_PATH && - delocate-wheel -w {dest_dir} -v {wheel} + export LD_LIBRARY_PATH=/project/braintaichi:$LD_LIBRARY_PATH && + auditwheel repair -w {dest_dir} {wheel} """ [tool.cibuildwheel.macos] @@ -57,7 +57,7 @@ before-build = "sh copy_so_macOS.sh" archs = ["x86_64"] skip = ["pp*"] repair-wheel-command = """ - export LD_LIBRARY_PATH=/project/braintaichi:$LD_LIBRARY_PATH && + export DYLD_LIBRARY_PATH=/Users/runner/work/braintaichi/braintaichi/project/braintaichi:$DYLD_LIBRARY_PATH && delocate-wheel -w {dest_dir} -v {wheel} """ From b1691b47aff178c8689a9f5337119fa5f643150a Mon Sep 17 00:00:00 2001 From: He Sichao <1310722434@qq.com> Date: Sun, 25 Aug 2024 23:34:51 +0800 Subject: [PATCH 17/18] Update CI.yml --- .github/workflows/CI.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 95200a9..b831c17 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -81,6 +81,7 @@ jobs: pip install cibuildwheel sh copy_pyproject_mac_arm64.sh cibuildwheel --platform macos + dir pip install dist/* - name: Test with pytest run: | From 1daf3d499089642147679fa73d81f8e13abb10c3 Mon Sep 17 00:00:00 2001 From: He Sichao <1310722434@qq.com> Date: Sun, 25 Aug 2024 23:36:37 +0800 Subject: [PATCH 18/18] Update CI.yml --- .github/workflows/CI.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index b831c17..306867f 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -81,8 +81,7 @@ jobs: pip install cibuildwheel sh copy_pyproject_mac_arm64.sh cibuildwheel --platform macos - dir - pip install dist/* + pip install wheelhouse/* - name: Test with pytest run: | pytest tests/