PyO3
uniffi-rs
PyO3 | uniffi-rs | |
---|---|---|
153 | 29 | |
12,249 | 2,803 | |
1.8% | 3.8% | |
9.8 | 9.4 | |
6 days ago | 7 days ago | |
Rust | Rust | |
Apache License 2.0 | Mozilla Public License 2.0 |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
PyO3
- GraalPy β A high-performance embeddable Python 3 runtime for Java
- Advanced Python: Achieving High Performance with Code Generation
-
Python extensions should be lazy
Sorry, "FFI" was a shorthand for "mixing and matching two languages GC expectations, memory layouts, ..." and all the overhead associated with merging something opinionated, like Rust, with something dynamic, like Python. You almost certainly _can_ reduce that overhead further, but unless somebody has gone out of their way to do so, the default expectation for cross-language calls like that should be that somebody opted for maintainable code that has actually shipped instead of shaving off every last theoretical bit of overhead.
It's been a few years, so I really can't tell you exactly what the problem was (other than the general observation that you should try to do nontrivial amounts of work in your python extensions rather than trivial amounts), but PyO3 agrees with the general sentiment [0] [1], or at least did at roughly the same time I was working there.
[0] https://github.com/PyO3/pyo3/issues/679
[1] https://github.com/PyO3/pyo3/issues/1470
- Rust Bindings for the Python Interpreter
-
Accepting Bitcoin payments with Python, Rust and PyO3
This blog post is meant to be an introduction to PyO3 by walking the reader through the build process of a non-trivial extension module in Rust using PyO3. Some familiarity with Python and Rust is recommended to get the most out of this post, basic understanding of Bitcoin concepts may be required to fully grasp the code samples.
- Crossing the Impossible FFI Boundary, and My Gradual Descent into Madness
-
Encapsulation in Rust and Python
Integrating Rust into Python, Edward Wright, 2021-04-12 Examples for making rustpython run actual python code Calling Rust from Python using PyO3 Writing Python inside your Rust code β Part 1, 2020-04-17 RustPython, RustPython Rust for Python developers: Using Rust to optimize your Python code PyO3 (Rust bindings for Python) Musing About Pythonic Design Patterns In Rust, Teddy Rendahl, 2023-07-14
- Polars β A bird's eye view of Polars
-
In Rust for Python: A Match from Heaven
This story unfolds as a captivating journey where the agile Flounder, representing the Python programming language, navigates the vast seas of coding under the wise guidance of Sebastian, symbolizing Rust. Central to their adventure are three powerful tridents: cargo, PyO3, and maturin.
uniffi-rs
- UniFFI: A multi-language bindings generator for Rust
- Crossing the Impossible FFI Boundary, and My Gradual Descent into Madness
-
Ask HN: How's your experience with Compose/Kotlin multiplatform?
Kinda. Did a dummy project in a few languages to see what I wanted to use for the big project.
Looked at Go, Swift, Kotlin MP, and Rust.
I liked Kotlin tools, and small binary size. If I knew I wasn't going to need more libraries in the future I might pick it.
Go is great, although binaries a bit large with the runtime packed in, and TinyGo too limiting.
Rust: I couldn't find a good multi-language binding package so I skipped it... then later found https://github.com/mozilla/uniffi-rs It could be a top contender.
-
Opaque Types for UniFFI
On my youtube series "Growing up Rust", I'm building a personal CRM in Rust with a Swift frontend. I'm using CQRS and an event-driven architecture with the least amount of swift as possible. I'm using UniFFI to generate the bindings for swift (and in this example python)
-
Willow Protocol
Not officially. We currently have bindings for rust, python, golang and swift.
These were the most asked for bindings (python for ml, golang for networking and swift for ios apps).
We are using uniffi https://mozilla.github.io/uniffi-rs/
Would you need C or C++ bindings?
- UniFFI: Automatically generate foreign-language bindings for Rust libraries
- Compiling Rust for .NET, using only tea and stubbornness
-
Show HN: Pip Imports in Deno
An alternative is metacall. The example in the readme is about calling Python from Javascript, but it also works with other languages, like Ruby, C#, Java, and other languages
https://github.com/metacall/core
List of supported languages here https://github.com/metacall/core/blob/develop/docs/README.md...
In the future, maybe webidl (or extensions of it) will bring interoperability between languages too. At the moment there is https://mozilla.github.io/uniffi-rs/ for interoperability between Rust and a number of languages (basically the ones mozilla needs: Swift, Kotlin, Javascript)
-
ffizz: Build a Beautiful C API in Rust
The tooling for the first kind -- calling Rust from another language -- is a bit less developed, and tends to rely on code generation that doesn't necessarily produce a natural C API. cbindgen, uniffi, cxx, and Diplomat all take this course.
-
macOS Apps in Rust
Mozilla's uniffi-rs is really good. You write a common IDL and the bindings are generated automatically.
https://github.com/mozilla/uniffi-rs
What are some alternatives?
rust-cpython - Rust <-> Python bindings
flutter_rust_bridge - Flutter/Dart <-> Rust binding generator, feature-rich, but seamless and simple.
pybind11 - Seamless operability between C++11 and Python
rust-android-gradle
RustPython - A Python Interpreter written in Rust
cxx - Safe interop between Rust and C++
milksnake - A setuptools/wheel/cffi extension to embed a binary data in wheels
wasmer-go - πΉπΈοΈ WebAssembly runtime for Go
bincode - A binary encoder / decoder implementation in Rust.
glommio - Glommio is a thread-per-core crate that makes writing highly parallel asynchronous applications in a thread-per-core architecture easier for rustaceans.
wasmtime - A fast and secure runtime for WebAssembly
buttplug-rs - Rust Implementation of the Buttplug Sex Toy Control Protocol