An example of a hybrid python/C++ package with unit tests
This repository contains an example Python module which wraps C++ code. The code presented here was designed to meet four requirements:
pybind11
and built with CMake)catch
)unittest
)setuptools
setup.py script for building, installation, and testingPlease see the blog post that accompanies this repository for more information.
NOTE: If you'd like to see the version of the repository that corresponds to my original June 2017 blog post, go to this release. However, I no longer recommend using the repository structure from this old release.
To build and install python_cpp_example
, clone or download this repository and then, from within the repository, run:
python3 ./setup.py install
or
pip3 install .
To execute all unit tests, run the following command:
python3 ./setup.py test
Much of the code in this repository was adapted from the pybind11
tutorial and the pybind11
example CMake repository.