cppyy module is a frontend that requires an intermediate (Python
interpreter dependent) layer, and a backend (see
Because of this layering and because it leverages several existing packages
through reuse, the relevant codes are contained across a number of
- Frontend, cppyy: https://bitbucket.org/wlav/cppyy
- CPython (v2/v3) intermediate: https://bitbucket.org/wlav/cpycppyy
- PyPy intermediate (module _cppyy): https://bitbucket.org/pypy/pypy/
- Backend, cppyy: https://bitbucket.org/wlav/cppyy-backend
The backend repo contains both the cppyy-cling (under “cling”) and cppyy-backend (under “clingwrapper”) packages.
Building from source¶
Except for cppyy-cling, the structure in the repositories follows a normal
PyPA package and they are thus ready to build with setuptools: simply
clone the package and either run
python setup.py, or use
It is highly recommended to follow the dependency chain when manually
upgrading packages individually (i.e.
CPyCppyy if on CPython, and then finally
cppyy), because upstream
packages expose headers that are used by the ones downstream.
Of course, if only building for a patch/point release, there is no need to
re-install the full chain (or follow the order).
Always run the local updates from the package directories (i.e. where the
setup.py file is located), as some tools rely on the package structure.
STDCXX envar can be used to control the C++ standard version; use
MAKE to change the
make command; and
MAKE_NPROCS to control the
maximum number of parallel jobs.
Compilation of the backend, which contains a customized version of
Clang/LLVM, can take a long time, so by default the setup script will use all
cores (x2 if hyperthreading is enabled).
On MS Windows, some temporary path names may be too long, causing the build to
To resolve this issue, point the
TEMP envars to an existing
directory with a short name before the build:
> set TMP=C:\TMP > set TEMP=C:\TMP
Start with the
cppyy-cling package (cppyy-backend repo, subdirectory
“cling”), which requires source to be pulled in from upstream, and thus takes
a few extra steps:
$ git clone https://bitbucket.org/wlav/cppyy-backend.git $ cd cppyy-backend/cling $ python setup.py egg_info $ python create_src_directory.py $ python -m pip install . --upgrade
egg_info setup command is needed for
find the right version.
That script in turn downloads the proper release from upstream, trims and
and installs the result in the “src” directory.
When done, the structure of
cppyy-cling looks again like a PyPA package
and can be used/installed as expected, here using
cppyy-cling package, because it contains Cling/Clang/LLVM, is rather
large to build, so by default the setup script will use all cores (x2 if
hyperthreading is enabled).
You can change this behavior with the
The wheel of
cppyy-cling is reused by pip for all versions of CPython and
PyPy, thus the long compilation is needed only once for all different
versions of Python on the same machine.
Next up is
cppyy-backend (cppyy-backend, subdirectory “clingwrapper”; omit
the first step if you already cloned the repo for
$ git clone https://bitbucket.org/wlav/cppyy-backend.git $ cd cppyy-backend/clingwrapper $ python -m pip install . --upgrade
CPyCppyy (if on CPython; it’s not needed for PyPy) and
is very similar:
$ git clone https://bitbucket.org/wlav/CPyCppyy.git $ cd CPyCppyy $ python -m pip install . --upgrade
Finally, the top-level package
$ git clone https://bitbucket.org/wlav/cppyy.git $ cd cppyy $ python -m pip install . --upgrade
Please see the pip documentation for more options, such as developer mode.