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
22 changes: 8 additions & 14 deletions .github/workflows/pip.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Pip
name: "Pip"

on:
workflow_dispatch:
Expand All @@ -9,29 +9,23 @@ on:

jobs:
build:
name: Build with Pip
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform: [ubuntu-20.04, windows-2019, macos-13]
python-version: ["3.9"]

runs-on: ${{ matrix.platform }}
platform: [windows-latest, macos-latest, ubuntu-latest]
python-version: ["3.9", "3.11"]

steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: actions/checkout@v4

- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Add requirements
run: python -m pip install --upgrade wheel setuptools

- name: Build and install
run: pip install --verbose .[test]

- name: Test
if: ${{ startsWith(matrix.platform, 'ubuntu') }}
run: python -m pytest
run: pytest
57 changes: 30 additions & 27 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,19 @@ on:
types:
- published

env:
FORCE_COLOR: 3

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build_sdist:
name: Build SDist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true

Expand All @@ -25,8 +32,9 @@ jobs:
- name: Check metadata
run: pipx run twine check dist/*

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


Expand All @@ -36,37 +44,28 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
os: [ubuntu-latest, macos-latest, windows-latest]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true

- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v2
with:
platforms: all

- uses: pypa/[email protected]
- uses: pypa/[email protected]
env:
# CIBW_ARCHS: auto64
CIBW_ARCHS_LINUX: x86_64 aarch64
CIBW_ARCHS_WINDOWS: AMD64 # ARM64
CIBW_ARCHS_MACOS: x86_64 arm64
CIBW_BEFORE_BUILD: pip install numpy scipy fire --prefer-binary
# https://cibuildwheel.readthedocs.io/en/stable/options/#build-skip
CIBW_SKIP: pp* *i686 *musllinux*
CIBW_TEST_SKIP: "*macosx* *win* *aarch64"
CIBW_ARCHS_MACOS: universal2
CIBW_ARCHS_WINDOWS: auto ARM64
CIBW_SKIP: "pp* *musllinux* *_i686"
CIBW_TEST_SKIP: "*macosx* *win* *aarch64 cp31* pp* *musllinux*"
CIBW_BEFORE_BUILD: "pip install --prefer-binary numpy pytest"

- name: Verify clean directory
run: git diff --exit-code
shell: bash

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


Expand All @@ -75,17 +74,21 @@ jobs:
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
environment: pypi
permissions:
id-token: write

steps:
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: "3.9"
python-version: "3.x"

- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: artifact
pattern: cibw-*
merge-multiple: true
path: dist

- uses: pypa/gh-action-pypi-publish@v1.6.4
- uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
password: ${{ secrets.pypi_password }}
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

7 changes: 6 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,14 @@ endif()
# https://scikit-build-core.readthedocs.io/en/latest/getting_started.html
find_package(Python REQUIRED COMPONENTS Interpreter Development.Module)
find_package(pybind11 CONFIG REQUIRED)
include_directories(SYSTEM ${PROJECT_SOURCE_DIR}/headers/include)
execute_process(
COMMAND "${Python_EXECUTABLE}" -c
"import cubao_headers; print(cubao_headers.get_include())"
OUTPUT_VARIABLE CUBAO_HEADERS_INCLUDE_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE)

python_add_library(_core MODULE src/main.cpp WITH_SOABI)
target_include_directories(_core PRIVATE "${CUBAO_HEADERS_INCLUDE_DIR}")
target_link_libraries(_core PRIVATE pybind11::headers)
target_include_directories(_core PRIVATE src)
target_compile_definitions(_core PRIVATE VERSION_INFO=${PROJECT_VERSION})
Expand Down
1 change: 0 additions & 1 deletion headers
Submodule headers deleted from 13b5b9
10 changes: 7 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
[build-system]
requires = ["scikit-build-core>=0.3.3", "pybind11"]
requires = ["scikit-build-core>=0.3.3", "pybind11", "cubao-headers>=0.0.8"]
build-backend = "scikit_build_core.build"


[project]
name = "concave_hull"
version = "0.0.9"
url = "https://concave-hull.readthedocs.io"
version = "0.1.0"
description="A very fast 2D concave hull algorithm"
readme = "README.md"
authors = [
Expand All @@ -23,8 +22,13 @@ classifiers = [
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
]

[project.urls]
Homepage = "https://concave-hull.readthedocs.io"

[project.optional-dependencies]
test = ["pytest", "scipy"]

Expand Down
47 changes: 27 additions & 20 deletions src/concave_hull/_core.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@
"""
from __future__ import annotations

import typing

import numpy
import numpy.typing

__all__ = [
__all__: list[str] = [
"clockwise",
"colinear",
"concave_hull_indexes",
Expand All @@ -23,44 +26,48 @@ __all__ = [
]

def clockwise(
prev: numpy.ndarray[numpy.float64[2, 1]],
curr: numpy.ndarray[numpy.float64[2, 1]],
next: numpy.ndarray[numpy.float64[2, 1]],
prev: typing.Annotated[numpy.typing.ArrayLike, numpy.float64, "[2, 1]"],
curr: typing.Annotated[numpy.typing.ArrayLike, numpy.float64, "[2, 1]"],
next: typing.Annotated[numpy.typing.ArrayLike, numpy.float64, "[2, 1]"],
*,
include_colinear: bool = False,
) -> bool: ...
def colinear(
prev: numpy.ndarray[numpy.float64[2, 1]],
curr: numpy.ndarray[numpy.float64[2, 1]],
next: numpy.ndarray[numpy.float64[2, 1]],
prev: typing.Annotated[numpy.typing.ArrayLike, numpy.float64, "[2, 1]"],
curr: typing.Annotated[numpy.typing.ArrayLike, numpy.float64, "[2, 1]"],
next: typing.Annotated[numpy.typing.ArrayLike, numpy.float64, "[2, 1]"],
) -> bool: ...
def concave_hull_indexes(
points: numpy.ndarray[numpy.float64[m, 2]],
points: typing.Annotated[numpy.typing.ArrayLike, numpy.float64, "[m, 2]"],
*,
convex_hull_indexes: numpy.ndarray[numpy.int32[m, 1]],
concavity: float = 2.0,
length_threshold: float = 0.0,
) -> numpy.ndarray[numpy.int32[m, 1]]:
convex_hull_indexes: typing.Annotated[numpy.typing.NDArray[numpy.int32], "[m, 1]"],
concavity: typing.SupportsFloat = 2.0,
length_threshold: typing.SupportsFloat = 0.0,
) -> typing.Annotated[numpy.typing.NDArray[numpy.int32], "[m, 1]"]:
"""
documents here: https://github.com/mapbox/concaveman
"""

def convex_hull_indexes(
points: numpy.ndarray[numpy.float64[m, 2], numpy.ndarray.flags.c_contiguous],
points: typing.Annotated[
numpy.typing.NDArray[numpy.float64], "[m, 2]", "flags.c_contiguous"
],
*,
include_colinear: bool = False,
order_only: bool = False,
) -> numpy.ndarray[numpy.int32[m, 1]]: ...
) -> typing.Annotated[numpy.typing.NDArray[numpy.int32], "[m, 1]"]: ...
def orientation(
prev: numpy.ndarray[numpy.float64[2, 1]],
curr: numpy.ndarray[numpy.float64[2, 1]],
next: numpy.ndarray[numpy.float64[2, 1]],
prev: typing.Annotated[numpy.typing.ArrayLike, numpy.float64, "[2, 1]"],
curr: typing.Annotated[numpy.typing.ArrayLike, numpy.float64, "[2, 1]"],
next: typing.Annotated[numpy.typing.ArrayLike, numpy.float64, "[2, 1]"],
) -> int: ...
def wgs84_to_east_north(
wgs84: numpy.ndarray[numpy.float64[m, 2], numpy.ndarray.flags.c_contiguous]
) -> numpy.ndarray[numpy.float64[m, 2]]:
wgs84: typing.Annotated[
numpy.typing.NDArray[numpy.float64], "[m, 2]", "flags.c_contiguous"
]
) -> typing.Annotated[numpy.typing.NDArray[numpy.float64], "[m, 2]"]:
"""
documents here: https://github.com/mapbox/cheap-ruler
"""

__version__: str = "0.0.9"
__version__: str = "0.1.0"
Loading