maturin develop --release/// Formats the sum of two numbers as string.
#[pyfunction(text_signature = "(a: int, b: int) -> str")]
fn sum_as_string(a: usize, b: usize) -> PyResult<String> {
Ok((a + b).to_string())
}Keep in mind that is only works for #[pyfunction]. Macros like #[pyclass] and #[pymethods] are still unsupported.
For autocompletion .pyi in bash type:
stubgen -p rython.calc -o pythonIt will produce calc.pyi with:
def sum_as_string(a: int, b: int) -> str: ...