Skip to content
This repository was archived by the owner on Dec 26, 2024. It is now read-only.

fawq/Rython

Repository files navigation

Rython

To build local package use

maturin develop --release

Use text_signature to create python type

/// 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())
}

Add .pyi file using mypy

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 python

It will produce calc.pyi with:

def sum_as_string(a: int, b: int) -> str: ...

About

Small project developed by me to learn PyO3 library.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •