triangular
Two-dimensional Delaunay triangulation and convex hull for Python, implemented in Rust.
The API is compatible with the triangle wrapper's
delaunay and convex_hull functions.
import numpy as np
import triangular
pts = np.array([[0, 0], [0, 1], [0.5, 0.5], [1, 1], [1, 0]], dtype=float)
triangular.delaunay(pts) # -> int32 (M, 3): 0-based vertex-index triples
triangular.convex_hull(pts) # -> int32 (K, 2): 0-based hull edge vertex pairs
These correspond to triangle.delaunay (Triangle options Qz) and triangle.convex_hull
(options Qzc). Inputs are validated in Python: anything coercible to a float64 (N, 2)
array is accepted; bad shapes, non-finite values, or fewer than three vertices raise
ValueError. Degenerate inputs with no triangulation or hull (all points collinear, all
points coincident) return an empty array of the correct shape. CONTRACT.md
documents the exact behavior, including the few places it intentionally differs from
triangle.
Layout
python/triangular/ Python package: input coercion, validation, error contract.
src/ Rust geometry core, built with PyO3.
corpus/ Validation corpus recorded from the triangle library.
tests/ pytest suite: equivalence, invariants, degenerate cases, benchmarks.
CONTRACT.md Spec for the native core.
Development
uv sync # installs dev dependencies and builds the Rust extension
uv run pytest
uv sync builds the native module via maturin; after changing
the Rust code, rebuild with uv sync --reinstall-package triangular.
just lists the tasks. just ci runs format, lint and the Rust and Python tests, as CI
does. just check-deps runs cargo deny.
The suite can also run against the real triangle library, to check that the corpus and
invariant tests are themselves correct:
TRIANGULAR_IMPL=triangle uv run pytest
Tests marked improvement (where triangular's degenerate-input behavior intentionally
differs from triangle's) are skipped in that mode.
Benchmarks
uv run pytest -m benchmark
Compares against the reference timings recorded in corpus/manifest.json. The suite reads
a few environment variables:
| Variable | Default | Meaning |
|---|---|---|
TRIANGULAR_IMPL |
triangular |
Which import package the suite exercises. |
TRIANGULAR_BENCH_TOLERANCE |
1.5 |
Max allowed triangular / triangle time ratio. |
TRIANGULAR_BENCH_MAX_N |
100000 |
Skip benchmark cases larger than this. |
TRIANGULAR_FULL_CIRCLE_MAX |
1500 |
Brute-force empty-circle check size cap. |
Linting
pre-commit runs ruff and pyright on Python and rustfmt and clippy on Rust:
uv run pre-commit install
uv run pre-commit run --all-files
Releasing
Versions live in git tags only — pyproject.toml stays pinned at the 0.0.0 placeholder
and is never edited for a release. To ship:
gh release create v0.3.0 --generate-notes
Publishing the GitHub release triggers .github/workflows/release.yml, which stamps the
version from the tag into pyproject.toml, builds wheels (linux x86_64/aarch64, macOS
universal2, windows x64 — all abi3-py312, one wheel per platform) plus an sdist, smoke
tests each wheel, and publishes to PyPI via trusted publishing. Tags must match
vX.Y.Z (optionally aN/bN/rcN suffixed); anything else fails the stamp step before
a build starts.
Metadata
Release files for triangular 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| triangular-0.3.0.tar.gz | 7.7 MB | With provenance | Details for triangular-0.3.0.tar.gz |
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| triangular-0.3.0-cp312-abi3-win_amd64.whl | CPython 3.12 | abi3 | Windows x86-64 | Details for triangular-0.3.0-cp312-abi3-win_amd64.whl |
| triangular-0.3.0-cp312-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl | CPython 3.12 | abi3 | Linux glibc 2.17+ x86-64 | Details for triangular-0.3.0-cp312-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
| triangular-0.3.0-cp312-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl | CPython 3.12 | abi3 | Linux glibc 2.17+ ARM64 | Details for triangular-0.3.0-cp312-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl |
| triangular-0.3.0-cp312-abi3-macosx_10_12_universal2.macosx_10_12_x86_64.macosx_11_0_arm64.whl | CPython 3.12 | abi3 | macOS 10.12+ x86-64, macOS 10.12+ universal2 (ARM64, x86-64), macOS 11.0+ ARM64 | Details for triangular-0.3.0-cp312-abi3-macosx_10_12_universal2.macosx_10_12_x86_64.macosx_11_0_arm64.whl |
Total release size: 9.4 MB
Release files / triangular-0.3.0.tar.gz
| Download URL | triangular-0.3.0.tar.gz |
|---|---|
| Size | 7.7 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
771278ffd7737db314ccc9a63903a20ab7aa293ff9def6507332092f4b188eeb
|
|
BLAKE2b-256 checksum How to use checksums |
722d4014f2b271d43e4705e479c6c1aec417d7f47f90e3fa17936925253dcc91
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.
Transparency logRelease files / triangular-0.3.0-cp312-abi3-win_amd64.whl
| Download URL | triangular-0.3.0-cp312-abi3-win_amd64.whl |
|---|---|
| Size | 259.2 kB |
| Tags | CPython 3.12 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
f159b44bdd35642b0ae1e033638116cae829d8ff6999bc88843aac6a9244d865
|
|
BLAKE2b-256 checksum How to use checksums |
0f02da70276eeea8449734ec4257f43e58c40a7873c461399f7cd64f3d3f6bdc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.
Transparency logRelease files / triangular-0.3.0-cp312-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | triangular-0.3.0-cp312-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 378.4 kB |
| Tags | CPython 3.12 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
272483c4f59f892ff627d0d8340142c92e242be8821ccddebc2d3527314fcea7
|
|
BLAKE2b-256 checksum How to use checksums |
a7901137ced76f70e56883c38d5450b8f7bbdc6904e7f9844f9226661651e86b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.
Transparency logRelease files / triangular-0.3.0-cp312-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
| Download URL | triangular-0.3.0-cp312-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl |
|---|---|
| Size | 370.8 kB |
| Tags | CPython 3.12 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
7bd53c12a20d2e1ef9e1787515fa64fc39c6d53114a39c73bf52c5e5ac0b01f4
|
|
BLAKE2b-256 checksum How to use checksums |
b890787998926475158e2c5293128ee15a0d003240d60d729fce97357d66117d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.
Transparency logRelease files / triangular-0.3.0-cp312-abi3-macosx_10_12_universal2.macosx_10_12_x86_64.macosx_11_0_arm64.whl
| Download URL | triangular-0.3.0-cp312-abi3-macosx_10_12_universal2.macosx_10_12_x86_64.macosx_11_0_arm64.whl |
|---|---|
| Size | 682.5 kB |
| Tags | CPython 3.12 abi3 macOS 10.12+ universal2 (ARM64, x86-64) macOS 10.12+ x86-64 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
b355446df047cfa3a7cfaafe18b4e65a4416ef1d7a55e8a94d70b0820fa37e23
|
|
BLAKE2b-256 checksum How to use checksums |
a5767a290c5a5a5d5ee674fa79f4792cbacdaf6d06fd8d61371724867bd2269c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.
Transparency logSecurity for triangular 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 5 files in this release have been uploaded with provenance metadata.
Attestation for triangular-0.3.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.