A template for pybind11 python packages
This repository hosts an example template for the folder structure of a Python package
that uses pybind11
to interface to C++.
The Python package can be installed using:
make install
I recommended to install everything within a virtual environment, e.g., using conda.
To automatically build the C++ sources and interface to Python pybind11
we will use
CMake as described here
To build the entire project you will need to install the following dependencies:
cmake >= 3.16
,pkg-config
For development you also need to install:
googletest
andpytest
for running unit tests,clang-format
andblack
for code formatting,cpplint
,pydocstyle
andpylint
to lint the code,cppcheck
for static code analysis.
To create documentation files you also need to install
sphinx
- the requirements in
docs/requirements.txt
You can install the dependencies using Conda, PyPI or most Linux package managers.
Clone/download the project and run
make debug
to build the C++ sources in debug mode. This builds an test executables in
build/
and a static library.
To run unit tests, lints, etc. call:
make test
make format
make lint
make check
To document everything call:
make docs
This builds html documentation in docs
.
Simon Dirmeier simon.dirmeier @ web.de