Replacing Boost.Python
by Pybind11
#966
howetuft
started this conversation in
Back-on-Track Technical Proposals
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Replacing
Boost.Python
withPybind11
Proposal Overview
This is a proposal to replace
Boost.Python
withPybind11
for Python bindings in LuxCore.Rationale
The rationale for this replacement is as follows:
Dependency Management:
Boost.Python
is a compiled dependency and is build-dependent on Python and Numpy. It must therefore be compiled for each Python Version (6), for each Platform (4), i.e. in 24 flavors. This eventually means 24 sets of dependencies to be provided for LuxCore build.Pybind11
is headers-only and does not depend on the Python version, reducing the dependency sets to just 4—one per platform.Compatibility Issues:
Boost.Python
requires a patch to be compatible withNumpy 2
. This patch is not available on ConanCenter and requires an in-house recipe, adding complexity and ongoing maintenance.Pybind11
's Conan recipe is fully adequate and builds out-of-the-box.Performance and Ease of Use:
Pybind11
is generally lighter thanBoost.Python
in terms of both compilation time and final executable size. For more details, refer to the Pybind11 Benchmark.Pybind11
does not require Numpy to be installed prior to the build process, as Numpy is not a build dependency forPybind11
, simplifying the setup.Pybind11
supports STL containers out-of-the-box.Industry Adoption:
Pybind11
is widely used by many large projects that offer Python bindings, including Blender. It is becoming the standard tool for Python bindings in the C++ community.Beta Was this translation helpful? Give feedback.
All reactions