Files
zeekay f968edf75a Rename the Concrete dialect and project identifiers to Torus
The MLIR dialect, its conversion passes (TFHEToConcrete, ConcreteToCAPI,
ConcreteToLLVM), the optimizer component, the compiler binary, the Rust
crate and the program_info parameter file all still carried the upstream
project's name. They now carry this one's.

Two things deliberately keep the word, because in them it is not the name.
mlir::OpTrait CRTP parameters mean "the derived type", so they are spelled
Derived and OpTy — LLVM's other conventional spelling for the same idiom.
concreteShape is a capnp field: renaming it would change the serialized
protocol, and the prose describing it is ordinary English.

This also repairs references the earlier partial rename left dangling:
Security.cpp included concrete/curves.gen.h and the directory is torus/,
torus-cpu.h included concrete-num_complex.h, the Torus dialect CMakeLists
named ConcreteOps.td, and compiler/setup.py asked find_namespace_packages
for a "concrete" package that no longer exists — so it built without the
package it ships.
2026-08-27 13:17:38 -07:00

2.0 KiB

Python Frontend

Installation for end-users

End-users should install torus-python using pip:

pip install torus-python

Note: Not all versions are available on PyPI. If you need a version that is not on PyPI (including nightly releases), you can install it from our package index by adding --extra-index-url https://pypi.luxfhe.com/cpu/. GPU wheels are also available under https://pypi.luxfhe.com/gpu/ (check https://pypi.luxfhe.com/ for all available platforms).

Setup for development

Developers that want to contribute to the Torus-Python project can use the following approach to setup their environment.

# clone the repository
git clone https://github.com/luxfhe/torus.git --recursive
cd torus

# create virtual environment
cd frontends/torus-python
make venv

# activate virtual environment
source .venv/bin/activate

# build the compiler bindings
cd ../../compilers/torus-compiler/compiler
make python-bindings

# set bindings build directory as an environment variable
# *** NOTE ***: You must use the Release build of the compiler! 
# For now, the Debug build is not compatible with torus-python
export COMPILER_BUILD_DIRECTORY=$(pwd)/build
echo "export COMPILER_BUILD_DIRECTORY=$(pwd)/build" >> ~/.bashrc

# run tests
cd ../../../frontends/torus-python
make pytest

VSCode setup

Alternatively you can use VSCode to develop Torus-Python:

Suppose the compiler bindings were built in /home/lux/torus/compilers/torus-compiler/compiler/build:

  • Create a .env file in the torus-python root directory
  • Determine the absolute path of the local compiler repository, e.g. /home/lux/torus. Replace this with your path in the following two lines
  • Add to it PYTHONPATH=$(PYTHON_PATH):/home/lux/torus/compilers/torus-compiler/compiler/build/tools/toruslang/python_packages/toruslang_core/
  • Add to it LD_PRELOAD=/home/lux/torus/compilers/torus-compiler/compiler/build/lib/libToruslangRuntime.so

You can now configure pytest in VScode and run the tests using the graphical interface.