Installation

primate is a standard PEP-517 package, and thus can be installed via pip:

pip install < primate source directory >

Currently the package must be built from source via cloning the repository. PYPI support is planned.

Platform support

For certain platforms, primate can be installed from PyPi without compilation. As of 12/29/23, native primate wheels are built for the following platforms:

Platform 3.8 3.9 3.10 3.11 3.12
Linux (manylinux x86_64)
MacOS (x86_64)
MacOS ARM (arm64) 1
Windows (AMD64) 2

Wheels are currently built with cibuildwheel. Currently no support is offered for PyPy, 32-bit systems, or unsupported versions of CPython.

If your platform isn’t on this table but you would like it to be supported, feel free to make an issue.

Compiling from source

To install the package from its source distribution, a C++20 compiler is required; the current builds are all built with some variant of clang, preferably version 15.0 or higher. For platform- and compiler-specific settings, consult the build scripts and CI configuration files.

C++ Installation

primate’s C++ interface is header-only, making it easy to compile your own extension modules. The simplest way to link these headers is to add primate as a dependency to your package and use the get_include() function to find the appropriate directory.

# setup.py
import primate as pm
...
Extension('extension_name', ..., include_dirs=[pm.get_include()])
...
# meson.build
...
primate_include_dirs = run_command(py, 
  ['-c', 'import primate as pm; print(pm.get_include())']
).stdout().strip()
...

Assuming your headers are located in extern, from your git repository, you can use:

git submodule add https://github.com/peekxc/primate extern/primate
git submodule update --init

From here, you can now include extern/primate/include into your C++ source files, or you can add this directory to the search path used other various build tools, such as CMake or Meson.

Footnotes

  1. Single-thread execution only; ARM-based OSX runners compile with Apple’s clang, which doesn’t natively ship with libomp.dylib, though this may be fixable. Feel free to file an PR if you can get this working.↩︎

  2. Single-thread execution only; primate depends on OpenMP 4.5+, which isn’t supported on any Windows compiler I’m aware of.↩︎