Commit ed7cace1 authored by Joe Snyder's avatar Joe Snyder
Browse files

Merge branch 'issue-103-shibboken-genpybind' into 'master'

README: Expand on cppyy. Add mention of shibboken and genpybind

Closes #103

See merge request autopybind11/autopybind11!32
parents ee3d54b0 516b31c9
......@@ -256,6 +256,8 @@ or setup a CMake build system and execute the ``lint_lib`` test::
Alternatives Comparison
-----------------------
*Note*: Some mentions here are purely observational, and do not yet have
explicit comparisons against ``autopybind11``.
CLIF
####
......@@ -278,6 +280,25 @@ codebase.
This project may possibly resume at some point
(`drake#7889 <https://github.com/RobotLocomotion/drake/issues/7889#issuecomment-634260874>`_).
Shibboken2
##########
* https://doc.qt.io/qtforpython/shiboken2/shibokengenerator.html
* https://doc.qt.io/qtforpython/shiboken2/considerations.html#general
This provides both the CPython interface and C++ API scanning (similar to
PyBindGen, CLIF, etc.), and is used in PySide, but is sufficiently general to
use in other projects.
The documentation is extremely comprehensive, and provides detailed
explanations of each step in the process, especially in sections where
customizations are necessary.
One drawback is that debugging will involve both generated CPython code as well
as the binding analysis itself, similar as with CLIF. (It's similar to
debugging ``pybind11``, but in ``pybind11`` the main hoop to jump through is
C++ template metaprogramming).
pybind11
########
......@@ -370,6 +391,23 @@ namespaces, classes, and functions. Binder’s configuration file can also alte
the functions used to bind the code. The user can specify a function which is
run in place of the default binding code.
genpybind
#########
https://github.com/kljohann/genpybind
This uses the both ``clang`` C++ AST API and the ``clang.cindex`` Python AST
API to generate bindings ``pybind11``, similar to ``binder`` mentioned above.
However, the primary philosophy here is to annotate any additional information
(e.g. return value policies, renames, etc.) using explicit compiler attributes
using macros.
More information on why both the C++ and Python APIs are used are detailed
here: https://github.com/kljohann/genpybind#implementation
Interesting, the author would prefer to make a single C++ tool rather than a
single Python tool ;)
AutoWIG
#######
......@@ -379,8 +417,9 @@ https://github.com/StatisKit/AutoWIG |
`Example Code <https://github.com/StatisKit/FP17>`_
Provides a means to parse C++ code and emit either Boost.Python or pybind11
code, using libclang in Python(Python bindings of C API for Clang). It can also
translate docstrings from Doxygen to Sphinx, including symbol references.
code, using ``clang.cindex`` in Python (Python bindings of C ``libclang`` API).
It can also translate docstrings from Doxygen to Sphinx, including symbol
references.
It also provides a comprehensive class structure with different passes, which
look great for generalization, but may also cause developers some pain with
......@@ -415,8 +454,43 @@ Most notably, because this code generates its own bindings, any runtime
debugging must done jointly with the code generation, which would incur similar
overhead like debugging errors with SWIG.
Other Tools / Libraries
#######################
cppyy
#####
* https://cppyy.readthedocs.io/en/latest/index.html
* https://bitbucket.org/wlav/cppyy/src/master/
* https://bitbucket.org/wlav/cppyy-backend/src/master/clingwrapper/
* https://bitbucket.org/wlav/cppyy-backend/src/master/cling/
- https://bitbucket.org/wlav/cppyy-backend/src/master/cling/python/cppyy_backend/
Generates Python bindings of C++ code on the fly using Cling (which leverages
the clang frontend and LLVM backend).
The PyHPC paper in the above mentioned links cite `pygccxml` and `Reflex` as
motivating examples. The goal is to provide (interactive) bindings for C++
projects with APIs the size of ROOT. (Additionally, the paper has normalize
benchmarking, which is an excellent goal in any project!)
For an overview of the package structure, see
`the docs <https://cppyy.readthedocs.io/en/latest/packages.html#package-structure>`_.
Note that the ``cppyy_backend``
Python module actually accesses ``clang.cindex`` to provide the
``cppyy-generator`` tool used in its workflow:
`cppyy: Utilities <https://cppyy.readthedocs.io/en/latest/utilities.html#bindings-collection>`_.
Due to usage of Cling and the philosophy of lazy binding, user experience may
be heavily impacted at load time and when heavy new instantiations are
necessary (similar to complaintgs about Julia startup time).
However, these should generally only apply to projects with template-heavy
public APIs (e.g. those that use Eigen). Performance could possible be tuned.
For more details, see this GitHub discussion:
`drake#7889 (comment)
<https://github.com/RobotLocomotion/drake/issues/7889#issuecomment-663721506>`_.
Other Mentions
##############
* https://github.com/robotpy/robotpy-build
......@@ -424,13 +498,6 @@ Other Tools / Libraries
- Emits pybind11 code
- Uses `header2whatever <https://pypi.org/project/header2whatever/>`_
* https://cppyy.readthedocs.io/en/latest/index.html
- Uses Cling (C++ interpreter) to generate Python bindings of C++ code on the
fly
- Due to usage of Cling, may heavily impact first-time usage (similar to
Julia)
.. _pycodestyle: https://pypi.org/project/pycodestyle/
.. _Copyright.txt: Copyright.txt
.. _`data.kitware.com`: https://data.kitware.com/#folder/57b5de948d777f10f2696370
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment