From ecf7f00cd8b6afc9c25e63fde4cfa2e0ded1a0eb Mon Sep 17 00:00:00 2001 From: JeanArhancet Date: Sat, 11 Jan 2025 14:24:20 +0100 Subject: [PATCH 1/2] docs: add python bindings --- CONTRIBUTING.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b22955bfd..0c0dafc3d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -94,3 +94,18 @@ The `simulator` directory contains a deterministic simulator for testing. What this means is that the behavior of a test run is deterministic based on the seed value. If the simulator catches a bug, you can always reproduce the exact same sequence of events by passing the same seed. The simulator also performs fault injection to discover interesting bugs. + +## Python Bindings + +Limbo provides Python bindings built on top of the [PyO3](https://pyo3.rs) project. +To compile the Python bindings locally, you need to have [Maturin](https://pypi.org/project/maturin/) installed: + +```bash +pip install maturin +``` + +Once Maturin is installed, you can build the crate and install it as a Python module directly into the current virtual environment by running: + +```bash +cd bindings/python && maturin develop +``` \ No newline at end of file From 94ff7ac48c5f412ccaf270efad803592568dfc9c Mon Sep 17 00:00:00 2001 From: JeanArhancet Date: Sun, 12 Jan 2025 18:44:58 +0100 Subject: [PATCH 2/2] docs: add instructions for creating and using a Python virtual environment --- CONTRIBUTING.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0c0dafc3d..420794286 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -98,7 +98,14 @@ The simulator also performs fault injection to discover interesting bugs. ## Python Bindings Limbo provides Python bindings built on top of the [PyO3](https://pyo3.rs) project. -To compile the Python bindings locally, you need to have [Maturin](https://pypi.org/project/maturin/) installed: +To compile the Python bindings locally, you first need to create and activate a Python virtual environment (for example, with Python `3.12`): + +```bash +python3.12 -m venv venv +source venv/bin/activate +``` + +Then, install [Maturin](https://pypi.org/project/maturin/): ```bash pip install maturin