A collection of small, self-contained example packages demonstrating how to
build a Python extension with CMake using the
scikit-build ecosystem. Each
project under projects/ builds and tests independently and serves
as a reference and test case for a particular language binding or build backend.
The samples span two generations of build backend.
These are pyproject-only (no setup.py); metadata lives in [project] and is
configured via [tool.scikit-build].
| Project | Demonstrates |
|---|---|
core-c-hello |
Raw C extension |
core-cffi-hello |
cffi via the cffi-gen-src source generator; requires Python 3.10+ |
core-cython-hello |
Cython via cython-cmake |
core-pybind11-hello |
pybind11 binding |
core-nanobind-shared |
nanobind binding linking a shared library shipped in the wheel |
hello-cmake-package |
Standalone C library, exported CMake package, and pybind11 wrapper |
hello-free-threading |
Free-threaded (no-GIL) build; requires Python 3.13+ |
pi-fortran |
Fortran via f2py and f2py-cmake |
| Project | Demonstrates |
|---|---|
hatchling-pybind11-hello |
pybind11 built through the hatchling plugin |
These use setuptools.build_meta with a setup.py, and require scikit-build,
cmake, and ninja in [build-system].requires.
| Project | Demonstrates |
|---|---|
hello-pure |
Pure Python (no compiled extension) |
hello-cpp |
Raw C++ extension |
hello-cython |
Cython binding |
hello-pybind11 |
pybind11 binding |
pen2-cython |
Cython binding for a double-pendulum simulation |
tower-of-babel |
The broadest example: Boost + Cython with static and shared linkage |
Development is driven by nox, with uv as the assumed runner:
# Run all tests
uvx nox -s test
# Test a single project
uvx nox -s "test(hello-cpp)"
# Build sdist + wheel for all distributable projects
uvx nox -s dist
# Build a single project's dists
uvx nox -s "dist(hello-pybind11)"To work with a single project directly, cd into it and use pip:
cd projects/hello-cpp
pip install .
pytest