py-runner 0.1.0

Simple tool that allows you to execute Python code from Rust.
Documentation
  • Coverage
  • 62.5%
    5 out of 8 items documented0 out of 7 items with examples
  • Size
  • Source code size: 15.43 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 425.39 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 23s Average build duration of successful builds.
  • all releases: 23s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • frederik-uni

py-runner

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();