PyCon Lithuania 2024

The role of Rust, Zig and C++ in the Python ecosystem
2024-04-04 , Room 111

Python's ecosystem is one of the best out there, and this is mainly due to its community and what lies inside its core, a C API.

Being partially in C enables Python to interact with many languages out there which might be known by you like C++, Rust or Zig. But how does it work?

On this talk, you will be able to understand how Python can embrace the power and performance of other languages, in order to expose modules that improve the whole ecosystem.


The standard Python implementation is written in C (mostly) and the potential of that detail has been demonstrated with the evolution of the ecosystem, among them, the focus on calculations with a performance and precision necessary to be part of scientific projects that revolutionize different fields.

But how do extensions work?
In this talk we will see how different programming languages offer the possibility of extending Python, and current cases to which its popularity can be attributed.

Practical examples of extensions in C++, Rust and Zig will be presented, using the C-API and binding generators tools that are currently the being used in popular Python packages.

After this talk, you will have a general understanding of the process, and will have a starting point to hopefully create the next blazing-fast Python package, that will improve the ecosystem.

Outline

  • Introduction to CPython and its C-API [4 min]
  • Using C++
  • Introduction to the language [2 min]
  • Python binding example [3 min]
  • Using Rust
  • Introduction to the language [2 min]
  • Python binding example [3 min]
  • Using Zig
  • Introduction to the language [2 min]
  • Python binding example [3 min]
  • Binding generators
  • Example with a few tools like pybind11/nanobind, shiboken, and PyO3 but mentioning other as well [5 min]
  • Other languages
  • Brief mention to other languages and their possibilities [1 min]

Hello! My name is Cristián and I currently work as Sr. R&D Manager at The Qt Company. One of my main responsibilities is the Qt for Python project (PySide/Shiboken), which is the set of official bindings of the Qt Framework to Python. In my day to day, I work with C++, Python and CPython, which are usually the topics of my talks. In my spare time, I like to collaborate with Open Source communities, mainly Python such as Python en Español https://hablemospython.dev, Python Chile https://pythonchile.cl, Python España https://es.python.org, and conferences like PyConUS and Europython, and much more!