Installation

primate is a standard PEP-517 package that can be installed via pip:

python -m pip install scikit-primate  

Assuming your platform is supported, no compilation is needed—see platform support for details.

Note

Like many packages registered on PyPI (e.g. sklearn), the distribution package (scikit-primate) differs from the import package (primate) (see here). Thus, to install, use the scikit- prefix, but to import no prefix is needed. primate does not rely on organizational prefixes use by some scikits (e.g. scikit-learn -> sklearn).

Platform support

For most platforms, primate can be installed from PyPI without compilation. In particular, native wheels are currently built with cibuildwheel on the following platforms:

Platform 3.9 3.10 3.11 3.12 3.13
Linux (manylinux x86_64)
MacOS (x86_64)
MacOS ARM (arm64)
Windows (AMD64)

Currently, there is no support 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

A C++20 compiler is required to compile the package from its source distribution. Current builds all compile with some variant of clang (version 15.0+) or gcc. 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.