diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 4644bb3..02965b4 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -15,8 +15,8 @@ jobs: python-version: "3.12" - name: ruff run: | - pip install ruff - ruff . + pip install ruff==0.9.6 + ruff check . build_wheels: name: Build wheel on ${{matrix.platform}} @@ -24,11 +24,12 @@ 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 + - uses: actions/checkout@v4 - name: Build wheels - uses: pypa/cibuildwheel@v2.16.5 - - uses: actions/upload-artifact@v3 + uses: pypa/cibuildwheel@v2.22.0 + - uses: actions/upload-artifact@v4 with: path: ./wheelhouse/*.whl + name: wheels-${{ matrix.platform }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d9093c9..d3def1a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,28 +11,33 @@ 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 + - uses: actions/checkout@v4 - name: Build wheels - uses: pypa/cibuildwheel@v2.16.5 - - uses: actions/upload-artifact@v3 + uses: pypa/cibuildwheel@v2.22.0 + - uses: actions/upload-artifact@v4 with: path: ./wheelhouse/*.whl + name: wheels-${{ matrix.platform }} upload_pypi: 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@v4 + with: + path: dist + pattern: wheels-* + merge-multiple: true + - uses: pypa/gh-action-pypi-publish@v1.8.10 create_release: name: Create GitHub Release @@ -40,7 +45,7 @@ jobs: needs: [build_wheels] steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 2 - name: Tag Version @@ -50,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/*" diff --git a/build_dependencies/install_macos.sh b/build_dependencies/install_macos.sh index 3c6f5bb..0c579bb 100644 --- a/build_dependencies/install_macos.sh +++ b/build_dependencies/install_macos.sh @@ -1,20 +1,46 @@ -# 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 +pip install cmake + +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 + +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 +sudo cmake --install build + +# Build and install libccd +cd libccd +cmake . -D ENABLE_DOUBLE_PRECISION=ON +make -j4 +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 +sudo make install +cd .. + +# Build and install fcl +cd fcl +cmake . +make -j4 +sudo make install +cd .. + +cd .. 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/pyproject.toml b/pyproject.toml index 603b0e4..dae65b4 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"}, @@ -107,9 +107,8 @@ 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] before-all = "powershell build_dependencies\\install_windows.ps1" archs = ["AMD64"] - 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) 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