This project has two goals:
- Debugging Python and C++ binding issues: This project is kept minimal to compile-test-iterate quickly.
- A starter template for python and C++ combo using pybind11. Correctly setting them is complicated and takes time, especially if you are new. This project is meant to serve as a starter, so we can start by fork/copy -ing this repo.
All these are installed automatically (see Build section).
Under the hood, we have these:
- cmake -- C++ builder
- skbuild -- builder for python which also invokes cmake
- pybind11 -- glue layer between C++ and Python
- C++: source code is in
src/
directory. SeeCMakeLists.txt
for how it is builtlibmymod
-- native libmymod
-- an executable binary
- Python:
_mymod
package is created by pybind11. See pybind.cpp and CMakeLists.txt.mymod
package, located underpython/mymod
. Meant to wrap_mymod
and offers flexibility for including pure python utils in the wheel package
pip install -v .
# Example for customizing CMAKE_ARGS; here use g++-9
CMAKE_ARGS="-DCMAKE_CXX_COMPILER=g++-9" pip install -v .
# pip install pytest # if pytest is missing
pytest -vs python/tests
This template is extracted out of Pymarian