Setup

Just like Rat-vcpkg and Rat-Containers, pyRat requires some setup in order to be built.

Hint

This page and Build cover building pyRat wheels, not installing one. Installing a wheel only needs a matching Python version (see Install).

Prerequisites

In the end pyRat is yet another C++ project built on top of the Rat C++ libraries.

Building it thus requires the same tools used to build Rat in the first place:

  • A C++17 compiler: on Windows, an MSVC developer shell

  • CMake (3.18 or later)

  • The Rat C++ libraries, 3.004.2 or later, built and installed, with their dependencies: from a rat-all build, a vcpkg installation, or an install prefix

  • For CUDA builds, the CUDA Toolkit RAT was built with (CUDA_PATH on Windows)

  • With RAT linking Intel oneAPI MKL: oneAPI’s environment (setvars.bat, or MKLROOT)

See also

pyRat links with Rat-Models (which transitively links with all other Rat libraries and their dependencies) thus requiring the same tooling.

Python wheels can then be built using the same environment.

Install UV

Note

If using Rat-Containers: rocky-cuda-pyrat already ships with UV.

In addition to the prerequisites one will need Python tooling for pyRat.

UV runs the build script, the build itself and the repair tools, and provides every Python version a wheel is built for. The rest comes from the build environment that UV creates: scikit-build-core 0.11 or later and pybind11 3.0 or later. Wheels can be built for Python 3.10 and later.

Important

Since pyRat ships compiled C++ code, it is tied to the CPython ABI, which changes with each minor version.

This means that pyRat wheels compiled with Python 3.12.x will only work with Python 3.12.x and no other versions: build one wheel per Python version to support.

UV allows to easily switch Python versions allowing for broader Python coverage.