This repository explores the integration of Rust into Python applications, demonstrating how both languages can work together effectively. It includes examples and tests to assess real-world use cases and performance benefits.
- python -m venv .venv
- activate the venv
- pip install maturin (build system for building and publishing rust crates as python packages)
- maturin init & select --> pyo3
- create the folder in the root directory where all the python files will be kept e.g. src-py
- create a python file in the python directory e.g. src-py\example_import_rust_function.py
- import the function, with the rust #[pymodule] attribute, that is located in the src\lib.rs file e.g. example
- then run maturin develop --release (which builds the lib.rs file and installs it as a package in the .venv)
- then run the python file with the imported rust functions e.g. python [python file you created in step 6]