Skip to main content

Small project developed by me to learn PyO3 library.

Project description

Rython

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: ...

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rython_calc-0.4.13.tar.gz (18.2 kB view hashes)

Uploaded Source

Built Distributions

rython_calc-0.4.13-cp312-none-win_amd64.whl (116.1 kB view hashes)

Uploaded CPython 3.12 Windows x86-64

rython_calc-0.4.13-cp312-none-win32.whl (111.0 kB view hashes)

Uploaded CPython 3.12 Windows x86

rython_calc-0.4.13-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (227.9 kB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

rython_calc-0.4.13-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl (296.3 kB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ s390x

rython_calc-0.4.13-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (247.6 kB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ ppc64le

rython_calc-0.4.13-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (239.3 kB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ ARMv7l

rython_calc-0.4.13-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (235.2 kB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ ARM64

rython_calc-0.4.13-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl (236.3 kB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.5+ i686

rython_calc-0.4.13-cp312-cp312-macosx_11_0_arm64.whl (180.6 kB view hashes)

Uploaded CPython 3.12 macOS 11.0+ ARM64

rython_calc-0.4.13-cp312-cp312-macosx_10_12_x86_64.whl (184.6 kB view hashes)

Uploaded CPython 3.12 macOS 10.12+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page