Use rust code in Python with pyo3

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • python-rust-arrow-interop-example

    Example of using the Apache Arrow C Data Interface between Python and Rust

  • pyttfwrap

    Preview how plain text would wrap were it rendered with a given ttf font for a given line width

    I recently wanted to use some rust crates from Python and decided to give PyO3 a go and I must say it works really well.

    Took about one evening to plug it all together and get it running. The guide at pyo3.rs was really helpful and maturin to build binary packages just works. You pass in python types and they arrive as rust-native types. Makes writing code feel very native.

    The result: https://github.com/Grollicus/pyttfwrap takes a string and splits it as it would wrap when rendered with a given TTF font. Most of the code is about keeping a reference to the loaded font as that's an expensive operation.

    Was some great fun and I'm sure I'll use it some more.

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

  • maturin

    Build and publish crates with pyo3, rust-cpython and cffi bindings as well as rust binaries as python packages

    1. The Python code calling the Rust code raises a runtime-related exception, but it doesn't crash the process.

    2. Building Python extensions out of PyO3 code is easy with maturin: https://github.com/PyO3/maturin

  • PyCall.jl

    Package to call Python functions from the Julia language

  • pyo3-deserializer

    An example deserializer written in Rust, callable from Python

    This is actually a deserializer which I wrote. I would have done it in C but I stumbled on PyO3 and gave it a go: https://github.com/m3047/pyo3-deserializer

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts