GitHub - python-project-templates/python-template-cpp: A Python/C++ project template
Repository navigation
python-template-cppPublic template
About
A Python/C++ project template
python-project-templates.github.io/python-template-cpp/Topics
cmake cpp cpp-template cpp-templates project-template project-templates pybind11 python python-binding python-cpp python-template python-templatesResources
Readme Apache-2.0 licenseCode of conduct
Code of conduct Activity Custom propertiesStars
7 starsWatchers
2 watchingForks
1 fork Report repositoryBranches
Tags
Go to Branches page Go to Tags page
Latest commit
History
177 Commits
View commit history for this file.
Folders and files
| Name | Name | Last commit message | Last commit date |
|---|---|---|---|
| .github | .github | ||
| cpp | cpp | ||
| docs/ wiki | docs/ wiki | ||
| python_template_cpp | python_template_cpp | ||
| vcpkg-overlays | vcpkg-overlays | ||
| .clang-format | .clang-format | ||
| .copier-answers.yaml | .copier-answers.yaml | ||
| .gitignore | .gitignore | ||
| LICENSE | LICENSE | ||
| Makefile | Makefile | ||
| README.md | README.md | ||
| pyproject.toml | pyproject.toml | ||
| vcpkg.json | vcpkg.json | ||
Repository files navigation
python template cpp
A C++-Python project template
Overview
C ABI
cpp/python-template-cpp builds libpython_template_cpp, a C ABI over the C++ code, declared in
python_template_cpp/include/python_template_cpp/python_template_cpp.h. Wheels ship the library under python_template_cpp/lib and
the header under python_template_cpp/include/python_template_cpp, and the Python extension in cpp/python links
against the library. The tests compile a C program against the installed package. Other
projects build against the installed wheel with python_template_cpp.get_include(),
get_library_dirs(), get_libraries(), and get_prefix().
HATCH_CPP_LIBRARY_SOURCE chooses where the library comes from at build time:
bundled (the default, for wheels), external (a prebuilt library found
through HATCH_CPP_LIBRARY_ROOT, pkg-config, or the conda prefix), or direct
(compile the library sources into the extension).
cpp/CMakeLists.txt builds and installs the library without Python, with a CMake
package config and a pkg-config file, for conda, vcpkg, and system packages:
cmake -S cpp -B build -DCMAKE_BUILD_TYPE=Release cmake --build build cmake --install build --prefix /path/to/prefix
Note
This library was generated using copier from the Base Python Project Template repository .
About
A Python/C++ project template
python-project-templates.github.io/python-template-cpp/