From 464e69fa50e0fd31b4d73bd6edf4db5bcab1fba8 Mon Sep 17 00:00:00 2001 From: Michael Dawson-Haggerty Date: Wed, 22 Jan 2025 19:24:39 -0500 Subject: [PATCH 01/15] use a trusted publisher --- .github/workflows/push.yml | 2 +- .github/workflows/release.yml | 22 +++++++++++++--------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 4644bb3..581e81d 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -28,7 +28,7 @@ jobs: steps: - uses: actions/checkout@v3 - name: Build wheels - uses: pypa/cibuildwheel@v2.16.5 + uses: pypa/cibuildwheel@v2.22.0 - uses: actions/upload-artifact@v3 with: path: ./wheelhouse/*.whl diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d9093c9..bcd31f3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,7 +15,7 @@ jobs: steps: - uses: actions/checkout@v3 - name: Build wheels - uses: pypa/cibuildwheel@v2.16.5 + uses: pypa/cibuildwheel@v2.22.0 - uses: actions/upload-artifact@v3 with: path: ./wheelhouse/*.whl @@ -24,15 +24,19 @@ jobs: name: Release To PyPi needs: [build_wheels] runs-on: ubuntu-latest + permissions: + id-token: write steps: - - uses: actions/download-artifact@v3 - with: - name: artifact - path: dist - - uses: pypa/gh-action-pypi-publish@v1.6.4 - with: - user: __token__ - password: ${{ secrets.PYPI_API_TOKEN }} + - uses: actions/setup-python@v4 + with: + python-version: "3.12" + + - uses: actions/download-artifact@v3 + with: + name: artifact + path: dist + + - uses: pypa/gh-action-pypi-publish@v1.8.10 create_release: name: Create GitHub Release From d00b6bb2214634fcb7e033e68d98c959a9750f9c Mon Sep 17 00:00:00 2001 From: Michael Dawson-Haggerty Date: Wed, 22 Jan 2025 19:31:02 -0500 Subject: [PATCH 02/15] add mac os target --- pyproject.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 603b0e4..df503be 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -108,8 +108,9 @@ archs = ["x86_64"] [tool.cibuildwheel.macos] before-all = "bash build_dependencies/install_macos.sh" environment = { CPATH = "$(brew --prefix)/include:$(brew --prefix)/include/eigen3", LD_LIBRARY_PATH = "$(brew --prefix)/lib" } +repair-wheel-command = "MACOSX_DEPLOYMENT_TARGET=14 delocate-wheel -w {dest_dir} -v {wheel}" + [tool.cibuildwheel.windows] before-all = "powershell build_dependencies\\install_windows.ps1" archs = ["AMD64"] - From 8581087cc6dc02c194d00594d63827947db71fe2 Mon Sep 17 00:00:00 2001 From: Michael Dawson-Haggerty Date: Wed, 22 Jan 2025 19:52:39 -0500 Subject: [PATCH 03/15] update for Cython3 and drop cp37+cp38 to enable cp313 --- .github/workflows/release.yml | 2 +- pyproject.toml | 7 +++---- src/fcl/fcl.pyx | 4 ++-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bcd31f3..0f61788 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,7 +11,7 @@ jobs: runs-on: ${{matrix.platform}} strategy: matrix: - platform: [ubuntu-latest, macos-latest, windows-latest, macos-14] + platform: [ubuntu-latest, macos-latest, windows-latest, macos-13] steps: - uses: actions/checkout@v3 - name: Build wheels diff --git a/pyproject.toml b/pyproject.toml index df503be..1bd4299 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,7 +2,7 @@ requires = [ "setuptools", "wheel", - "Cython<3.0", + "Cython>=3.0", "numpy; python_version<'3.12'", "numpy>=1.26.0b1; python_version>='3.12'"] build-backend = "setuptools.build_meta" @@ -10,7 +10,7 @@ build-backend = "setuptools.build_meta" [project] name = "python-fcl" description = "Python bindings for the Flexible Collision Library" -requires-python = ">=3.7" +requires-python = ">=3.9" authors = [ {name = "Jelle Feringa", email = "jelleferinga@gmail.com"}, {name = "Matthew Matl", email = "mmatl@eecs.berkeley.edu"}, @@ -108,8 +108,7 @@ archs = ["x86_64"] [tool.cibuildwheel.macos] before-all = "bash build_dependencies/install_macos.sh" environment = { CPATH = "$(brew --prefix)/include:$(brew --prefix)/include/eigen3", LD_LIBRARY_PATH = "$(brew --prefix)/lib" } -repair-wheel-command = "MACOSX_DEPLOYMENT_TARGET=14 delocate-wheel -w {dest_dir} -v {wheel}" - +repair-wheel-command = "MACOSX_DEPLOYMENT_TARGET=13 delocate-wheel -w {dest_dir} -v {wheel}" [tool.cibuildwheel.windows] before-all = "powershell build_dependencies\\install_windows.ps1" diff --git a/src/fcl/fcl.pyx b/src/fcl/fcl.pyx index 7738bad..169bbb2 100644 --- a/src/fcl/fcl.pyx +++ b/src/fcl/fcl.pyx @@ -761,10 +761,10 @@ cdef class DistanceFunction: (&dist)[0] = py_r[1] return py_r[0] -cdef inline bool CollisionCallBack(defs.CollisionObjectd*o1, defs.CollisionObjectd*o2, void*cdata): +cdef inline bool CollisionCallBack(defs.CollisionObjectd*o1, defs.CollisionObjectd*o2, void*cdata) noexcept: return ( cdata).eval_func(o1, o2) -cdef inline bool DistanceCallBack(defs.CollisionObjectd*o1, defs.CollisionObjectd*o2, void*cdata, double& dist): +cdef inline bool DistanceCallBack(defs.CollisionObjectd*o1, defs.CollisionObjectd*o2, void*cdata, double& dist) noexcept: return ( cdata).eval_func(o1, o2, dist) From d00ac197d312c7f032ec1f68db1a2c9ef326ce4c Mon Sep 17 00:00:00 2001 From: Michael Dawson-Haggerty Date: Wed, 22 Jan 2025 19:55:24 -0500 Subject: [PATCH 04/15] remove target --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 1bd4299..16975ea 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -108,7 +108,7 @@ archs = ["x86_64"] [tool.cibuildwheel.macos] before-all = "bash build_dependencies/install_macos.sh" environment = { CPATH = "$(brew --prefix)/include:$(brew --prefix)/include/eigen3", LD_LIBRARY_PATH = "$(brew --prefix)/lib" } -repair-wheel-command = "MACOSX_DEPLOYMENT_TARGET=13 delocate-wheel -w {dest_dir} -v {wheel}" +repair-wheel-command = "delocate-wheel -w {dest_dir} -v {wheel}" [tool.cibuildwheel.windows] before-all = "powershell build_dependencies\\install_windows.ps1" From 5e875ef343d06de421c5318ed84d317f985e45cd Mon Sep 17 00:00:00 2001 From: Michael Dawson-Haggerty Date: Wed, 22 Jan 2025 20:01:17 -0500 Subject: [PATCH 05/15] try building on mac rather than brewing --- build_dependencies/install_macos.sh | 64 ++++++++++++++++++++--------- 1 file changed, 44 insertions(+), 20 deletions(-) diff --git a/build_dependencies/install_macos.sh b/build_dependencies/install_macos.sh index 3c6f5bb..202c386 100644 --- a/build_dependencies/install_macos.sh +++ b/build_dependencies/install_macos.sh @@ -1,20 +1,44 @@ -# prevent brew from auto cleanup -export HOMEBREW_NO_INSTALL_CLEANUP=1 - -brew install fcl - -# mkdir -p deps -# cd deps -# # Octomap -# git clone https://github.com/OctoMap/octomap -# cd octomap -# git checkout tags/v1.8.0 -# mkdir build -# cd build -# cmake .. -# make -# sudo make install - -# cd .. -# cd .. -# cd .. +# exit immediately on any failed step +set -xe + +mkdir -p deps +cd deps + +curl -OL https://gitlab.com/libeigen/eigen/-/archive/3.3.9/eigen-3.3.9.tar.gz +tar -zxf eigen-3.3.9.tar.gz + +rm -rf libccd +git clone --depth 1 --branch v2.1 https://github.com/danfis/libccd.git + +rm -rf octomap +git clone --depth 1 --branch v1.9.8 https://github.com/OctoMap/octomap.git + +rm -rf fcl +git clone --depth 1 --branch v0.7.0 https://github.com/ambi-robotics/fcl.git + +# Install eigen +cmake -B build -S eigen-3.3.9 +cmake --install build + +# Build and install libccd +cd libccd +cmake . -D ENABLE_DOUBLE_PRECISION=ON +make -j4 +make install +cd .. + +# Build and install octomap +cd octomap +cmake . -D CMAKE_BUILD_TYPE=Release -D BUILD_OCTOVIS_SUBPROJECT=OFF -D BUILD_DYNAMICETD3D_SUBPROJECT=OFF +make -j4 +make install +cd .. + +# Build and install fcl +cd fcl +cmake . +make -j4 +make install +cd .. + +cd .. From 070d4d16d54353176674f444f2a35db57a18b47d Mon Sep 17 00:00:00 2001 From: Michael Dawson-Haggerty Date: Wed, 22 Jan 2025 20:11:12 -0500 Subject: [PATCH 06/15] install cmake on mac --- build_dependencies/install_macos.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/build_dependencies/install_macos.sh b/build_dependencies/install_macos.sh index 202c386..11b89e8 100644 --- a/build_dependencies/install_macos.sh +++ b/build_dependencies/install_macos.sh @@ -1,5 +1,6 @@ # exit immediately on any failed step set -xe +pip install cmake mkdir -p deps cd deps From e8f99df070b9dc55ee33e6b595c7ef531821c35e Mon Sep 17 00:00:00 2001 From: Michael Dawson-Haggerty Date: Wed, 22 Jan 2025 20:17:08 -0500 Subject: [PATCH 07/15] get eigen from brew --- build_dependencies/install_macos.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/build_dependencies/install_macos.sh b/build_dependencies/install_macos.sh index 11b89e8..7c97950 100644 --- a/build_dependencies/install_macos.sh +++ b/build_dependencies/install_macos.sh @@ -1,13 +1,11 @@ # exit immediately on any failed step set -xe pip install cmake +brew install eigen3 mkdir -p deps cd deps -curl -OL https://gitlab.com/libeigen/eigen/-/archive/3.3.9/eigen-3.3.9.tar.gz -tar -zxf eigen-3.3.9.tar.gz - rm -rf libccd git clone --depth 1 --branch v2.1 https://github.com/danfis/libccd.git From 55903368f14d843cb6b29ac3ceabef54dac28051 Mon Sep 17 00:00:00 2001 From: Michael Dawson-Haggerty Date: Wed, 22 Jan 2025 20:19:27 -0500 Subject: [PATCH 08/15] brew --- build_dependencies/install_macos.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_dependencies/install_macos.sh b/build_dependencies/install_macos.sh index 7c97950..2970726 100644 --- a/build_dependencies/install_macos.sh +++ b/build_dependencies/install_macos.sh @@ -1,7 +1,7 @@ # exit immediately on any failed step set -xe pip install cmake -brew install eigen3 +brew install eigen mkdir -p deps cd deps From 11dcdb91b02e52fd890fa922c9e18e2e37444b9c Mon Sep 17 00:00:00 2001 From: Michael Dawson-Haggerty Date: Wed, 22 Jan 2025 20:42:22 -0500 Subject: [PATCH 09/15] mac build paths --- build_dependencies/install_macos.sh | 7 +++++-- pyproject.toml | 1 - 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/build_dependencies/install_macos.sh b/build_dependencies/install_macos.sh index 2970726..b79baca 100644 --- a/build_dependencies/install_macos.sh +++ b/build_dependencies/install_macos.sh @@ -1,11 +1,14 @@ # exit immediately on any failed step set -xe pip install cmake -brew install eigen mkdir -p deps cd deps +curl -OL https://gitlab.com/libeigen/eigen/-/archive/3.3.9/eigen-3.3.9.tar.gz +tar -zxf eigen-3.3.9.tar.gz +mv eigen-3.3.9 eigen + rm -rf libccd git clone --depth 1 --branch v2.1 https://github.com/danfis/libccd.git @@ -16,7 +19,7 @@ rm -rf fcl git clone --depth 1 --branch v0.7.0 https://github.com/ambi-robotics/fcl.git # Install eigen -cmake -B build -S eigen-3.3.9 +cmake -B build -S eigen cmake --install build # Build and install libccd diff --git a/pyproject.toml b/pyproject.toml index 16975ea..dae65b4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -107,7 +107,6 @@ archs = ["x86_64"] [tool.cibuildwheel.macos] before-all = "bash build_dependencies/install_macos.sh" -environment = { CPATH = "$(brew --prefix)/include:$(brew --prefix)/include/eigen3", LD_LIBRARY_PATH = "$(brew --prefix)/lib" } repair-wheel-command = "delocate-wheel -w {dest_dir} -v {wheel}" [tool.cibuildwheel.windows] From 2f9ddde172d172ea9bda9ee892d44c4ee839d262 Mon Sep 17 00:00:00 2001 From: Michael Dawson-Haggerty Date: Wed, 22 Jan 2025 20:54:33 -0500 Subject: [PATCH 10/15] gh install with sudo --- build_dependencies/install_macos.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build_dependencies/install_macos.sh b/build_dependencies/install_macos.sh index b79baca..0c579bb 100644 --- a/build_dependencies/install_macos.sh +++ b/build_dependencies/install_macos.sh @@ -20,27 +20,27 @@ git clone --depth 1 --branch v0.7.0 https://github.com/ambi-robotics/fcl.git # Install eigen cmake -B build -S eigen -cmake --install build +sudo cmake --install build # Build and install libccd cd libccd cmake . -D ENABLE_DOUBLE_PRECISION=ON make -j4 -make install +sudo make install cd .. # Build and install octomap cd octomap cmake . -D CMAKE_BUILD_TYPE=Release -D BUILD_OCTOVIS_SUBPROJECT=OFF -D BUILD_DYNAMICETD3D_SUBPROJECT=OFF make -j4 -make install +sudo make install cd .. # Build and install fcl cd fcl cmake . make -j4 -make install +sudo make install cd .. cd .. From 68b531fe65fd4f05046ffec3f96f06aa1eacbba0 Mon Sep 17 00:00:00 2001 From: Michael Dawson-Haggerty Date: Mon, 10 Feb 2025 12:56:57 -0500 Subject: [PATCH 11/15] update CI push --- .github/workflows/push.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 581e81d..811dd8a 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -16,7 +16,7 @@ jobs: - name: ruff run: | pip install ruff - ruff . + ruff check . build_wheels: name: Build wheel on ${{matrix.platform}} @@ -24,7 +24,7 @@ jobs: strategy: fail-fast: false matrix: - platform: [ubuntu-latest, macos-latest, windows-latest, macos-14] + platform: [ubuntu-latest, macos-latest, windows-latest, macos-13] steps: - uses: actions/checkout@v3 - name: Build wheels From d2f65a3c01c7f12bd987e72f847980b78e85f9bb Mon Sep 17 00:00:00 2001 From: Michael Dawson-Haggerty Date: Mon, 10 Feb 2025 13:01:34 -0500 Subject: [PATCH 12/15] version lock ruff and fix --- .github/workflows/push.yml | 2 +- examples/example.py | 3 ++- tests/test_fcl.py | 3 ++- tests/test_precision.py | 3 ++- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 811dd8a..002e14a 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -15,7 +15,7 @@ jobs: python-version: "3.12" - name: ruff run: | - pip install ruff + pip install ruff==0.9.6 ruff check . build_wheels: diff --git a/examples/example.py b/examples/example.py index b7e7622..0b50f0e 100644 --- a/examples/example.py +++ b/examples/example.py @@ -1,6 +1,7 @@ -import fcl import numpy as np +import fcl + def print_collision_result(o1_name, o2_name, result): print(f"Collision between {o1_name} and {o2_name}:") diff --git a/tests/test_fcl.py b/tests/test_fcl.py index c1a52cd..07b9c43 100644 --- a/tests/test_fcl.py +++ b/tests/test_fcl.py @@ -1,8 +1,9 @@ import unittest -import fcl import numpy as np +import fcl + class TestFCL(unittest.TestCase): def setUp(self): diff --git a/tests/test_precision.py b/tests/test_precision.py index efe181d..a695cb2 100644 --- a/tests/test_precision.py +++ b/tests/test_precision.py @@ -1,8 +1,9 @@ import unittest -import fcl import numpy as np +import fcl + # These test cases were added because there was a very sneaky crash that would occur # in the signed distance functions if all libs were not compiled with double precision From ce81b3b38d5f6ac480286ee3b2bd7ec400145b6e Mon Sep 17 00:00:00 2001 From: Michael Dawson-Haggerty Date: Mon, 10 Feb 2025 13:03:47 -0500 Subject: [PATCH 13/15] update actions versions --- .github/workflows/push.yml | 4 ++-- .github/workflows/release.yml | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 002e14a..38ce28f 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -26,9 +26,9 @@ jobs: matrix: platform: [ubuntu-latest, macos-latest, windows-latest, macos-13] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Build wheels uses: pypa/cibuildwheel@v2.22.0 - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: path: ./wheelhouse/*.whl diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0f61788..6b36b61 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,10 +13,10 @@ jobs: matrix: platform: [ubuntu-latest, macos-latest, windows-latest, macos-13] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Build wheels uses: pypa/cibuildwheel@v2.22.0 - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: path: ./wheelhouse/*.whl @@ -31,7 +31,7 @@ jobs: with: python-version: "3.12" - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: artifact path: dist @@ -44,7 +44,7 @@ jobs: needs: [build_wheels] steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 2 - name: Tag Version From 54217f786375fead133e0fb0cff1bebb827835d6 Mon Sep 17 00:00:00 2001 From: Michael Dawson-Haggerty Date: Mon, 10 Feb 2025 14:41:31 -0500 Subject: [PATCH 14/15] update for action API change --- .github/workflows/push.yml | 1 + .github/workflows/release.yml | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 38ce28f..29d9a02 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -32,3 +32,4 @@ jobs: - uses: actions/upload-artifact@v4 with: path: ./wheelhouse/*.whl + name: wheels-${{ matrix.runs-on }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6b36b61..f658047 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,6 +19,7 @@ jobs: - uses: actions/upload-artifact@v4 with: path: ./wheelhouse/*.whl + name: wheels-${{ matrix.runs-on }} upload_pypi: name: Release To PyPi @@ -33,9 +34,9 @@ jobs: - uses: actions/download-artifact@v4 with: - name: artifact path: dist - + pattern: wheels-* + merge-multiple: true - uses: pypa/gh-action-pypi-publish@v1.8.10 create_release: @@ -54,8 +55,9 @@ jobs: echo "tag_name=${VER}" >> $GITHUB_OUTPUT - uses: actions/download-artifact@v3 with: - name: artifact path: dist + pattern: wheels-* + merge-multiple: true - uses: ncipollo/release-action@v1.14.0 with: artifacts: "dist/*" From 4f90b420de9cb7345a39c0b46070070c66b0883d Mon Sep 17 00:00:00 2001 From: Michael Dawson-Haggerty Date: Mon, 10 Feb 2025 18:03:06 -0500 Subject: [PATCH 15/15] CI --- .github/workflows/push.yml | 2 +- .github/workflows/release.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 29d9a02..02965b4 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -32,4 +32,4 @@ jobs: - uses: actions/upload-artifact@v4 with: path: ./wheelhouse/*.whl - name: wheels-${{ matrix.runs-on }} + name: wheels-${{ matrix.platform }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f658047..d3def1a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,7 +19,7 @@ jobs: - uses: actions/upload-artifact@v4 with: path: ./wheelhouse/*.whl - name: wheels-${{ matrix.runs-on }} + name: wheels-${{ matrix.platform }} upload_pypi: name: Release To PyPi