| Crates.io | py-runner |
| lib.rs | py-runner |
| version | 0.1.0 |
| created_at | 2025-05-26 15:46:00.415889+00 |
| updated_at | 2025-05-26 15:46:00.415889+00 |
| description | Simple tool that allows you to execute Python code from Rust. |
| homepage | |
| repository | |
| max_upload_size | |
| id | 1689979 |
| size | 15,899 |
Simple tool that allows you to execute Python code from Rust.
let x = execute_code("x = '10'", |_, globals| {
globals.get_item("x")?.unwrap().extract::<String>()
}).unwrap();
let project1 = PythonModule::new_project(Path::new("./my-project/main.py").into()).unwrap();
let sum = project1.action(|_, module| module.call_method1("add", (1, 2))?.extract::<i64>()).unwrap();
let module1 = PythonModule::new_module(Path::new("./my-module")).unwrap();
let sum = module1.action(|_, module| module.call_method1("add", (1, 2))?.extract::<i64>()).unwrap();