use pyo3::prelude::*; #[pyfunction] fn hello(name: &str) -> PyResult { Ok(format!("Hello, {}! Welcome from Rust 🦀", name)) } #[pymodule] fn sample_rust(_py: Python, m: &PyModule) -> PyResult<()> { m.add_function(wrap_pyfunction!(hello, m)?)?; Ok(()) }