Setup#

User Setup#

Python#

Simply run the following line in command:

pip install chiquito

Then import chiquito in .py file. See more in the \examples folder.

Rust#

Add the following line to [dependencies] in Cargo.toml:

chiquito = { git = "https://github.com/privacy-scaling-explorations/chiquito.git" }

Then use chiquito in .rs file. See more in the \examples folder.

Contributor Setup#

Python#

Clone this repo and navigate to the root directory of this repository:

git clone https://github.com/privacy-scaling-explorations/chiquito/
cd chiquito

Chiquito’s Python frontend uses PyO3 and Maturin to expose Rust APIs to Python. Maturin requires the user to locally build a Python virtual environment. Run the following script to create a Python virtual environment, install required packages, and build the project.

python3 -m venv .env # create virtual environment
source .env/bin/activate # activate virtual environment
pip install -r requirements.txt # install required python dependencies from requirements.txt
pip install jupyterlab # install required package to run the Jupyter Lab
maturin develop # build the project with rust bindings

If the above doesn’t work, follow the guide here: https://pyo3.rs/main/getting_started#python

To test if your setup is successful, run the fibonacci.py example file using the following script in the virtual environment:

python3 example/fibonacci.py

You can also run the mimc7.py example:

python3 example/mimc7.py

If setup is correct, you should see an OK(()) message printed in the terminal.

Rust#

Simply clone and modify this repo:

git clone https://github.com/privacy-scaling-explorations/chiquito/

Jupyter#

To modify and contribute to the Jupyter book .ipynb files in this book, you can use an IDE like VSCode. Alternatively, you can modify .ipynb files in the browser according to the following steps:

First, install jupyter:

pip install jupyter

Then, make sure you’ve set up your local Python virtual environment as directed above and install it as a Jupyter Lab Kernel called chiquito_kernel:

python -m ipykernel install --user --name=chiquito_kernel

After that, run the following:

cd book # navigate to the book subfolder
jupyter lab # launch jupyter notebook in browser

In browser, make sure you are using the Kernel we just created called chiquito_kernel, which you can change by going to the Kernel tab of Jupyter Lab’s top menu bar and click Change Kernel...

Chiquito’s Python frontend requires using a Python virtual environment for its dependencies, which you should have setup following the Python README.

Specifically, after cloning Chiquito, you need to run the following commands in your local machine (NOT in Jupyter):

python3 -m venv .env # create virtual environment
source .env/bin/activate # activate virtual environment
pip install -r requirements.txt # install required python dependencies from requirements.txt
maturin develop # build the project with rust bindings

Then install your local Python virtual environment as a Jupyter Lab Kernel called chiquito_kernel.

python -m ipykernel install --user --name=chiquito_kernel

After that, run the following:

cd tutorials # navigate to the tutorials subfolder
jupyter lab # launch jupyter notebook in browser

In browser, make sure you are using the Kernel we just created called chiquito_kernel, which you can change by going to the Kernel tab of Jupyter Lab’s top menu bar and click Change Kernel...