diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index a111c45..8fe1198 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -12,13 +12,11 @@ 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}} @@ -26,13 +24,11 @@ jobs: 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 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f3d2bfe..5f0b6f9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 diff --git a/examples/example.py b/examples/example.py index dcc51fd..b7e7622 100644 --- a/examples/example.py +++ b/examples/example.py @@ -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]) @@ -166,12 +165,12 @@ 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("") # ===================================================================== @@ -179,12 +178,12 @@ def print_distance_result(o1_name, o2_name, result): # ===================================================================== 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("") # ===================================================================== @@ -194,10 +193,10 @@ 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("") # ===================================================================== @@ -205,8 +204,8 @@ def print_distance_result(o1_name, o2_name, result): # ===================================================================== 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("") diff --git a/pyproject.toml b/pyproject.toml index 6e6a223..603b0e4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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" @@ -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"] \ No newline at end of file +archs = ["AMD64"] + diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 1283084..0000000 --- a/setup.cfg +++ /dev/null @@ -1,58 +0,0 @@ -[metadata] -name = python-fcl -version = attr: fcl.__version__ -description = Python bindings for the Flexible Collision Library -long_description = file: README.md -long_description_content_type = text/markdown -url = https://github.com/CyrilWaechter/python-fcl -author = Jelle Feringa, Matthew Matl, Shirokuma, Michael Dawson-Haggerty, See contributor list -author_email = jelleferinga@gmail.com, mmatl@eecs.berkeley.edu, rootstock_acg@yahoo.co.jp -maintainer = Matthew Matl -maintainer_email = mmatl@eecs.berkeley.edu -license = BSD -license_files = LICENSE -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.6 - Programming Language :: Python :: 3.7 - Programming Language :: Python :: 3.8 - Programming Language :: Python :: 3.9 - Programming Language :: Python :: Implementation :: CPython -keywords = fcl collision distance - -[options] -include_package_data = True -package_dir = - = src -packages = find: -setup_requires = - numpy - Cython -install_requires = - numpy; python_version<'3.12' - numpy>=1.26.0b1; python_version>='3.12' - Cython - -[options.package_data] -* = *.pyx, *.pxd, *.dll - -[options.packages.find] -where = src - -[flake8] -max_line_length = 90 -ignore = W503,W504,E203,E266,E501,E731,C901,B903,B009,B010 -max-complexity = 18 -select = B,C,E,F,W,T4,B9 -exclude = - .git - __pycache__ - build - dist - tests - .eggs \ No newline at end of file diff --git a/src/fcl/version.py b/src/fcl/version.py index c5f016e..a75158e 100644 --- a/src/fcl/version.py +++ b/src/fcl/version.py @@ -1 +1 @@ -__version__ = "0.7.0.5" +__version__ = "0.7.0.6" diff --git a/tests/test_fcl.py b/tests/test_fcl.py index 11e5932..c1a52cd 100644 --- a/tests/test_fcl.py +++ b/tests/test_fcl.py @@ -1,8 +1,7 @@ import unittest -import numpy as np - import fcl +import numpy as np class TestFCL(unittest.TestCase): @@ -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 ) diff --git a/tests/test_precision.py b/tests/test_precision.py index a695cb2..efe181d 100644 --- a/tests/test_precision.py +++ b/tests/test_precision.py @@ -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