Skip to content

hstm/python-rust-module

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

python-rust-module

A sample implementation of a Python module with a Rust backend

This Python module uses Rust code for performance-critical parts. The standard approach is using PyO3, which makes creating Python extensions in Rust straightforward.

Build

  1. Checkout the repository git clone https://github.com/hstm/python-rust-module.git
  2. Create a Python venv python -m venv rust_module and activate it source rust_module/bin/activate
  3. Install maturin pip install maturin
  4. Run maturin develop to build and install the Python wheel.

Test

Then in your Python shell, run some tests with the new module:

from my_rust_module import fast_computation, process_with_validation

result1 = fast_computation(100)
result2 = process_with_validation([1.0, 4.0, 9.0, 16.0])

About

A sample implementation of a Python module with a Rust backend

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages