pybind11 VS PyO3

Compare pybind11 vs PyO3 and see what are their differences.

InfluxDB – Built for High-Performance Time Series Workloads
InfluxDB 3 OSS is now GA. Transform, enrich, and act on time series data directly in the database. Automate critical tasks and eliminate the need to move data externally. Download now.
www.influxdata.com
featured
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com
featured
pybind11 PyO3
43 158
16,589 13,569
1.1% 1.8%
9.3 9.7
about 22 hours ago 6 days ago
C++ Rust
GNU General Public License v3.0 or later Apache License 2.0
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
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.

pybind11

Posts with mentions or reviews of pybind11. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2023-11-06.

PyO3

Posts with mentions or reviews of PyO3. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2025-03-01.
  • Show HN: Robyn – "Batman Inspired" Python Web Framework Built with Rust
    7 projects | news.ycombinator.com | 1 Mar 2025
  • Rust Bindings for the Python Interpreter
    1 project | news.ycombinator.com | 11 Jan 2025
    1 project | news.ycombinator.com | 23 Jul 2024
  • Ask HN: Python in the NoGIL World
    2 projects | news.ycombinator.com | 20 Dec 2024
    PyO3 0.23.0 was a big release I’ve been tinkering with extensively and support for “free-threaded Python” is a headline feature and I imagine this NoGIL Python will be extremely nice for Rust interoperability so there is definitely interest in that crate. Also could be huge for queueing data for GPUs, api servers, bulk data fetching.

    For whatever reason (maybe post 2to3 PTSD), Python community seems not extremely eager to jump on latest versions of Python and it often takes a long time for popular libraries to support the latest and greatest, so I’d recommend patience and baby steps

    https://github.com/PyO3/pyo3/releases/tag/v0.23.0

  • How to introduce 🦀 Rust at your company 🏭?
    2 projects | dev.to | 19 Dec 2024
    🤖 Unlike the above languages Rust can also be used as a replacement of part of the application. Especially if there is a part that needs some speed-up or needs some memory saving. One could replace part of a Python or Node project by Rust and embed the code using PyO3 or napi respectively. This is also going to be the topic of the presentation of Aviram Hassan called Microdosing Rust to your organization.
  • An interpreter inside an interpreter
    2 projects | dev.to | 25 Nov 2024
    The interop shop for Rust and Python is Pyo3. As the only game in town, Pyo3 uses the Foreign Function Interface (FFI) to allow your Rust code to make calls into the CPython binary. This works by agreeing on the Application Binary Interface (ABI), a concept I used during my career at AMD. Core software ftw!
  • GraalPy – A high-performance embeddable Python 3 runtime for Java
    14 projects | news.ycombinator.com | 17 Sep 2024
  • Advanced Python: Achieving High Performance with Code Generation
    5 projects | news.ycombinator.com | 6 Sep 2024
  • Python extensions should be lazy
    3 projects | news.ycombinator.com | 7 Aug 2024
    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

  • Accepting Bitcoin payments with Python, Rust and PyO3
    3 projects | dev.to | 22 Jul 2024
    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.

What are some alternatives?

When comparing pybind11 and PyO3 you can also consider the following projects:

nanobind - nanobind: tiny and efficient C++/Python bindings

rust-cpython - Rust <-> Python bindings

sparsehash - C++ associative containers

uniffi-rs - a multi-language bindings generator for rust

LSHBOX - A c++ toolbox of locality-sensitive hashing (LSH), provides several popular LSH algorithms, also support python and matlab.

RustPython - A Python Interpreter written in Rust

InfluxDB – Built for High-Performance Time Series Workloads
InfluxDB 3 OSS is now GA. Transform, enrich, and act on time series data directly in the database. Automate critical tasks and eliminate the need to move data externally. Download now.
www.influxdata.com
featured
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com
featured

Did you know that C++ is
the 7th most popular programming language
based on number of references?