Skip to content

A toy example showing how to run Rust code in Python for speed and progress.

Notifications You must be signed in to change notification settings

wonderfulspam/monty-pyrs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PoC: Integrating Rust in Python

A toy example showing how to run Rust code in Python for speed and progress.

Requirements

  • Python 3.6+
  • Rust 1.44+
  • Cargo (bundled with Rust)

Setup

python -m venv .venv
source .venv/bin/activate # or source .venv/bin/activate.fish
pip install maturin
maturin develop --release # Pass --release flag to Cargo for speedups
python run.py # Runs timed Monty Hall simulations in Python and Rust

Run cargo doc --open to peruse the documentation. Run cargo test to run the doctests embedded in the documentation.

Credits

PyO3 which provides macros for exposing Rust code to Python and Maturin which handles the scaffolding.

Python implementation adapted from vaetas/monty_hall.py.

About

A toy example showing how to run Rust code in Python for speed and progress.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published