This project template is designed for C++ projects providing Python3 bindings.
This project is built from C++ using
scikit-build-core <https://scikit-build-core.readthedocs.io/en/latest/index.html>
_
to make a bridge between CMake and the Python build system and make Python modules with CMake.
The Python bindings are built with nanobind <https://nanobind.readthedocs.io/en/latest/index.html>
_.
The template builds over nanobind_example <https://github.com/wjakob/nanobind_example>
_
plus a set of personal preferences that can be easily disabled or re-configured.
Since there is no release yet, the only installation available is the development version.
Tip
The use of a virtual environment is recommended;
a conda environment
file is provided (if you start from scratch is recommended to
install the Miniforge3 distribution which comes with mamba as a faster alternative to conda
).
In the following instructions this is the assumed setup.
- create a new repository from this template
- clone your newly created repository
cd your_repo_name
- search and replace globally
my-package
andmy_package
with the equivalent of your project name identifiers conda env create -f environment.yml
(mamba
is recommended overconda
if available)pip install .[dev]
pre-commit install
- Switch to the default branch and update it (
git switch main && git pull
) - activate the development virtual environment (
conda activate your-env-name
) - update it (
conda env update --file environment.yml --prune
) - re-install the package (
pip install .[dev]
)
The documentation is based on and build using,
- pydata-sphinx-theme as the theme,
- rstcheck as a linter
- towncrier and sphinxcontrib-towncrier for the build of the changelog,
- nanobind-stubgen and sphinx-autoapi to generate the Python bindings API documentation automatically
- Doxygen, breathe and exhale to generate automatically the C++ API
Documentation can be compiled locally with make -C docs html
(a clean
target is also available).
The development process is based on a pre-commit configuration.
Linting and formatting are performed using ruff.
Testing for the Python interface is performed with pytest while that for the C++ interface needs to be added.
- Continuous integration pipeline to test
pip
installation and Python testing suite