Skip to content

Commit

Permalink
Merge pull request #74 from BerkeleyAutomation/remove/arm
Browse files Browse the repository at this point in the history
Enable MacOS ARM Runner And Wheels
  • Loading branch information
mikedh authored Mar 10, 2024
2 parents c1e2cdb + 4fefe83 commit 9a45423
Show file tree
Hide file tree
Showing 8 changed files with 123 additions and 97 deletions.
18 changes: 7 additions & 11 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,23 @@ jobs:
- name: Set up Python environment
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: flake8
uses: py-actions/flake8@v2
- name: black
uses: psf/black@stable
with:
options: '--check --diff -l 90'
python-version: "3.10"
- name: ruff
run: |
pip install ruff
ruff .
build_wheels:
name: Build wheel on ${{matrix.platform}}
runs-on: ${{matrix.platform}}
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
platform: [ubuntu-latest, macos-latest, windows-latest, macos-14]
steps:
- uses: actions/checkout@v3
- name: Build wheels
uses: pypa/cibuildwheel@v2.15.0
env:
CIBW_ARCHS_MACOS: 'x86_64 arm64'
uses: pypa/cibuildwheel@v2.16.5
- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ jobs:
needs: create_release
strategy:
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
platform: [ubuntu-latest, macos-latest, windows-latest, macos-14]
steps:
- uses: actions/checkout@v3
- name: Build wheels
uses: pypa/cibuildwheel@v2.15.0
uses: pypa/cibuildwheel@v2.16.5
env:
CIBW_ARCHS_MACOS: 'x86_64 arm64'
- uses: actions/upload-artifact@v3
Expand Down
35 changes: 17 additions & 18 deletions examples/example.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
import numpy as np

import fcl
import numpy as np


def print_collision_result(o1_name, o2_name, result):
print("Collision between {} and {}:".format(o1_name, o2_name))
print(f"Collision between {o1_name} and {o2_name}:")
print("-" * 30)
print("Collision?: {}".format(result.is_collision))
print("Number of contacts: {}".format(len(result.contacts)))
print(f"Collision?: {result.is_collision}")
print(f"Number of contacts: {len(result.contacts)}")
print("")


def print_continuous_collision_result(o1_name, o2_name, result):
print("Continuous collision between {} and {}:".format(o1_name, o2_name))
print(f"Continuous collision between {o1_name} and {o2_name}:")
print("-" * 30)
print("Collision?: {}".format(result.is_collide))
print("Time of collision: {}".format(result.time_of_contact))
print(f"Collision?: {result.is_collide}")
print(f"Time of collision: {result.time_of_contact}")
print("")


def print_distance_result(o1_name, o2_name, result):
print("Distance between {} and {}:".format(o1_name, o2_name))
print(f"Distance between {o1_name} and {o2_name}:")
print("-" * 30)
print("Distance: {}".format(result.min_distance))
print(f"Distance: {result.min_distance}")
print("Closest Points:")
print(result.nearest_points[0])
print(result.nearest_points[1])
Expand Down Expand Up @@ -166,25 +165,25 @@ def print_distance_result(o1_name, o2_name, result):
# =====================================================================
cdata = fcl.CollisionData()
manager1.collide(cdata, fcl.defaultCollisionCallback)
print("Collision within manager 1?: {}".format(cdata.result.is_collision))
print(f"Collision within manager 1?: {cdata.result.is_collision}")
print("")

cdata = fcl.CollisionData()
manager2.collide(cdata, fcl.defaultCollisionCallback)
print("Collision within manager 2?: {}".format(cdata.result.is_collision))
print(f"Collision within manager 2?: {cdata.result.is_collision}")
print("")

# =====================================================================
# Managed internal (n^2) distance checking
# =====================================================================
ddata = fcl.DistanceData()
manager1.distance(ddata, fcl.defaultDistanceCallback)
print("Closest distance within manager 1?: {}".format(ddata.result.min_distance))
print(f"Closest distance within manager 1?: {ddata.result.min_distance}")
print("")

ddata = fcl.DistanceData()
manager2.distance(ddata, fcl.defaultDistanceCallback)
print("Closest distance within manager 2?: {}".format(ddata.result.min_distance))
print(f"Closest distance within manager 2?: {ddata.result.min_distance}")
print("")

# =====================================================================
Expand All @@ -194,19 +193,19 @@ def print_distance_result(o1_name, o2_name, result):
rdata = fcl.CollisionData(request=req)

manager1.collide(fcl.CollisionObject(mesh), rdata, fcl.defaultCollisionCallback)
print("Collision between manager 1 and Mesh?: {}".format(rdata.result.is_collision))
print(f"Collision between manager 1 and Mesh?: {rdata.result.is_collision}")
print("Contacts:")
for c in rdata.result.contacts:
print("\tO1: {}, O2: {}".format(c.o1, c.o2))
print(f"\tO1: {c.o1}, O2: {c.o2}")
print("")

# =====================================================================
# Managed many to many collision checking
# =====================================================================
rdata = fcl.CollisionData(request=req)
manager3.collide(manager2, rdata, fcl.defaultCollisionCallback)
print("Collision between manager 2 and manager 3?: {}".format(rdata.result.is_collision))
print(f"Collision between manager 2 and manager 3?: {rdata.result.is_collision}")
print("Contacts:")
for c in rdata.result.contacts:
print("\tO1: {}, O2: {}".format(c.o1, c.o2))
print(f"\tO1: {c.o1}, O2: {c.o2}")
print("")
95 changes: 93 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,99 @@ requires = [
"setuptools",
"wheel",
"Cython<3.0",
"oldest-supported-numpy; python_version<'3.12'",
"numpy; python_version<'3.12'",
"numpy>=1.26.0b1; python_version>='3.12'"]
build-backend = "setuptools.build_meta"

[project]
name = "python-fcl"
description = "Python bindings for the Flexible Collision Library"
requires-python = ">=3.7"
authors = [
{name = "Jelle Feringa", email = "jelleferinga@gmail.com"},
{name = "Matthew Matl", email = "mmatl@eecs.berkeley.edu"},
{name = "Shirokuma", email = "rootstock_acg@yahoo.co.jp"},
{name = "Michael Dawson-Haggerty"},
{name = "See contributor list"},
]
maintainers = [{name = "Matthew Matl", email = "mmatl@eecs.berkeley.edu"}]
license = {text = "BSD"}
classifiers = [
"Development Status :: 3 - Alpha",
"License :: OSI Approved :: BSD License",
"Operating System :: POSIX :: Linux",
"Operating System :: MacOS",
"Operating System :: Microsoft :: Windows",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
]
keywords = ["fcl collision distance"]
dependencies = [
"numpy; python_version<'3.12'",
"numpy>=1.26.0b1; python_version>='3.12'",
"Cython",
]
dynamic = ["version"]

[project.readme]
file = "README.md"
content-type = "text/markdown"

[project.urls]
Homepage = "https://github.com/berkeleyautomation/python-fcl"




[tool.setuptools]
include-package-data = true
package-dir = {"" = "src"}
license-files = ["LICENSE"]

[tool.setuptools.package-data]
"*" = ["*.pyx", "*.pxd", "*.dll"]

[tool.setuptools.packages.find]
where = ["src"]
namespaces = false

[tool.setuptools.dynamic]
version = {attr = "fcl.__version__"}

[tool.ruff]
target-version = "py37"
line-length = 90

[tool.ruff.lint]
# See https://github.com/charliermarsh/ruff#rules for error code definitions.
select = [
"B", # bugbear
"C", # comprehensions
"E", # style errors
"F", # flakes
"I", # import sorting
"RUF100", # meta
"U", # upgrade
"W", # style warnings
"YTT", # sys.version
]

ignore = [
"C901", # Comprehension is too complex (11 > 10)
"N802", # Function name should be lowercase
"N806", # Variable in function should be lowercase
"E501", # Line too long ({width} > {limit} characters)
"B904", # raise ... from err
"B905", # zip() without an explicit strict= parameter
]


[tool.cibuildwheel]
skip = ["pp*", "*musllinux*"]
test-requires = "pytest"
Expand All @@ -18,7 +107,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" }

[tool.cibuildwheel.windows]
before-all = "powershell build_dependencies\\install_windows.ps1"
archs = ["AMD64"]
archs = ["AMD64"]

58 changes: 0 additions & 58 deletions setup.cfg

This file was deleted.

2 changes: 1 addition & 1 deletion src/fcl/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.7.0.5"
__version__ = "0.7.0.6"
5 changes: 2 additions & 3 deletions tests/test_fcl.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import unittest

import numpy as np

import fcl
import numpy as np


class TestFCL(unittest.TestCase):
Expand Down Expand Up @@ -206,7 +205,7 @@ def test_pairwise_continuous_collisions(self):
self.geometry["cone"], fcl.Transform(np.array([0.0, 0.0, -2.0]))
)

ret = fcl.continuousCollide(
_ret = fcl.continuousCollide(
box, fcl.Transform(), cone, fcl.Transform(), request, result
)

Expand Down
3 changes: 1 addition & 2 deletions tests/test_precision.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import unittest

import numpy as np

import fcl
import numpy as np


# These test cases were added because there was a very sneaky crash that would occur
Expand Down

0 comments on commit 9a45423

Please sign in to comment.