Skip to content

Simple example of using PyO3 to call a Rust function from Python

License

Notifications You must be signed in to change notification settings

jeremy-miller/rust-library-from-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rust Library From Python

Simple example of using PyO3 to call a Rust function from Python.

Setup

This code assumes both Rust and Python are installed.

  1. Create virtual environment: python -m venv .venv
  2. Activate virtual environment: source .venv/bin/activate
  3. Install requirements: pip install -r requirements.txt
  4. Install the Rust package inside the Python virtualenv: maturin develop

Run

To run the Python example: python main.py

About

Simple example of using PyO3 to call a Rust function from Python

Topics

Resources

License

Stars

Watchers

Forks