This release is a pre-release and may not be stable for production use.
cppjit: automatic Python-C++ interop and bindings
cppjit embeds an interactive C++ JIT compiler in Python: write or import C++ at run time and use its functions, classes, and templates as if they were Python. In contrast to binding libraries such as pybind11 and nanobind, there is no wrapper code to write and no CMake build to set up: bindings materialize automatically on demand, derived from the C++ declarations. Run-time binding generation enables:
- Detailed specialization of each call at the point of use
- Lazy loading for reduced memory use in large-scale projects
- Python-side cross-inheritance and callbacks for working with C++ frameworks
- Run-time template instantiation, so the binding surface never has to be enumerated ahead of time
- Automatic object downcasting and exception mapping
- Interactive exploration of C++ libraries from the Python prompt
cppjit supports user-developed C++ frameworks and third-party C++ libraries from standard package managers, and lets you use them from a Python application or build a Python-based DSL on top. cppjit is the successor project of cppyy, rebuilt on CppInterOp and the clang-repl C++ interpreter in LLVM. See the CHEP 2026 and the EuroLLVM 2026 talks for more details.
- Source code: https://github.com/compiler-research/cppjit
- Bug reports: https://github.com/compiler-research/cppjit/issues
- Changelog: https://github.com/compiler-research/cppjit/releases
Examples
A CPython extension builds Python proxies for all C++ entities: functions, classes, templates, and variables. Constructors, operators, and data members follow Python conventions. The embedded JIT lazily compiles the C++ behind each proxy:
import cppjit
cppjit.cppdef("""
struct Vec2 {
double x, y;
Vec2 operator+(const Vec2& o) const { return {x + o.x, y + o.y}; }
};""")
c = cppjit.gbl.Vec2(1, 2) + cppjit.gbl.Vec2(3, 4)
c.x, c.y # (4.0, 6.0)
Templates instantiate on demand, and STL containers behave like Python containers:
cppjit.cppdef("""
#include <algorithm>
template <typename T>
T largest(const std::vector<T>& xs) { return *std::max_element(xs.begin(), xs.end()); }
""")
v = cppjit.gbl.std.vector['int']([3, 1, 4, 1, 5])
cppjit.gbl.largest(v) # 5; largest<int> is compiled at this call
len(v), list(v) # vectors support len(), iteration, indexing
Python callables pass into C++ as function pointers:
cppjit.cppdef("""
template <typename R, typename... U, typename... A>
R callme(R (*f)(U...), A &&...args) {
return f(args...);
}""")
def callback(x: int, y: float) -> float:
return x + y
cppjit.gbl.callme(callback, 123, 321.5) # 444.5
NumPy arrays pass zero-copy; the C++ side works on the same buffer:
import numpy as np
a = np.arange(6, dtype=np.float64)
cppjit.cppdef("void scale(double* xs, std::size_t n, double f) { while (n--) xs[n] *= f; }")
cppjit.gbl.scale(a, a.size, 10.0)
a # array([ 0., 10., 20., 30., 40., 50.]); same buffer, no copy
An installed library binds at run time, with no binding code written for it:
import cppjit
cppjit.include('zlib.h') # bring in the declarations
cppjit.load_library('libz') # load the symbols
cppjit.gbl.zlibVersion() # '1.3'; call the library directly
CppInterOp drives Clang and provides the necessary run-time reflection and JIT compilation API for cppjit.
Use cases
- Numerics and data science: move performance-critical code into C++ in the same session.
- Template-heavy APIs: STL, Eigen, and user templates instantiate lazily at call sites.
- Existing C++ codebases: use them from Python without modification.
- Domain-specific languages: user-defined "pythonizations" adapt the bindings into Pythonic libraries.
Requirements
A package manager installation of cppjit (such as pip) requires GCC >= 9 or Clang >= 15 (the JIT compiles C++ against the host's standard library headers).
Building from source requires:
- LLVM/Clang development packages, version 21 or 22
- Python 3.12+ with development headers
- CMake 3.20+
- A C++20 compiler: g++ 13+, or a Clang matching the LLVM major (an older Clang fails to compile newer LLVM headers)
- CppInterOp, cloned at build time or supplied from a local checkout (see the development builds below)
Source installation (pip)
Ubuntu 24.04
sudo apt-get update
sudo apt-get install -y git cmake make g++ python3-dev python3-venv python3-pip \
wget lsb-release software-properties-common gnupg libzstd-dev libedit-dev
wget https://apt.llvm.org/llvm.sh && sudo bash llvm.sh 21
sudo apt-get install -y llvm-21-dev libclang-21-dev clang-21 libpolly-21-dev
python3 -m venv venv && source venv/bin/activate
git clone https://github.com/compiler-research/cppjit.git && cd cppjit
pip install -v . --config-settings=cmake.define.LLVM_DIR=/usr/lib/llvm-21/lib/cmake/llvm
macOS
brew install llvm@21 cmake ninja
python3 -m venv venv && source venv/bin/activate
git clone https://github.com/compiler-research/cppjit.git && cd cppjit
pip install -v . --config-settings=cmake.define.LLVM_DIR="$(brew --prefix llvm@21)/lib/cmake/llvm"
Development build (pip editable)
With the toolchain from the source installation above, an editable install with a persistent build directory gives incremental rebuilds:
export LLVM_DIR=/usr/lib/llvm-21/lib/cmake/llvm # your LLVM's CMake directory
pip install scikit-build-core
pip install --no-build-isolation -ve . \
--config-settings=build-dir=build \
--config-settings=cmake.define.LLVM_DIR=$LLVM_DIR
To co-develop both CppInterOp and cppjit, clone CppInterOp next to
cppjit and rerun the install with a separate build directory and
--config-settings=cmake.define.CPPINTEROP_SOURCE_DIR=$PWD/../CppInterOp.
The local checkout overrides the pinned tag, so new CppInterOp API is
usable from cppjit immediately.
Development build (CMake)
The CMake build compiles and stages CppInterOp inside the build tree
and assembles the Python package under <build>/python; point
PYTHONPATH there instead of installing:
export LLVM_DIR=/usr/lib/llvm-21/lib/cmake/llvm # your LLVM's CMake directory
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DLLVM_DIR=$LLVM_DIR
cmake --build build -j
export PYTHONPATH=$PWD/build/python
A prebuilt CppInterOp (built shared with -DBUILD_SHARED_LIBS=ON and
installed to a prefix) is consumed in place through CppInterOp_DIR
instead of being rebuilt:
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DLLVM_DIR=$LLVM_DIR \
-DCppInterOp_DIR=$PWD/../CppInterOp/install/lib/cmake/CppInterOp
Running the test suite locally
pip install -r requirements.txt
cd test
make -j4 # builds the *Dict.so loaded for tests
python -m pytest -ra --tb=short
Contributing
Bug reports, feature requests, and questions go to the issue tracker. Pull requests are welcome; run the test suite before submitting.
Metadata
Release files for cppjit 0.1.0a1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| cppjit-0.1.0a1.tar.gz | 416.3 kB | With provenance | Details |
Built distributions (wheels)
Total release size: 512.8 MB
Release files / cppjit-0.1.0a1.tar.gz
| Download URL | cppjit-0.1.0a1.tar.gz |
|---|---|
| Size | 416.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ebda4a4574e1a93e5c30ab7a49365c411fd2580716d5a73aac5de0de1c127bf0
|
|
BLAKE2b-256 checksum How to use checksums |
943bc0b443e316841d63ca4990d70845d17267dab1f58cb090a28a13e6aba4d4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 7, 2026.
Transparency logRelease files / cppjit-0.1.0a1-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | cppjit-0.1.0a1-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 51.8 MB |
| Tags | CPython 3.14 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
2fe951e4219b61e79c60cf5fdf00c5e00121235dbea8a1d33a7886938cf57e75
|
|
BLAKE2b-256 checksum How to use checksums |
28ad3061e70e2385a40d67173dca8b7c1afb036957ab0741b016156f76c12730
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 7, 2026.
Transparency logRelease files / cppjit-0.1.0a1-cp314-cp314-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
| Download URL | cppjit-0.1.0a1-cp314-cp314-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 48.5 MB |
| Tags | CPython 3.14 Linux glibc 2.27+ ARM64 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
b3c90266c5b6f3e157b4f8180f5c569322e8361ed6bad0e749014626dd2b46cf
|
|
BLAKE2b-256 checksum How to use checksums |
895d3b9a43cb15749a2df44534f82b96aa251e8b130eb2c114854e791e66b14b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 7, 2026.
Transparency logRelease files / cppjit-0.1.0a1-cp314-cp314-macosx_14_0_x86_64.whl
| Download URL | cppjit-0.1.0a1-cp314-cp314-macosx_14_0_x86_64.whl |
|---|---|
| Size | 36.4 MB |
| Tags | CPython 3.14 macOS 14.0+ x86-64 |
|
SHA-256 checksum How to use checksums |
b124ef3788eec1e11f050e9165a0f0be7bbfdf2c219b09f474b3c4e2bd1549fc
|
|
BLAKE2b-256 checksum How to use checksums |
a7cd2ea8a7cbe8bda8b3d771459691bf26bdea110e1c10513f2e93a3b8a174d1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 7, 2026.
Transparency logRelease files / cppjit-0.1.0a1-cp314-cp314-macosx_14_0_arm64.whl
| Download URL | cppjit-0.1.0a1-cp314-cp314-macosx_14_0_arm64.whl |
|---|---|
| Size | 34.2 MB |
| Tags | CPython 3.14 macOS 14.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
c955e6b7345ad414e1fb8a1c4b280bb421e523308a40f99586a701962351061c
|
|
BLAKE2b-256 checksum How to use checksums |
28852af20b6c6d117a78d614c32659ea853adf75c3a36556ad340de351ad047a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 7, 2026.
Transparency logRelease files / cppjit-0.1.0a1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | cppjit-0.1.0a1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 51.8 MB |
| Tags | CPython 3.13 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
14b115e0a8da35f9b9908f2056e8a38ba84708cb22726808ddd2953d3564e665
|
|
BLAKE2b-256 checksum How to use checksums |
f984c43ff2490b8492daf1cb3bb8e9ab13053e86ea73e11c97457d22bdaf322b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 7, 2026.
Transparency logRelease files / cppjit-0.1.0a1-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
| Download URL | cppjit-0.1.0a1-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 48.5 MB |
| Tags | CPython 3.13 Linux glibc 2.27+ ARM64 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
42db21675b78e53364acc37c3dfefd0b4738c9d063b623f5c30c13daa48961b4
|
|
BLAKE2b-256 checksum How to use checksums |
12d64051cdb969e0d364cf1a076f85eb1c6b78d0963741f3af88e96952e58418
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 7, 2026.
Transparency logRelease files / cppjit-0.1.0a1-cp313-cp313-macosx_14_0_x86_64.whl
| Download URL | cppjit-0.1.0a1-cp313-cp313-macosx_14_0_x86_64.whl |
|---|---|
| Size | 36.4 MB |
| Tags | CPython 3.13 macOS 14.0+ x86-64 |
|
SHA-256 checksum How to use checksums |
d393e5220083ee7b3c4fd8fad88545a3a85a85416b1c712a7100f264058d37c9
|
|
BLAKE2b-256 checksum How to use checksums |
47ebd52341fa84e381186eaf07b3e1fef0c2d0ef2188e435152c900a1f4853b0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 7, 2026.
Transparency logRelease files / cppjit-0.1.0a1-cp313-cp313-macosx_14_0_arm64.whl
| Download URL | cppjit-0.1.0a1-cp313-cp313-macosx_14_0_arm64.whl |
|---|---|
| Size | 34.2 MB |
| Tags | CPython 3.13 macOS 14.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
b04dd5545db70f5580e153b9837a597ef0255baab76efbb6a42fa2b003f00099
|
|
BLAKE2b-256 checksum How to use checksums |
43589be02cf6479fd68fc2670384baeb8b3603e3dba58f076ea24aa95e47855e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 7, 2026.
Transparency logRelease files / cppjit-0.1.0a1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | cppjit-0.1.0a1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 51.8 MB |
| Tags | CPython 3.12 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
23c0be62fe1edc483d9027bbca76233963005c5c4a1e651f27c9edbd4b58c313
|
|
BLAKE2b-256 checksum How to use checksums |
8d49bc8acc6db1cfc4fb960954638492ce93f1c8eaf7e031adc2c2db07127a7c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 7, 2026.
Transparency logRelease files / cppjit-0.1.0a1-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
| Download URL | cppjit-0.1.0a1-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 48.5 MB |
| Tags | CPython 3.12 Linux glibc 2.27+ ARM64 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
b30f6f68977d83adebc7c739ea4fedbf65f30fdbf2e78243b0d435ae6afd42e8
|
|
BLAKE2b-256 checksum How to use checksums |
5cf0eb0dfe27b53dc21501ba4b2afe3fefd0628ff2fd92ae748d0fb2d79a73d4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 7, 2026.
Transparency logRelease files / cppjit-0.1.0a1-cp312-cp312-macosx_14_0_x86_64.whl
| Download URL | cppjit-0.1.0a1-cp312-cp312-macosx_14_0_x86_64.whl |
|---|---|
| Size | 36.4 MB |
| Tags | CPython 3.12 macOS 14.0+ x86-64 |
|
SHA-256 checksum How to use checksums |
d8b1406819a7a4a2c34b5fca7e690333699507dd846e41aa68f374eeef0d3e75
|
|
BLAKE2b-256 checksum How to use checksums |
098a52ff1ee526056b55de45c125d943b30cbbf16060e199a26ebe10aff3d97d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 7, 2026.
Transparency logRelease files / cppjit-0.1.0a1-cp312-cp312-macosx_14_0_arm64.whl
| Download URL | cppjit-0.1.0a1-cp312-cp312-macosx_14_0_arm64.whl |
|---|---|
| Size | 34.2 MB |
| Tags | CPython 3.12 macOS 14.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
76bbefa957209f86e89903be37bb021d1a6849754466c9da98f427b025d90fd3
|
|
BLAKE2b-256 checksum How to use checksums |
cf42d6984ead067d5840d164ccf0b2ff68758c8c8ab021cab566629232cdecf3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 7, 2026.
Transparency logSecurity for cppjit 0.1.0a1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 13 files in this release have been uploaded with provenance metadata.
Attestation for cppjit-0.1.0a1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 7, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.