Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
127 changes: 0 additions & 127 deletions .github/workflows/build-nanobind.yml

This file was deleted.

79 changes: 43 additions & 36 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build Cython (Stable)
name: Build and Publish

on:
push:
Expand All @@ -8,76 +8,83 @@ on:
branches: [ main ]

jobs:
build_wheels_cython:
name: Build Cython wheels on ${{ matrix.os }}
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
timeout-minutes: 15
timeout-minutes: 30
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- name: Use Cython pyproject.toml
run: |
cp pyproject.cython.toml pyproject.toml
shell: bash
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Build Cython wheels
- name: Build wheels
uses: pypa/cibuildwheel@v2.21.0
env:
CIBW_BUILD: cp39-* cp310-* cp311-* cp312-*
# Skip 32-bit, PyPy, and musl builds
CIBW_SKIP: "*-win32 *-manylinux_i686 *-musllinux_* pp*"
# Use modern manylinux_2_28 (default in v3.1+)
# Use modern manylinux_2_28
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
CIBW_MANYLINUX_AARCH64_IMAGE: manylinux_2_28
# Install build dependencies
CIBW_BEFORE_BUILD: pip install numpy cython
# Install compiler (fixed command)
CIBW_BEFORE_ALL_LINUX: yum install -y gcc-c++
# Windows-specific: Disable wheel repair for now
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: ""
# Simple test command
CIBW_TEST_COMMAND: python -c "import fastbbox; print('Import successful')"
CIBW_BEFORE_BUILD: pip install nanobind scikit-build-core cmake ninja numpy
# Linux: Install C++ compiler and CMake
CIBW_BEFORE_ALL_LINUX: |
if command -v dnf >/dev/null; then
dnf install -y gcc-c++ cmake ninja-build
else
yum install -y gcc-c++ cmake ninja-build
fi
# Windows: Use delvewheel for repair
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: pip install delvewheel && delvewheel repair -w {dest_dir} {wheel}
# Smoke test
CIBW_TEST_COMMAND: >-
python -c "from fastbbox import bbox_overlaps; import numpy as np;
boxes = np.array([[0,0,10,10]], dtype=np.float32);
result = bbox_overlaps(boxes, boxes);
assert result[0,0] > 0.99, 'IoU test failed';
print('fastbbox import OK')"
# nanobind requires macos 10.13 or higher
CIBW_ENVIRONMENT_MACOS: MACOSX_DEPLOYMENT_TARGET=10.13

- uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@v6
with:
name: wheels-${{ matrix.os }}
path: ./wheelhouse/*.whl

build_sdist_cython:
name: Build Cython source distribution
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- name: Use Cython pyproject.toml
run: cp pyproject.cython.toml pyproject.toml

- name: Build Cython sdist
- name: Build sdist
run: pipx run build --sdist

- uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@v6
with:
name: sdist
path: dist/*.tar.gz

upload_testpypi_cython:
needs: [build_wheels_cython, build_sdist_cython]
upload_testpypi:
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
timeout-minutes: 15
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
environment:
name: testpypi
url: https://test.pypi.org/p/fastbbox
permissions:
id-token: write
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
uses: actions/download-artifact@v8
with:
path: dist
merge-multiple: true
Expand All @@ -90,8 +97,8 @@ jobs:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }}

upload_pypi_cython:
needs: [build_wheels_cython, build_sdist_cython]
upload_pypi:
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
timeout-minutes: 15
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
Expand All @@ -102,10 +109,10 @@ jobs:
id-token: write
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
uses: actions/download-artifact@v8
with:
path: dist
merge-multiple: true

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
uses: pypa/gh-action-pypi-publish@release/v1
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,12 @@ dmypy.json
# Pyre type checker
.pyre/

# Cython/nanobind generated files (exclude auto-generated C/C++)
# Exclude auto-generated C/C++ files
*.c
*.cpp
*.html
# Except nanobind C++ sources which are intentional committed sources
!fastbbox/*_nb.cpp
# Track nanobind C++ sources (intentional committed sources, not generated)
!src/fastbbox/*_nb.cpp

# IDE files
.vscode/
Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ find_package(nanobind CONFIG REQUIRED)
# Build bbox module
# Use NOMINSIZE since our binding layer contains significant computational logic
# that benefits from speed optimization rather than size optimization
nanobind_add_module(bbox NOMINSIZE ${CMAKE_CURRENT_SOURCE_DIR}/fastbbox/bbox_nb.cpp)
nanobind_add_module(bbox NOMINSIZE ${CMAKE_CURRENT_SOURCE_DIR}/src/fastbbox/bbox_nb.cpp)

# Build obb_bbox module
nanobind_add_module(obb_bbox NOMINSIZE ${CMAKE_CURRENT_SOURCE_DIR}/fastbbox/obb_bbox_nb.cpp)
nanobind_add_module(obb_bbox NOMINSIZE ${CMAKE_CURRENT_SOURCE_DIR}/src/fastbbox/obb_bbox_nb.cpp)

# Install the modules
install(TARGETS bbox obb_bbox LIBRARY DESTINATION fastbbox)
11 changes: 1 addition & 10 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
include README.md
include LICENSE
include BUILD.md
include pyproject.toml
include pyproject.cython.toml
include pyproject.nanobind.toml
include CMakeLists.txt
recursive-include fastbbox *.pyx *.pxd *.pxi
recursive-include fastbbox *_nb.cpp
recursive-include src/fastbbox *_nb.cpp
global-exclude *.pyc
global-exclude *.so
global-exclude *.c
# Exclude generated C++ from Cython, but keep *_nb.cpp for nanobind
global-exclude bbox.cpp obb_bbox.cpp

Loading
Loading