Note: Please disregard the commit history in this repository. This repository is my development scratchpad, where all structural changes are designed and documented before being pushed to the official ecosystem.
π π Stable purecpp
PureCPP is a powerful C++ backend architecture for RAG systems.
Designed for maximum performance and scalability, it integrates vector search, ONNX models, and CPU/CUDA acceleration into a seamless, Python-integrated framework.
This repository provides detailed guidance on how to set up the environment, configure dependencies and build.
π Explore all of Bruno Bavaresco Zaffariβs contributions (explained) related to this framework.
git clone --recursive https://github.com/bbzaffari/purecpp_sp
cd purecpp_sp
Warning
If you forgot to use --recursive
when cloning the repository, make sure to run:
git submodule update --init --recursive
- 1. Build a Docker image from the current directory and tag it as 'purecpp_env'
docker build -t purecpp_env .
- 2. Start a Docker container named 'env' from the 'purecpp_env' image, mounting current dir to /home
docker run -it --name env -v "$PWD":/home purecpp_env
- 3. Run the
env_config.sh
chmod +x installers/*.sh
./installers/env_config.sh
This script automates the setup. Installing Python essentials, LibTorch, FAISS, and configuring Conan profile.d
Caution
Once you've created the container using docker run
, you don't need to recreate it again.
Instead, follow these two simple commands to reuse the container:
docker start env
This command starts an existing container that has already been created earlier using docker run
.
docker exec -it env bash
This command attaches a terminal to the running container, allowing you to interact with it just like you would with a regular Linux shell.
Requirements
- GCC/G++ >= 13.1
- CMake >= 3.22
- Python >= 3.8
- Ubuntu/Debian
sudo apt update && \
sudo apt upgrade -y && \
sudo apt install -y \
build-essential wget curl \
ninja-build cmake libopenblas-dev \
libgflags-dev python3-dev libprotobuf-dev \
protobuf-compiler unzip libssl-dev zlib1g-dev
- Red Hat
yum update &&
yum install -y \
gcc gcc-c++ make git curl wget \
ninja-build libffi-devel openssl-devel \
protobuf-devel gflags-devel zlib-devel \
openblas-devel unzip \
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
Run rustup installer non-interactively (-y).
source ~/.cargo/env
This places cargo and rustc in /root/.cargo & activate Rust Environment
In case you do not have a Docker environment available, we strongly recommend that you use a Python venv
(virtual environment) to ensure proper isolation of dependencies and reproducibility of results.
-
Create the virtual environment (replace 'venv' with your preferred name)
python3 -m venv venv
-
Activate the virtual environment on Linux or macOS
source venv/bin/activate
This practice minimizes conflicts between global packages and project-specific requirements.
Then run env_config.sh
script
chmod +x installers/*.sh
./installers/env_config.sh
This script automates the setup. Installing Python essentials, LibTorch, FAISS, and configuring Conan profile.
The build.sh
is a development version pipeline, that makes it easier to compile and test all five modules.
Ensure the scripts have the execution permission
chmod -R +x ./CMAKE/*/sub_mod_build.sh
chmod +x ./build.sh
./build.sh all
./build.sh MODULE-NUMBER
Each module (CMAKE_LIBS
, CMAKE_META
, CMAKE_EMBED
, CMAKE_EXTRACT
, CMAKE_CHUNKS_CLEAN
) has its own sub_mod_build.sh
script, which:
- Cleans the build/ folder
- Installs Conan dependencies if missing
- Compiles the code
- Sends the purecpp_*.so output to the central
Sandbox/
The shared object will be placed inside the Sandbox/
Sandbox/
βββ Resources/
βββ purecpp_*.so
βββ YOUR-TEST.py
To test the Python bindings:
import purecpp_MODULE