Skip to main content

libigl: A simple C++ geometry processing library

Project description

libigl Python Bindings

PyPI version

This repository contains the source code for the python bindings for the C++ libigl library written using nanobind. Functions allow NumPy arrays as input and output for dense matrices and vectors and SciPy sparse matrices for sparse matrices.

Installation

python -m pip install libigl

Documentation

:warning: WARNING
The python-binding documentation is perennially out of date and will likely be removed/changed.
  • A tutorial on how to use the bindings can be found here
  • A function reference can be found here

Getting the current version of libigl within python code

Since version 2.5.4.dev0, the igl.__version__ attribute has been removed. To get the version of the libigl package you're using within your python code, you can use the following code:

import importlib.metadata
libigl_version = importlib.metadata.version('libigl')

The version of libigl is defined in the pyproject.toml file.

Compiling and modifying the bindiings

According to the scikit-build-core documentation, the way to make an editable (incremental) build is to:

  1. Preinstall the dependencies (at the top of pyproject.toml
  2. Then use this very long command:
CMAKE_BUILD_PARALLEL_LEVEL=10  python -m pip install --no-build-isolation --config-settings=editable.rebuild=true -Cbuild-dir=build -ve.

The CMAKE_BUILD_PARALLEL_LEVEL=10 will invoke with 10 parallel build threads.

Adding a missing binding

Bindings are fairly mechanical to write. For example, suppose we didn't have a binding for the c++ function igl::moments. The first step would be to look at the corresponding .h header file in the C++ libigl library: moments.h.

Then we would create the src/moments.cpp file in this project which uses Eigen::MatrixXN for numeric types and Eigen::MatrixXI for integer types. Typically this requires a simple wrapper around the function matching its signature to these types and some boilerplate void bind_moments(... code which adds the function to the python module.

Simply adding this .cpp file will be enough to add the bindings on the next build.

If submitting a pull request with a new binding, please also add an execution test in tests/test_all.py to ensure the binding can at least be called as expected.

Testing cibuildwheel locally

Install whichever version of Python from the official website and then run:

/Library/Frameworks/Python.framework/Versions/3.11/bin/python3.11 -m venv venv-official-3.11
source venv-official-3.11/bin/activate
python -m pip install cibuildwheel
CIBW_BUILD="cp311-*" python -m cibuildwheel --output-dir wheelhouse --platform macos

Downloading all the artifacts

A successful .github/workflows/wheels.yml run will a lot of .whl files. To download these all at once, you can use the following command:

mkdir wheelhouse
cd wheelhouse
gh run download [runid]

Then these can be uploaded to pypi using:

python -m twine upload --repository testpypi wheelhouse/*/*.whl wheelhouse/*/*.tar.gz

Acknowledgements

The original python bindings were generated and maintained by @teseoch, @KarlLeell, @fwilliams, @skoch9, and @danielepanozzo

The modern python bindings (since 2.5.4.dev0) can largely be blamed on @alecjacobson.

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

libigl-2.6.2.tar.gz (41.2 MB view details)

Uploaded Source

Built Distributions

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

libigl-2.6.2-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (12.8 MB view details)

Uploaded CPython 3.12+manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

libigl-2.6.2-cp312-abi3-macosx_11_0_arm64.whl (11.3 MB view details)

Uploaded CPython 3.12+macOS 11.0+ ARM64

libigl-2.6.2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (12.8 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

libigl-2.6.2-cp311-cp311-macosx_11_0_arm64.whl (11.3 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

libigl-2.6.2-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (12.8 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

libigl-2.6.2-cp310-cp310-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl (12.1 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.27+ ARM64manylinux: glibc 2.28+ ARM64

libigl-2.6.2-cp310-cp310-macosx_11_0_arm64.whl (11.3 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

libigl-2.6.2-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (12.8 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

libigl-2.6.2-cp39-cp39-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl (12.1 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.27+ ARM64manylinux: glibc 2.28+ ARM64

libigl-2.6.2-cp39-cp39-macosx_11_0_arm64.whl (11.3 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

libigl-2.6.2-cp38-cp38-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (12.8 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

File details

Details for the file libigl-2.6.2.tar.gz.

File metadata

  • Download URL: libigl-2.6.2.tar.gz
  • Upload date:
  • Size: 41.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.0

File hashes

Hashes for libigl-2.6.2.tar.gz
Algorithm Hash digest
SHA256 5da0c5d889a66e3e90eefe6b7f0e7239ade6ac94353585f1b5b086bb1372599e
MD5 a2737c095141d8c5bccdb7d787e8731a
BLAKE2b-256 b92d595f3ba33701b2354723821e38745674ae9b21ec79d18d7757dbe2e893c3

See more details on using hashes here.

File details

Details for the file libigl-2.6.2-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for libigl-2.6.2-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e92dac380ec1f81d87a6f5423b2de228e106f90edb9c14033984210c23b32854
MD5 23c16ba0eae88fc04bdefe6170998de3
BLAKE2b-256 e19f3c6994d112759d25b00007384651157dabf955c61a62050de4fadea794f2

See more details on using hashes here.

File details

Details for the file libigl-2.6.2-cp312-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for libigl-2.6.2-cp312-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9b477b584277def1fbf99c05a9ca59c96ad09f6e6572ac58b88ac73c7f3f7ac9
MD5 3ddbfb2988fa404306d6611ad3d08826
BLAKE2b-256 989999422c55a722afea4cd25c8d6c2fd5f432be564a12cfa18a2aae7160abff

See more details on using hashes here.

File details

Details for the file libigl-2.6.2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for libigl-2.6.2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 6df98eeb49ec4bc18564ed6f8d4870988232db21054407426582984bc3e85d69
MD5 92447ebea9acb0f1fa78b8dca8c19117
BLAKE2b-256 20008ce186b7c401af1248720accebbbf0e3b1434507d8b39b282e7f36a7fcd7

See more details on using hashes here.

File details

Details for the file libigl-2.6.2-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for libigl-2.6.2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 38b4cf389d99354d46bff365a756d5f07cea866a862d2c2183fbd03ddb0e57bd
MD5 e66881ad3472d28d503d40ffe4546b98
BLAKE2b-256 3d37610399df8a8c56e5e1d4dfaf844269d30ae0114c14a3957c031699b81ebc

See more details on using hashes here.

File details

Details for the file libigl-2.6.2-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for libigl-2.6.2-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c5f881f9a2be09a356112aa87225ff7e22f4acb51dedca1d3ffface73274205f
MD5 1e6ed64c72721ca3f73b0500c8d169c3
BLAKE2b-256 31d6026f3e289b33460653a5b96f35537048fc51a244644bbab336c50d711d7e

See more details on using hashes here.

File details

Details for the file libigl-2.6.2-cp310-cp310-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for libigl-2.6.2-cp310-cp310-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 b40c9bd612390ba9c0af14fcdc9c089eb160a86a3a34f95db6988b371ffded7a
MD5 dee2d891f7486b6cf97d24c71a2c3bae
BLAKE2b-256 5b9305fe266780933da5f7ed6852b23700f9bda844e2dc542e10ddfa921465cd

See more details on using hashes here.

File details

Details for the file libigl-2.6.2-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for libigl-2.6.2-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 03232eca6b1c80750ce46e2383ace7bd9327ab908f37ea2131e44bf47f98dab5
MD5 eac749bc5db5f525ac65182264a95705
BLAKE2b-256 4258fa57aa9e918106f260286a2af435009308c92dc188e6b1885a660b1d1fb1

See more details on using hashes here.

File details

Details for the file libigl-2.6.2-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for libigl-2.6.2-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7014590b26ca0550f96d6dde4144c8abfd007819d06fab7236c18c95e8ea5bb6
MD5 06205f4ce2379a467c995a895600d8e0
BLAKE2b-256 cae079d983bee14ace30472b3ede771eb25ec60409342551fea37e5a71fead12

See more details on using hashes here.

File details

Details for the file libigl-2.6.2-cp39-cp39-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for libigl-2.6.2-cp39-cp39-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 16566f13b1295f526b867c25058fb710a996eacb757e06cc5690e3667f59d9d8
MD5 4127451c7a43606bb80824dfcbd037b3
BLAKE2b-256 21760ceb5261169d524ae4421c3df563df77c06863e9377051bcb8eeb9c5901a

See more details on using hashes here.

File details

Details for the file libigl-2.6.2-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for libigl-2.6.2-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9aeae494fad2bd45700ca584748eb7d98f7cbd68106da6fe62cd1e8e6b9b6995
MD5 a638181cee5a0709671c4d3cbda8d0d4
BLAKE2b-256 7ebab7d1f74ecba5c6b0cfb73aa263427e410ce6b8e741eb1932751aec6079b0

See more details on using hashes here.

File details

Details for the file libigl-2.6.2-cp38-cp38-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for libigl-2.6.2-cp38-cp38-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2ef13fcf06454ceddcc897bd69cfbf3d3ef9aa8b31c2c37662a5f5fc6e1bae34
MD5 4ed5ede1cc4fbe5f6382cdda17219029
BLAKE2b-256 50aa272133aa73db0874e14000efe050e1e911d0531fb86b1beff39660503a0d

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