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.3.tar.gz (49.5 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.3-cp312-cp312-win_amd64.whl (208.5 kB view details)

Uploaded CPython 3.12Windows x86-64

dtcc_pyspade_native-0.1.3-cp312-cp312-win32.whl (198.5 kB view details)

Uploaded CPython 3.12Windows x86

dtcc_pyspade_native-0.1.3-cp312-cp312-manylinux_2_28_x86_64.whl (290.7 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

dtcc_pyspade_native-0.1.3-cp312-cp312-macosx_11_0_arm64.whl (258.1 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

dtcc_pyspade_native-0.1.3-cp311-cp311-win_amd64.whl (208.5 kB view details)

Uploaded CPython 3.11Windows x86-64

dtcc_pyspade_native-0.1.3-cp311-cp311-win32.whl (198.5 kB view details)

Uploaded CPython 3.11Windows x86

dtcc_pyspade_native-0.1.3-cp311-cp311-manylinux_2_28_x86_64.whl (290.7 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

dtcc_pyspade_native-0.1.3-cp311-cp311-macosx_11_0_arm64.whl (258.1 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

dtcc_pyspade_native-0.1.3-cp310-cp310-win_amd64.whl (208.5 kB view details)

Uploaded CPython 3.10Windows x86-64

dtcc_pyspade_native-0.1.3-cp310-cp310-win32.whl (198.5 kB view details)

Uploaded CPython 3.10Windows x86

dtcc_pyspade_native-0.1.3-cp310-cp310-manylinux_2_28_x86_64.whl (290.7 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

dtcc_pyspade_native-0.1.3-cp310-cp310-macosx_11_0_arm64.whl (258.1 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

dtcc_pyspade_native-0.1.3-cp39-cp39-win_amd64.whl (208.5 kB view details)

Uploaded CPython 3.9Windows x86-64

dtcc_pyspade_native-0.1.3-cp39-cp39-win32.whl (198.5 kB view details)

Uploaded CPython 3.9Windows x86

dtcc_pyspade_native-0.1.3-cp39-cp39-manylinux_2_28_x86_64.whl (290.7 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.28+ x86-64

dtcc_pyspade_native-0.1.3-cp39-cp39-macosx_11_0_arm64.whl (258.1 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

dtcc_pyspade_native-0.1.3-cp38-cp38-win_amd64.whl (208.5 kB view details)

Uploaded CPython 3.8Windows x86-64

dtcc_pyspade_native-0.1.3-cp38-cp38-win32.whl (198.5 kB view details)

Uploaded CPython 3.8Windows x86

dtcc_pyspade_native-0.1.3-cp38-cp38-manylinux_2_28_x86_64.whl (290.7 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.28+ x86-64

dtcc_pyspade_native-0.1.3-cp38-cp38-macosx_11_0_arm64.whl (258.0 kB view details)

Uploaded CPython 3.8macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: dtcc_pyspade_native-0.1.3.tar.gz
  • Upload date:
  • Size: 49.5 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.3.tar.gz
Algorithm Hash digest
SHA256 51efe706969b0912e592e5c5f673c7c731908d152f13eee2e2e063ec8d2d4fca
MD5 7254d6ac79f132cf3a957f39eb6c9370
BLAKE2b-256 d96b5e37f7c97b19e88332952044ff8a32e03b1f0857d02364d6675b038951e2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dtcc_pyspade_native-0.1.3-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 5b1228b1cf26e60d2d35c963f9588c7cab6aa72ba661f007f2bce6b52f3ae024
MD5 ed53109b800c21c2feb5c7fe0351a756
BLAKE2b-256 6ad5c45cc81cda718401f163c7becf134f70d97b9ca385948de8fcca48b822fe

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dtcc_pyspade_native-0.1.3-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 e330710facfc3a36a8fee10fffd3e78f3c93f5545161b4c4d49a27a55045f695
MD5 a8687bff44c2e56792fcae2c22ce671e
BLAKE2b-256 c0d53e9c130d2ed4500fe8169c17f9667056846389c9e821672cf4987da19bf9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dtcc_pyspade_native-0.1.3-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0988a8d29264f67d45bb10e5450c9dfca7e2b246020900a07807ceafbf15955f
MD5 ecb05f1a5f5862fc7e027c9a1145688a
BLAKE2b-256 74db4a8e31f354becefb867620f2f3958c653e963dab0aa9a9ef3f6288670bb8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dtcc_pyspade_native-0.1.3-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f2b1a18d6044de55b29cddf60fca8bd50bfe4057630e020a427074a79bbf4395
MD5 c300c03377da2d1b4ea747c913d6341c
BLAKE2b-256 7f4928352f7cf0d50d6e0921294dde6590180d76ca60f65ca9d639834d97d18e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dtcc_pyspade_native-0.1.3-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 14a4eddaec203eaccbce3c20e2b9cd34dfe9b19ea21f75183732f92c4238961e
MD5 1da3c3e49ad45e4d5005da300e5b4585
BLAKE2b-256 d299b4cfae76dcbfbd751d7e267a8d99105c325be227058069179d1639f2e2b3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dtcc_pyspade_native-0.1.3-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 a56f68953e8e683561de83c3dde2c2618cada66d8386eab968bbd0adfd2a877e
MD5 ae92070619ee02416a613b2bfbd7ff63
BLAKE2b-256 ef5f7888fc780dd44fb73d6c8f2f48d6a1b6865f9203930663bb457e3fb4f64f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dtcc_pyspade_native-0.1.3-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 bbc6d075bda03ee316e3420f723f8c817d2d158b97269193b9098b2b59fc6ab5
MD5 88c331c0c5ddb86a56377cf0b7a8a511
BLAKE2b-256 5fc5f74ea64020a99b9b20f165007cad8f0cab5046356520e98ed6796dee2558

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dtcc_pyspade_native-0.1.3-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8506c63c60af97bceea1f2d4bd8469f12f50d99e73c5708b8576b3250446c73c
MD5 1c334295d84481eede0bfa48228ef7cd
BLAKE2b-256 fc6405dba4ca04878b168231bc0f08d7d7d3d6ff2996120ee3e93d59b79e8087

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dtcc_pyspade_native-0.1.3-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 5e55f3818f597884178dd9012b2299349f14d5d1d8301b92f1ee78a5ae7f7e2b
MD5 23f80e0377e3cf269c0fcad4bd4b5461
BLAKE2b-256 d261eb3b1a4783377171adb326ffcb3f7b596bf2af0b530de2d40cfd72b41b85

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dtcc_pyspade_native-0.1.3-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 c5cd3bda6b3e2b7339c49af36fcf60462ce7db78a485a6ec10d116b0de165a70
MD5 f4ba0fc26a460954606297697767389d
BLAKE2b-256 e1134836614bff45787302c6ff99bdf4893c082cde10bf2300104dd6716591db

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dtcc_pyspade_native-0.1.3-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a9790bdddcf62357ded9b61d6549ddf0b386ca697f2d466579683c8dbe3650bb
MD5 d920a539c81991473eeab99012639280
BLAKE2b-256 5821958de0eefa73bf1dbd856c4259ed0785b30392d978892563cbb82fc0c8ba

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dtcc_pyspade_native-0.1.3-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ec46dff50dcf1c1d8edaa44bf1d80c6ec246ba35f689917efa25221b738d4ba4
MD5 91c25ddce251fbd77d81272fe3ae6dd7
BLAKE2b-256 f036c22e35c94ae38062df17dfb5778168de9c9f696b4943c7d8bb4de56de4a5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dtcc_pyspade_native-0.1.3-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 790645ea68d071315221d6d057aaaa03a8c63a909ef4e7b81f3e4cd7d1d09cea
MD5 8d8ca656a085f76bfc3dc923a678c01c
BLAKE2b-256 5b96c5e6b9b77e843201091db2bd72d51720461085ab0e34f4af693d3faaa3ef

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dtcc_pyspade_native-0.1.3-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 f4db907bc8b7aefafa84c12cb4969ded692d86a5a393f4f9c9dc898cb1a25fb5
MD5 6436c8fa554fa9915e35bdb696b0ce2a
BLAKE2b-256 6304bd2aee433a16591c1b45416ba45284866f1d68753235fd354e8841a9183e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dtcc_pyspade_native-0.1.3-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 cbcf0a6db1970f3b53e3f0f4db6228a623c114e964a206c89fa97e36d6ba8914
MD5 c4f9bf4dce8272f3150118af18902c66
BLAKE2b-256 964194fa2851a37b5b5737d449cbafd9fe9f7ceb866a04cba1b663f42b8c3f14

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dtcc_pyspade_native-0.1.3-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cbf7a8690dad9342f70193602d87627539174bc6de879d16905cda028760874d
MD5 30e6e19a1da6469ea66fe22602c0af99
BLAKE2b-256 e4d9917376007f3330b81c6abf23c1646bd44a957ca9c2c6529883d91ec91ccc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dtcc_pyspade_native-0.1.3-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 369e93daf3702d2f9f7eb00ce606664142a7da933d5d8fbb33303f24cf7a651c
MD5 ff98640fe3979c5cf2ad490c3ae2d2ea
BLAKE2b-256 c21191ab399a80487469a2a3330116d347fb115086ca33a369b4dc5068d76deb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dtcc_pyspade_native-0.1.3-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 45f828c32f94297da2b23c180c70c1efc232a713a6ac67f382f7ea96d3313a53
MD5 c25cdaa39f4991403ca4bc97bbc3b277
BLAKE2b-256 83589f2178160b2e546806a3f6700874a408be0b86eb5b34d5efc46bf61d4f3a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dtcc_pyspade_native-0.1.3-cp38-cp38-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e7a7a35b9f808fab5f4ac6edb24ff636705cab97b302f5577bb41913271e8471
MD5 dd5d3e1571fdafa4019233352d334c5f
BLAKE2b-256 bea07ce59522720fb58829ad783523de9f52b8353b74e1b0099cd832b5ece21a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dtcc_pyspade_native-0.1.3-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 19a98a34778dabeb64d905a3f4bbb31e4d47f5e742612d38d4a3cae0c0998cef
MD5 19fd16f4123a574e6c16e83bbfa49614
BLAKE2b-256 f633635ee0537e1c44620f7d4a980ca451a224548f21ca24aa1bd19934a32ded

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