Skip to content
Discussion options

You must be logged in to vote

What's the entry point of your program? Do you want to ship a single executable, or are you fine to create a Python environment?

If you want a single executable, PyOxidizer has worked pretty well for many users.

If you are fine to create a Python environment, then I'd compile your Rust as a Python extension and use it as part of normal Python scripting.

Usually the best way to call into Python would be to import it via normal mechanisms:

#[pyfunction]
fn call_some_foo(py: Python<'_>) -> PyResult<()> {
    let foo = PyModule::import(py, "foo")?;
    // call a function in the foo package
    foo.getattr("some_function")?.call0()?;
    Ok(())
}

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@l-monninger
Comment options

Answer selected by l-monninger
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants