Skip to main content

Spade C++ triangulation library packaged for Python projects (C++ only, no Python bindings)

Project description

dtcc-pyspade-native

PyPI version License Python

Ship the Spade C++ triangulation library with your Python package - no Python bindings, just pure C++ for your C++ extensions.

What is this?

dtcc-pyspade-native packages the Spade C++ Delaunay triangulation library for distribution via PyPI. It's designed for Python projects that have C++ components and need fast, robust 2D triangulation.

Key Point: This package provides C++ libraries only - no Python API. Use it when your Python project already has C++ extensions (pybind11, Cython, etc.) and you want to use Spade in that C++ code.

Quick Start

Install

pip install dtcc-pyspade-native

Use in Your Python Project

pyproject.toml:

[build-system]
requires = ["scikit-build-core", "pybind11", "dtcc-pyspade-native>=0.1.0"]

[project]
dependencies = ["dtcc-pyspade-native>=0.1.0"]

CMakeLists.txt:

find_package(Python REQUIRED COMPONENTS Interpreter)

execute_process(
    COMMAND ${Python_EXECUTABLE} -c "import pyspade_native; print(pyspade_native.get_cmake_dir())"
    OUTPUT_VARIABLE PYSPADE_CMAKE_DIR
    OUTPUT_STRIP_TRAILING_WHITESPACE
)

find_package(pyspade_native REQUIRED PATHS ${PYSPADE_CMAKE_DIR} NO_DEFAULT_PATH)

target_link_libraries(your_module PRIVATE pyspade_native::spade_wrapper)

your_module.cpp:

#include <spade_wrapper.h>

void triangulate() {
    std::vector<spade::Point> polygon = {{0,0,0}, {1,0,0}, {0.5,1,0}};
    auto result = spade::triangulate(polygon, {}, {}, 0.5,
                                     spade::Quality::Moderate, true);
    // Use result.points, result.triangles...
}

Features

  • Easy Distribution: Install via pip, no manual C++ library management
  • Cross-Platform: Pre-built wheels for Linux, macOS, Windows
  • CMake Integration: Clean find_package() support
  • No Rust Required: Ships pre-built Rust FFI library
  • C++17: Modern C++ API with STL containers
  • Constrained Delaunay: Full CDT support with mesh refinement

Use Cases

Perfect for:

  • Python packages with pybind11/Cython/cffi extensions
  • GIS applications with C++ backends
  • Scientific computing tools
  • CAD/CAM software with Python interfaces
  • Any Python project that needs C++ triangulation

Documentation

Python Helper API

import pyspade_native

# Get paths for your build system
include_dir = pyspade_native.get_include_dir()
library_dir = pyspade_native.get_library_dir()
cmake_dir = pyspade_native.get_cmake_dir()

# Get available libraries
libs = pyspade_native.get_libraries()
# {'spade_wrapper': '/path/to/libspade_wrapper.so',
#  'spade_ffi': '/path/to/libspade_ffi.so'}

# Print installation info
pyspade_native.print_info()

C++ API

The Spade C++ wrapper provides a clean, modern interface:

namespace spade {
    // Triangulate a polygon with optional holes and interior constraints
    TriangulationResult triangulate(
        const std::vector<Point>& outer,
        const std::vector<std::vector<Point>>& holes = {},
        const std::vector<std::vector<Point>>& interior_loops = {},
        double maxh = 1.0,
        Quality quality = Quality::Default,
        bool enforce_constraints = true
    );

    enum class Quality {
        Default,   // No angle constraints
        Moderate   // 25-degree minimum angle
    };

    struct TriangulationResult {
        std::vector<Point> points;
        std::vector<Triangle> triangles;
        std::vector<Edge> edges;
        size_t num_vertices() const;
        size_t num_triangles() const;
        size_t num_edges() const;
    };
}

Example Project

See examples/complete-project for a full working example of a Python package that uses dtcc-pyspade-native.

cd examples/complete-project
pip install .
python -c "from my_package import triangulate; print(triangulate([[0,0],[1,0],[0.5,1]]))"

Building from Source

git clone https://github.com/dtcc-platform/dtcc-pyspade-native
cd dtcc-pyspade-native
pip install -e .

Development

# Install in editable mode
pip install -e ".[dev]"

# Run tests
pytest tests/

# Build wheels
python -m build

# Run examples
cd examples/complete-project && pip install . && python test.py

Requirements

For Installation

  • Python 3.8+
  • C++ compiler with C++17 support
  • CMake 3.15+

For Building from Source

  • All of the above
  • Rust toolchain (automatically fetched if not present)

Contributing

Contributions welcome! See CONTRIBUTING.md for guidelines.

License

Dual-licensed under MIT OR Apache-2.0, matching the Spade library.

Acknowledgments

This project packages the Spade library by Stefan Löffler for easy Python distribution. Developed as part of the DTCC Platform.

Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dtcc_pyspade_native-0.1.2.tar.gz (46.1 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

dtcc_pyspade_native-0.1.2-cp312-cp312-win_amd64.whl (200.0 kB view details)

Uploaded CPython 3.12Windows x86-64

dtcc_pyspade_native-0.1.2-cp312-cp312-win32.whl (190.5 kB view details)

Uploaded CPython 3.12Windows x86

dtcc_pyspade_native-0.1.2-cp312-cp312-manylinux_2_28_x86_64.whl (273.0 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

dtcc_pyspade_native-0.1.2-cp312-cp312-macosx_11_0_arm64.whl (248.2 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

dtcc_pyspade_native-0.1.2-cp311-cp311-win_amd64.whl (200.0 kB view details)

Uploaded CPython 3.11Windows x86-64

dtcc_pyspade_native-0.1.2-cp311-cp311-win32.whl (190.5 kB view details)

Uploaded CPython 3.11Windows x86

dtcc_pyspade_native-0.1.2-cp311-cp311-manylinux_2_28_x86_64.whl (273.0 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

dtcc_pyspade_native-0.1.2-cp311-cp311-macosx_11_0_arm64.whl (248.2 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

dtcc_pyspade_native-0.1.2-cp310-cp310-win_amd64.whl (200.0 kB view details)

Uploaded CPython 3.10Windows x86-64

dtcc_pyspade_native-0.1.2-cp310-cp310-win32.whl (190.5 kB view details)

Uploaded CPython 3.10Windows x86

dtcc_pyspade_native-0.1.2-cp310-cp310-manylinux_2_28_x86_64.whl (273.0 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

dtcc_pyspade_native-0.1.2-cp310-cp310-macosx_11_0_arm64.whl (248.2 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

dtcc_pyspade_native-0.1.2-cp39-cp39-win_amd64.whl (200.0 kB view details)

Uploaded CPython 3.9Windows x86-64

dtcc_pyspade_native-0.1.2-cp39-cp39-win32.whl (190.5 kB view details)

Uploaded CPython 3.9Windows x86

dtcc_pyspade_native-0.1.2-cp39-cp39-manylinux_2_28_x86_64.whl (273.0 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.28+ x86-64

dtcc_pyspade_native-0.1.2-cp39-cp39-macosx_11_0_arm64.whl (248.2 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

dtcc_pyspade_native-0.1.2-cp38-cp38-win_amd64.whl (200.0 kB view details)

Uploaded CPython 3.8Windows x86-64

dtcc_pyspade_native-0.1.2-cp38-cp38-win32.whl (190.5 kB view details)

Uploaded CPython 3.8Windows x86

dtcc_pyspade_native-0.1.2-cp38-cp38-manylinux_2_28_x86_64.whl (273.0 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.28+ x86-64

dtcc_pyspade_native-0.1.2-cp38-cp38-macosx_11_0_arm64.whl (248.1 kB view details)

Uploaded CPython 3.8macOS 11.0+ ARM64

File details

Details for the file dtcc_pyspade_native-0.1.2.tar.gz.

File metadata

  • Download URL: dtcc_pyspade_native-0.1.2.tar.gz
  • Upload date:
  • Size: 46.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for dtcc_pyspade_native-0.1.2.tar.gz
Algorithm Hash digest
SHA256 384987a4c065b98ba397000c39e1b4367a020622e50fe6b5792a7ed8fd6cdb58
MD5 cc71bec054fbfcb9940a3e0e4753b1d4
BLAKE2b-256 2a0e057f2a2f736a0eca4727134d54fe3530d199f7fe6f25bcf4953790442814

See more details on using hashes here.

File details

Details for the file dtcc_pyspade_native-0.1.2-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for dtcc_pyspade_native-0.1.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 86be7c5a64adcbbec8c0c1cdee61bf1c3eab1895991d9f0d561831d8ba334264
MD5 9c1b22291e3526b0de08bbe0fd889fa7
BLAKE2b-256 0b5edea5c79c75dacc05fdbd9481ad3df9dd5ded3d3b5f144f68d7281cdf2917

See more details on using hashes here.

File details

Details for the file dtcc_pyspade_native-0.1.2-cp312-cp312-win32.whl.

File metadata

File hashes

Hashes for dtcc_pyspade_native-0.1.2-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 762183d12d81d44dc65d5341245cf59e5d28269679634e465e5c0ddb596f4ea1
MD5 ec629a0c43b36a9e0fe55ba45cca2eb9
BLAKE2b-256 2cc4400fa0b3bf5f2667e66122a5ef68987bf61e3f0fc2ab67bb0e42b042e21d

See more details on using hashes here.

File details

Details for the file dtcc_pyspade_native-0.1.2-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for dtcc_pyspade_native-0.1.2-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9e85d48d355662e6a3b0dc06be13aeb0e149a0315e0d34820e03d7b9a43d6e26
MD5 93f37cf39f69fa9064aefb251816dfdd
BLAKE2b-256 f189b0fac799939b7c2c96c890f767ce1feff7051c380e6dac1460fd1be39afe

See more details on using hashes here.

File details

Details for the file dtcc_pyspade_native-0.1.2-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for dtcc_pyspade_native-0.1.2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 dd50a358cdaf70190fae825cd2bcb373efdf22c961c35974454107de4599a8ea
MD5 8fbc8dc90afa08eebf456a8f5183ecfc
BLAKE2b-256 bb056474917a1ef959f7863774796a9b5b0cde254a5a1f890ceff3cde26d53a6

See more details on using hashes here.

File details

Details for the file dtcc_pyspade_native-0.1.2-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for dtcc_pyspade_native-0.1.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 f34b8793e341cf8c6ebc3c027ca9144969fccca55ec305c0aa6b64236eae7288
MD5 d89447dea70666f1dbb598883d273958
BLAKE2b-256 c29e3afbf31be792983b4502c7307e7164086bdff6b2c727e5d2b7d9a3c12f63

See more details on using hashes here.

File details

Details for the file dtcc_pyspade_native-0.1.2-cp311-cp311-win32.whl.

File metadata

File hashes

Hashes for dtcc_pyspade_native-0.1.2-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 d63336ea29ed4175b322373454233aa62e26dd8606e284172c01bcbd2ac7b262
MD5 e54377d125b4c220bf4f9f4b8e9ef8d6
BLAKE2b-256 d81ee033f6a8db1bfa56e09ec277bc20700ac8cbf56849c33e7ad9e45a495e77

See more details on using hashes here.

File details

Details for the file dtcc_pyspade_native-0.1.2-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for dtcc_pyspade_native-0.1.2-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 5b56475340e4dce676d2be696b505616c557373537eadb53e79e439d63556b76
MD5 6b5ea9afddb4a22da31e10b75b1823f4
BLAKE2b-256 450229a830ad9b6cfdf56cae7017dd001578abc47cfbf7a65ce4c6c31aef6dcf

See more details on using hashes here.

File details

Details for the file dtcc_pyspade_native-0.1.2-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for dtcc_pyspade_native-0.1.2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0316f351258b6a04a16978655435f62f0849dbf56bfeb8d9bcc46891caf3201c
MD5 1d1fe03246889677474fc23e10a53c5f
BLAKE2b-256 6c016b56e5d80c021c1e00ad15eca0ae441e524be68f1800cfaaf0434d0d86a3

See more details on using hashes here.

File details

Details for the file dtcc_pyspade_native-0.1.2-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for dtcc_pyspade_native-0.1.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 4eb4e88cee4710853aacaba4b8acdb74bf9547d2005830041ec513f1b8265323
MD5 78490509e7dce7607bd8c646f7af5bca
BLAKE2b-256 a4be6f7dc69e32e0aeffd78c4165460286eee6f9e02fe804388122007ae796ee

See more details on using hashes here.

File details

Details for the file dtcc_pyspade_native-0.1.2-cp310-cp310-win32.whl.

File metadata

File hashes

Hashes for dtcc_pyspade_native-0.1.2-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 d323b464b4cd9de2e6ed4455f1e0110af1b70ad96ecc8127c025b4f162910f48
MD5 61eece0442d3580d23a790d3f941748a
BLAKE2b-256 f42f6f94056c739ea2ad81a0aacec2036b3b2ce0957447b9c0abaa99e87c0449

See more details on using hashes here.

File details

Details for the file dtcc_pyspade_native-0.1.2-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for dtcc_pyspade_native-0.1.2-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 04ea4c5d88f391a28bbdd6f8647761196d8e45ebe9a8405a9ea3d38c4186fc90
MD5 93ad5b8466a8328b4d261f8fc65fdb4a
BLAKE2b-256 73742755a7b188d2a1b0c649d0b8c99e12e87e3e72c1e05fc8a08962aae5d48f

See more details on using hashes here.

File details

Details for the file dtcc_pyspade_native-0.1.2-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for dtcc_pyspade_native-0.1.2-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cbe5bc090816f394c72704917ce13d3f61f8660bc1101870362c5cfb1eec1fe9
MD5 5d7b6c584e8a60b8849eaadee34ab4c3
BLAKE2b-256 1caf1d45ad48d9167594fad9c9ca0606429dbd4e6bcd7fec0c464b4580fce254

See more details on using hashes here.

File details

Details for the file dtcc_pyspade_native-0.1.2-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for dtcc_pyspade_native-0.1.2-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 f0831611ea17a0f099b3e946a70742f1b1b40a3aad593a9bec78ceaf05339ee2
MD5 0ec041ad82a9b30fb4b46cb13d4ee240
BLAKE2b-256 35f58ceb88bac460c23ca382b6cb74944fffc94a7c58bace5abac592eddc7ade

See more details on using hashes here.

File details

Details for the file dtcc_pyspade_native-0.1.2-cp39-cp39-win32.whl.

File metadata

File hashes

Hashes for dtcc_pyspade_native-0.1.2-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 8d8d2b76b63aebe9c1065e8bb35c30a7b8c0afa78defaa000c866a08226f2a12
MD5 954b11252005fbcb5344532e4e43ef7c
BLAKE2b-256 1be4311f76ee87357bf7aa53a8c26be536e501163b33f1260706cfc851ceb527

See more details on using hashes here.

File details

Details for the file dtcc_pyspade_native-0.1.2-cp39-cp39-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for dtcc_pyspade_native-0.1.2-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 30be1db5537a9869e8468d74e720e08e470fa984e42f243e55a8dc9e30fbb9e0
MD5 9367c877ba2c2e7cd611ad3be4da781b
BLAKE2b-256 90eb9edf4a7657d30f26f74bc370687c697f1c060621c4e36ba2773658c2e7b4

See more details on using hashes here.

File details

Details for the file dtcc_pyspade_native-0.1.2-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for dtcc_pyspade_native-0.1.2-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8839684486b82c4aaa34ced976de53328465f83ae4edcfe2a1cdbd0686461704
MD5 90e7fab12d122bcd5a847c89414b8d07
BLAKE2b-256 4aa1232953b7d909967e148df48f336f2743deda9a9d08380ae8732b2667d3d9

See more details on using hashes here.

File details

Details for the file dtcc_pyspade_native-0.1.2-cp38-cp38-win_amd64.whl.

File metadata

File hashes

Hashes for dtcc_pyspade_native-0.1.2-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 ed574a6c745eda74a7507cdaf70660aa483c6e559a59b94cec94d7f60c573276
MD5 2fc6b413252997801d9327907815592b
BLAKE2b-256 2015f467b58b1ba27e0bd417995d08373b882ba7fac9d9784bcca19635f0fffb

See more details on using hashes here.

File details

Details for the file dtcc_pyspade_native-0.1.2-cp38-cp38-win32.whl.

File metadata

File hashes

Hashes for dtcc_pyspade_native-0.1.2-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 359326166228a4a528a196286799c55bac44c2b4eba1f0efed46b72089972bc9
MD5 dff7af456b948dfb95470b1b47916624
BLAKE2b-256 e15889318bac1a1415057bc701f45379aaa93249e77923d1d25e251aea7d534e

See more details on using hashes here.

File details

Details for the file dtcc_pyspade_native-0.1.2-cp38-cp38-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for dtcc_pyspade_native-0.1.2-cp38-cp38-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 47431c59b706a997d68d8bdf844040f7319e793b0ad2daacd2f5ff80b2619626
MD5 7c274b987a8a4fd560b45152b9e47f6d
BLAKE2b-256 65a016dc9b2e0bb9d811e24792ecd4eabdda5b2254b760c9d23e4be9ecfd6c5f

See more details on using hashes here.

File details

Details for the file dtcc_pyspade_native-0.1.2-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for dtcc_pyspade_native-0.1.2-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a7904428f734f52baaf2a5a1ab97b4c6afe947a4606a2c8be2199853ba0c339b
MD5 d862739ff42c6462b36f2b362b23f220
BLAKE2b-256 ba9a74a5c13a9a501f25eddc08ab86949da5ad84eb456177353690d933dde3d8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page